Shell Basics Workshop Report n. 1/3 Juli 2010

>> nerdcafe Vetomat 12.7.2010        snufu/fuzzy speach, TKilla report
SHELL BASICS N°1

LinuxWorks workshop about Linux usage of the terminal.

Weekly appointment every Monday in Vetomat at 19:00. Scharnweberstrasse 35, F’hain, Berlin.

the “shell” is the program in the terminal,
–> Application –>Accessories —>Terminal
where you can run all the commands installed on the system
(the shell is called “bash” or “sh” or similar)

>> nerdcafe Vetomat 12.7.2010        snufu/fuzzy speach;  Tk report
SHELL BASICS N°1
———–

all lines in this text starting with $ can be executed in a terminal
watch the output of the commands!!  (almost) every error is written there!

useful commands:
TAB
Its enough to write few letters and use TAB key — multiple times —
to autocomplete the command!!

history:
arrow-up key     – goes back to the previous command
ctrl+r command    – search in command history

the format of the command is always:

commandname parameter1 parameter2 ..
programname -h          or
programname –help  for a long version

gives a short help and possible parameters of the command

[c]$ man programname[/c]

manual of the program – RTFM – read this to know what it does 😉

[c]$ apropos burn cd[/c]

tells which programs are doind the task

[c]$ ssh user@hostname[/c]

login to another computer by console

[c]$ screen -x[/c]

join a shared session (on another computer)
must be connected before to (ssh username@hostname)
screen runs multiple terminals (on a remote system) and you can switch between them

screen commands:
ctrl+a    a    – switch to another terminal
ctrl+a  ESC      – scroll with cursor keys

[c]$ ls[/c]

list content of current directoy

[c]$ ls -a[/c]

list –all: shows also hidden “.” dot-files (config files mostly)

[c]$ less[/c]

shows 1 PAGE of output of a command  (contrast to “more” – that shows more 🙂 )

[c]$ echo hiho > foobar[/c]

write hiho into the variable “foobar”

[c]$ cat myman</pre>
<pre>$ tom[/c]

outputs the name of the var

[c]$ cd /
"change dir" to root-dir "/"
"/" is the whole system – including all discs/partitions

[c]$ cd    or  cd ~[/c]

“change dir” to your home dir “/home/yourusername/”,

[c]$ echo foo > file1[/c]

write “foo” into a textfile file1

[c]$ cat file1[/c]

print output of file1

[c]$ head[/c]

show first lines of file

[c]$ head -n 50[/c]

show first 50 lines of file

pipe command “>”

[c]$ iwconfig > file1[/c]

write _standard_ output to file1

[c]$ iwconfig > file1[/c]

write _serror_ output to file1 – “2” is the code for error outputs

[c]$ echo ritual > fileX[/c]

add lines to file

[c]$ echo ritual2 >> fileX[/c]

[c]$ echo ritual3 >> fileX[/c]

connect terminal to remote window system

[c]$ ssh username@hostname[/c]

connect to another computer and executes commands there

[c]$ ssh -X username@hostname[/c]

activate X11 windowing forward on other computer

[c]$ username@hostname: firefox[/c]

starts for example firefox on the remote machine and shows it on your screen

[c]$ mv    file1 newfile[/c]

move file1 to another

[c]$ less filename[/c]

show content of a text file