maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Where to learn x terminal? (https://talk.maemo.org/showthread.php?t=56097)

sam9953 2010-06-13 19:00

Where to learn x terminal?
 
I am a very new to linux and i have never used the x terminal before and i would like to know a website or any such. webpage which can teach me the proper usage and all the important commands used in x terminal

Joorin 2010-06-13 19:04

Re: Where to learn x terminal?
 
The commands available in the XTerminal depends on what you've installed. So, there is no "one page to learn everything" resource for that.

A quick Google search gave me this link that might work as a starting point:

http://www.freesoftwaremagazine.com/...and_line_intro

Rob1n 2010-06-13 20:06

Re: Where to learn x terminal?
 
Something like this will give you a good into to the commands available. Otherwise, you can look at the busybox manual pages - the N900 uses this (an older version actually, so some of the options/commands don't work) for the basic commands. Beyond that, any general UNIX/Linux introductions will provide a lot of useful info.

xomm 2010-06-13 20:42

Re: Where to learn x terminal?
 
Thread moved to General.

A (very long) list of terminal commands.

(Click on one of the categories)

devu 2010-06-27 01:51

Re: Where to learn x terminal?
 
Any chance to collect the list of commands just for our devices here? Wiki?
I'd like to learn as well.

sudo gainroot
apt-get help

and here more or less everything is clear. But would be useful to have some kind of short description what each option actually can do.

But just help giving me list of commands that I have no idea how to use it. There is more that is impossible to guess that even exist. Try to remind yourself what did you felt seeing xterm first time in your life :)

jperez2009 2010-06-27 01:56

Re: Where to learn x terminal?
 
I noticed sudo su works in Xterm, but I dunno if that's because I installed Easy-Debian or even sudser (rush command). Works for easy root access.

Anyway, I'd say check out those links provided above and you'll learn a lot quickly if you're willing to take the time to learn. :D

Jesse~

devu 2010-06-27 02:12

Re: Where to learn x terminal?
 
From this article which seems to be for noobs (like me) The lesson I've got as well is this

Quote:

Getting help

You can learn commands in many ways. Sometimes you will see them mentioned in articles, or someone might tell you of them. When you learn of a command, it is best to try to find out what it does BEFORE you use it.

The computer assumes that you know what you are doing, and so it will happily erase the entire disk if you ask it to, without pausing to ask if you really meant to.
So... would be good to have a list of commands in common use for N8*0 N900. From this forum I've learn basics about how to navigate through the folder structure, apt-get only because of people even mentioned about this as well as kernel-config (same as above)

Is it any secret held by linux folks that they making this open platform closed for newcomers? ;)

devu 2010-06-27 02:34

Re: Where to learn x terminal?
 
For example

http://www.petrilopia.net/wordpress/...and-line-tips/

#3 so simple, you don't need to install any app to do so. So useful. I wonder how much useful things we don't know yet because lack of information.

I founded some list but unfortunately its in Spanish :(

http://www.nokioteca.net/blog/2010/0...di-x-terminal/

but this is pretty much what I'm asking for.

geneven 2010-06-27 03:17

Re: Where to learn x terminal?
 
There are MANY xterm tutorials out there to be found by googling. For starters, try as search terms xterm and tutorial.

There are not many significant differences between how xterm works on the N900 and how it works elsewhere. It would be great if someone would write a Maemo-specific xterm tutorial, and it would be easy. Just find a general tutorial, try its commands on the N900, and use the commands that work to build the tutorial.

hellnick 2010-06-27 04:34

Re: Where to learn x terminal?
 
Quote:

Originally Posted by geneven (Post 730868)
... It would be great if someone would write a Maemo-specific xterm tutorial, and it would be easy. Just find a general tutorial, try its commands on the N900, and use the commands that work to build the tutorial.

Sometimes the best tutorials for "noobs" are written by people new to the subject - they make no assumptions about what the reader already knows. Teaching others is also a great way to learn a subject yourself.

Wikiwide 2010-06-27 04:34

Re: Where to learn x terminal?
 
To get list of all commands available, click "Tab" button in X Terminal twice.

The list will be overwhelming.

If you want list of all commands beginning from something (like ab*), type ab in the line and then click "Tab" button twice. It's sort of auto-completion of commands.

If you want to know, what a certain command xyz does, type "xyz --help" and hit "Enter". It will try to explain usage of the command to you, but in most cases it's not enough. So use Wikipedia and BusyBox's official site and other Internet resources and documentation.

And, of course, before running command as root, ascertain the functionality and applicability of the command in detail.

linuxeventually 2010-06-27 05:02

Re: Where to learn x terminal?
 
foreward: this post unlike most of my posts isn't directed towards linux n00bs, but rather those that have already started to embrace shell scripting.

The main issue with reading through tutorials online is that they often assume one is using a BASH shell. The default shell on the NITs is ASH. BASH is in the repos and should be installed as it is far superior IMO. The second is that the userland uses busybox instead of coreutils. This means that certain parameters simply don't work or don't work as intended. This can be remedied by compiling the coreutil's CLI ultilites in scratchbox and saving them to the device named as cu-sort for instance (overriding the busybox filename is not recommended) in /usr/bin (the default executable PATH).

Oh and I recommend reading CAREFULLY through http://commandlinefu.com (for advanced users ONLY!)

Here is a short list of commands: http://ss64.com/bash/

Keep in mind you can install other CLI utilities (and also don't expect a lot of those commands to work at all or fully using busybox versions).

Also BASH isn't the only scripting language out there. Python and Perl are also very handy. That's what she SED ;)

Oh and if you are having troubles, blame whoever decided to strip manpages from packages compiled in scratchbox.

For any specific enquiries I recommend http://www.linuxquestions.org , http://stackoverflow.com , and http://unix.com

I don't recommend the Ubuntu forums.

linuxeventually 2010-06-27 08:36

Re: Where to learn x terminal?
 
I think that last post might seem snobby so here's a quick primer to make up for that.

Open your favorite terminal emulator (osso-xterm) or a Virtual Terminal (desktop/laptop). On a desktop my preference is gnome-terminal.

--------------------------------
user@computer:~$ echo "hello world"
hello world
says/outputs/prints text to sdtout
user@computer:~$ echo $USER
user
says/outputs/prints the currently logged in user's name
user@computer:~$ echo $PWD
/home/user
says/outputs/prints the current CD'ed directory
user@computer:~$ cd /home/user/MyDocs
Change Directory to another one. Can also be relative location, in this case $ cd MyDocs
user@computer:~/MyDocs$ echo $PWD
/home/user/MyDocs
user@computer:~/MyDocs$ cd ~
Change Directory to home directory. Can also be relative location, in this case $ cd ..
user@computer:~$ mkdir asdf
Create a directory/folder
user@computer:~$ rm -R /home/user/asdf
Be very careful with the remove command. Especially with the -R recursive parameter which deletes any files and folders within a specified folder
user@computer:~$ uname -r
2.6.21-omap1
List the kernel version. the -a parameter outputs all known information
user@computer:~$ ls -A /home/user/MyDocs
.documents .......... .sounds
.games .................. .videos
.images ................. randomfile
Lists all files and directories, including hidden ones. Hidden files and directories start with a dot/period
user@computer:~$ cat /etc/resolv.conf
#nameserver 127.0.0.1
nameserver 192.168.1.1
#nameserver 4.2.2.2
Cat spits out an entire text file to terminal. resolv.conf (remember *NIX is case-sensitive) is where DNS servers are stored. The # pound character comments/"comments out" aka disables a line of text in a BASH script/file
user@computer:~$ ps | awk '{ print $5 }'
...
/usr/bin/osso-xterm
/usr/libexec/gnome-vfs-daemon
bash
ps
awk
ps lists running processes, you might also be interested in the interactive top command. piped to awk which in this case says to only show the 5th column (separated by tab characters)
user@computer:~$ foobar='example'; echo $foobar
example
Basic example of a variable
user@computer:~$ uname -s > /dev/shm/os; cat /dev/shm/os
Example of directing output to a file. Files stored in /dev/shm are stored directly in RAM and thus are deleted on shutdown
user@computer:~$ minute() { foo=`date +%S`; echo $foo; if [ "$foo" -lt "30" ]; then echo "under half"; else echo "over half"; fi; }
Simple shell function that uses a variable and if/then/else logic
user@computer:~$ minute
29
under half
Using the shell function we just wrote, outputs the current time in seconds (only the seconds part) and whether it is closer to the last minute or next minute. Shell functions are only available for the terminal session. Save in .bashrc or .profile to be persistent/saved
user@computer:~$ minute
31
over half
user@computer:~$ /usr/bin/camera &
Everything is run from a terminal, quite literally in *NIX. A GUI program is simply a GUI over a running instance of a terminal process. Therefore the camera program can be launched. The & amperstand tells it to disassociate from the current terminal and create it's own process
user@computer:~$ ln -s /sbin/ifconfig /usr/bin
The user PATH does not include /sbin for some reason by default on NITs, which is annoying as typing in /sbin/ifconfig - which should be in /usr/bin/ anyway. Thus we are going to symlink it.
user@computer:~$ ifconfig | grep "inet addr"
Example use of grep. grep outputs the entire line matching the pattern, in this case "inet addr" which is piped into it from the output of ifconfig using the | pipe character
user@computer:~$ ifconfig | grep "inet addr" | awk '{ print $2 }' | cut -d : -f2
Advanced example pipes from ifconfig to grep to awk and finally to cut to output the clean IP address which can then be fed into something else if desired

Logged in as root from here on out. Not necessary for every command but for some of them. If you have sudoer installed you can simply prefix each command with sudo. If not you are gonna use an equivalent of sudo su - or simply login a root using another method. For easyroot users, simply type $ root and enter.

This next section is Debian-based specific
root@computer:~# apt-cache search nano
nano-tiny - free Pico clone
traceroute-nanog - Determine route of packets
nano - nano editor
Searches repos for packages by keyword
root@computer:~# apt-get install nano
install package nano. It's an easy to use CLI text editor.
root@computer:~# wget http://nitstuff.appspot.com/dists/ch....0.6_armel.deb
Instead of using the repos using wget to download .deb package from website.
root@computer:~# dpkg -i nano_2.0.6_armel.deb
Installing locally saved debian package.

The following is networking specific

root@computer:~# ssh name@192.168.1.100
...
Are you sure you want to continue connecting (yes/no)?yes
name@desktop:~$ exit
SSH example. Specify the user _at_ the IP address of the computer you want to access. Keep in mind that this works only over LAN by default (you need to forward port 22 on the router and give outside IP address or use some type of fake VPN). If you get a RSA error message, simply delete ~/.ssh/known_hosts using $ rm ~/.ssh/known_hosts Type exit to leave remote session
root@computer:~# scp name@192.168.1.100:/home/name/randomfile /home/user/
user@computer:~$ ls /home/user/randomfile
File is copied from remote computer to local computer to user's home directory. Root's home directory is /root

root@computer:~# ssh name@192.168.1.100
name@desktop:~$ screen
name@desktop:~$ hello
Leaves a shared session open
friend@laptop:~$ ssh name@192.168.1.100
name@desktop:~$ hello world
Allows you to work with a friend or simply resume a session later. Good for long tasks that need to disconnect from a machine and reconnect later.

root@computer:~# ssh name@192.168.1.100
name@desktop:~$ screen -ln nano /etc/resolv.conf
[Nano instance]
[CTRL]+[A]+[D]
Detaches from a screen leaving a process running on a remote machine
name@desktop:~$ exit
root@computer:~# ssh name@192.168.1.100
name@desktop:~$ screen -r
[Nano instance]
[CTRL]+[X]
name@desktop:~$ exit
[screen is terminating]
name@desktop:~$ exit
root@computer:~#
Detach a process. If you are running a process via ssh on a remote machine, the process is killed when the connection is interrupted, unless it was detached with screen.

crabsody 2010-07-02 12:07

Re: Where to learn x terminal?
 
Does anyone know how can we install the linux man utility (and then the man pages)?

Wikiwide 2010-07-02 12:19

Re: Where to learn x terminal?
 
Quote:

Originally Posted by crabsody (Post 738497)
Does anyone know how can we install the linux man utility (and then the man pages)?

Here are two packages for man command.

http://maemo.org/packages/view/man-db-n900/

http://maemo.org/packages/view/man-db-pages/

Does it help?

crabsody 2010-07-02 12:29

Re: Where to learn x terminal?
 
It seems so. Thanks!!!


All times are GMT. The time now is 13:34.

vBulletin® Version 3.8.8