|
Change into the given directory ("." present directory, ".." one level up, "/" top (root) directory) | |
|
Show (list) the content of the given directory (-a all, -l long, -h human readable) |
|
|
Create (make) a new directory |
|
|
Show path to the present diretroy |
|
|
Delete (remove) given directory when empty |
|
Windowed editor with a large palette of functions |
|
|
Standard in-console Unix-editors with full keyboard control |
|
For changing access rights for -r reading, -w writing and -x executing |
|
|
Copy files and directory (-r recursively) |
|
|
Shows file type and information |
|
|
Prints a text (file) on screen consecutively |
|
|
For moving (name change) of files and directories |
|
|
Deletes (removes) a given file or directory (-r recursively) |
|
|
Prints the last lines of a file to screen |
|
Combines (concatenates) several files into a single file | |
|
Search in a output for a string or expression
( | |
|
Sending file to a printer | |
|
Universal viewer for documents, images and graphics | |
|
Sorting an output or a file (-r reverse, -u unique, -g numerical) | |
|
Splitting a given file into parts | |
|
Counting lines, words and chars in an output or file (-l only lines) |
|
Gives a list of man-pages for a given subject |
|
|
Prints man pages (documentation) for a given command or program to screen |
|
For compression of files and data |
|
|
For compression and decompression (with -x) of archives and multiple files |
|
|
Compression and decompression WinZip (DOS/Win) files |
|
|
Tabbing through previous commands |
|
Prints current data to screen | |
|
Prints a list of all environment variables |
|
|
Evaluation of symbolic mathatical expresions, mostly for scripts |
|
|
Searching for files, staring from current directory. |
|
|
History of previous shell commands |
|
|
Name of hosting computer |
|
|
Password change |
|
|
|
Autocompletion of commands |
|
|
Process running in the background (used at the end of a command line) |
|
|
Terminates (kills) the current process (running in current console) |
|
Terminates (kills) a process with a given ID (PID) | |
|
Setting the priority of a given process, mostly in order not to disturb other users |
|
|
Starting a program which will continue to run after the user logs out (no hangup) |
|
|
Lists processes started by the user in present console (-a all, -l long) |
|
|
Measuring the time needed to excute a given process or program |
|
|
Shows all running processe with real-time updating of active processe and their respective CPU and memory consumption |
|
Disc use of all partitions |
|
|
Disc use of current and child directories |
|
|
Time since last reboot |
|
Data transfer to and from a remote host with line commands (file transfer protocol) |
|
|
Sending pings to remote host |
|
|
Copy data to and from remote host (secure copy) |
|
|
Connect to remote host and log in |
man command
: show manual of commandman man
: show manual of command manNAME man - an interface to the on-line reference manuals SYNOPSIS man [-c|-w|-tZ] [-H[browser]] [-T[device]] [-X[dpi]] [-adhu7V] [-i|-I] [-m system[,...]] [-L locale] [-p string] [-C file] [-M path] [-P pager] [-r prompt] [-S list] [-e extension] [--warnings [warnings]] [[section] page ...] ... man -l [-7] [-tZ] [-H[browser]] [-T[device]] [-X[dpi]] [-p string] [-P pager] [-r prompt] [--warnings[warnings]] file ... man -k [apropos options] regexp ... man -f [whatis options] page ... DESCRIPTION man is the system's manual pager. Each page argument given to man is normally the name of a program, utility or function. The manual page associated with each of these arguments is then found and displayed. A section, if provided, will direct man to look only in that section of the manual. The default action is to search in all of the available sections, following a pre-defined order and to show only the first page found, even if page exists in several sections.
ls -l
: long listing formatls -a
: list all filesls -h
: human readableuser@pc:/$ ls -l total 91 drwxr-xr-x 2 root root 4096 Mar 19 08:46 bin drwxr-xr-x 4 root root 3072 Feb 20 14:49 boot drwxr-xr-x 14 root root 14240 Apr 6 13:45 dev drwxr-xr-x 192 root root 12288 Apr 24 09:18 etc drwxr-xr-x 3 root root 0 Apr 24 09:18 home drwxr-xr-x 2 root root 6 Aug 14 2008 initrd drwxr-xr-x 17 root root 8192 Jan 29 09:53 lib drwxr-xr-x 2 root root 6 Apr 15 2008 mnt drwxr-xr-x 8 root root 4096 Apr 21 13:50 opt dr-xr-xr-x 181 root root 0 Feb 20 10:25 proc drwxr-xr-x 9 root root 4096 Jan 29 09:57 root drwxr-xr-x 2 root root 8192 Feb 20 14:48 sbin drwxr-xr-x 12 root root 0 Feb 20 10:25 sys drwxrwxrwt 132 root root 12288 Apr 24 09:20 tmp drwxr-xr-x 12 root root 133 Aug 14 2008 usr drwxr-xr-x 17 root root 4096 Aug 14 2008 var user@pc:/$
more file
: show file on screenpwd
: print full path name of current directoryuser@pc:~$ pwd /home/user user@pc:~$
cd directory
: change to directorycd /
: change to rootcd
: change to homecd ..
: one upuser@pc:~$ cd / user@pc:/$ cd var user@pc:/var$
mkdir directory
: create directorymkdir -p foo/test/abc/123/bar
: user@pc:~$ mkdir test user@pc:~$
rmdir directory
: delete directoryuser@pc:~$ rmdir test user@pc:~$ rmdir downloads rmdir: failed to remove `downloads': Directory not empty user@pc:~$
mv file1 file2
:
rename file1 to file2mv file directory
:
move file to directorymv myImages/*.jpg /home/user/otherUser/yourImages/
:
user@pc:~$ mv foo.txt bar.txt user@pc:~$ mv bar.txt downloads user@pc:~$
rm file
: delete filerm directory
: delete directoryrm -r directory
: recursive delete directory and all containing filesrm image*
: delete all files starting with
imageuser@pc:~$ rm downloads/bar.txt user@pc:~$
cat file
: print contents of filecat file1 file2 >
file3
:
concatenate the files file1 and file2
cat aaa* > aaa.all
:
concatenate all files starting with aaa
user@pc:~$ cat file1 first line of file1 second line of file1 user@pc:~$ cat file2 first line of file2 second line of file2 user@pc:~$ cat file* > all user@pc:~$ cat all first line of file1 second line of file1 first line of file2 second line of file2
ps
: list current processesps aux
: list all processesuser@pc:~$ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 4020 476 ? Ss Feb20 1:08 /sbin/init root 2 0.0 0.0 0 0 ? S Feb20 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S Feb20 0:02 [migration/0] root 4 0.0 0.0 0 0 ? S Feb20 0:23 [ksoftirqd/0] root 5 0.0 0.0 0 0 ? S Feb20 0:00 [watchdog/0] root 6 0.0 0.0 0 0 ? S Feb20 0:04 [migration/1] root 7 0.0 0.0 0 0 ? S Feb20 1:04 [ksoftirqd/1] 1635 4650 0.0 0.0 92248 2752 ? S Apr21 0:00 /usr/lib/eclipse/eclipse -vm /usr/lib/jvm/java-gcj/bin/java -install /usr/lib/eclipse 1635 4656 0.7 9.4 1021416 381456 ? Sl Apr21 29:27 /usr/lib/jvm/java-gcj/bin/java -Djava.library.path=/usr/lib/jni -Dgnu.gcj.precompiled daemon 4715 0.0 0.0 8084 524 ? Ss Feb20 0:00 /sbin/portmap root 4776 0.0 0.0 740 36 ? Ss Feb20 0:37 /usr/local/bin/netbeep eth0 statd 4813 0.0 0.0 14416 816 ? Ss Feb20 0:00 /sbin/rpc.statd -p 2051 -o 2052 1635 17246 0.0 0.1 17052 7332 pts/1 Ss 09:13 0:00 bash user@pc:~$
kill pid
: send signal TERM to
process with id pidkill -9 pid
: kill process
with id piduser@pc:~$ ps -l F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 S 1467 8100 8095 0 80 0 - 8641 wait pts/0 00:00:02 bash 0 S 1467 16732 8100 1 80 0 - 133912 poll_s pts/0 00:00:00 kwrite 0 R 1467 16797 8100 0 80 0 - 5796 - pts/0 00:00:00 ps 0 S 1467 26446 1 0 80 0 - 221014 futex_ pts/0 00:02:11 soffice.bin user@pc:~$ kill 16732
sort filename
: sort the file filename grep expression
: extract all lines
containing the expression from outputuser@pc:~$ more names.txt Ralph Junghans Anna Rosenkranz Joachim Neumayer Anna Furlger user@pc:~$ more names.txt | grep "Anna" | sort > names.anna user@pc:~$ more names.anna Anna Furlger Anna Rosenkranz
vi/vim
: standard editor
i | start inserting modus | |
R | start replacing modus | |
o | start insert in next line | |
a | start inserting at end of current line | |
esc | exit editing modi | |
u | undo last insertion or change | |
r | replace current char | |
x | delete char | |
7x | delete seven chars | |
dd | delete line | |
8dd | delete eight line | |
y | copy (yank) current line to buffer | |
9y | copy (yank) nine lines to buffer | |
p | insert buffer | |
j | move cursor a line down | |
k | move cursor a line up | |
h | move cursor to the left | |
l | move cursor to the right | |
:w | save (write) file | |
:q | exit (quit) vi | |
:wq | write and exit | |
:111 | goto line 111 | |
:1,11d | delete lines 1 through 11 | |
:1,$s/error/correct/ | substitute error by correct throught the entire file | |
:10,20s/yes/no/g | substitution from line 10 to twenty, also multiple times per line (g) |
vi/vim
editorEclipse
development environmentuser@pc:~/TEST$ ls -l total 32 -rw-rw-r-- 1 user user 1775 2012-03-09 17:58 HashMapMapDemo.class -rw-rw-r-- 1 user user 2019 2012-03-09 17:59 HashMapMapDemo.java -rw-rw-r-- 1 user user 20961 2012-03-09 15:45 hashMap.svg user@pc:~/TEST$ ls -la total 56 drwxrwxr-x 2 user user 4096 2012-03-12 09:57 . drwxr-xr-x 153 user user 12288 2012-03-12 09:56 .. -rw-rw-r-- 1 user user 1775 2012-03-09 17:58 HashMapMapDemo.class -rw-rw-r-- 1 user user 2019 2012-03-09 17:59 HashMapMapDemo.java -rw-rw-r-- 1 user user 20961 2012-03-09 15:45 hashMap.svg -rw-rw-r-- 1 user user 3 2012-03-12 09:56 .I-am-a-hidden-file
ssh remote-host
: establish a
connection to remote host scp remote-host-path .
: transfer data
from remote host to current directory
scp ./filename remote-host-path
: transfer data
from current directory to remote host
javac
/ java
:
compile / execute a Java program time...
:
measuring the time needed to excute a program nohup ... &
:
starting a program which runs in the background
(&) nohup
)user@pc:~$ ssh -l gros karlstad.th.physik.uni-frankfurt.de gros@karlstad.th.physik.uni-frankfurt.de's password: gros@karlstad:~$ cd TEST/ gros@karlstad:~$ javac Test.java gros@karlstad:~$ nohup time java Test test.old test.new & [1] 2176 gros@karlstad:~$ nohup: ignoring input and appending output to `nohup.out' gros@karlstad:~$ exit logout Connection to karlstad.th.physik.uni-frankfurt.de closed. user@pc:~$ scp gros@karlstad.th.physik.uni-frankfurt.de:TEST/nohup.out . gros@karlstad.th.physik.uni-frankfurt.de's password: nohup.out 100% 326 0.3KB/s 00:00 user@pc:~$ more nohup.out # starting Test.main() # scanning the file test.old # scanning the file test.new 1000 lines in test.old 1000 lines in test.new 84 lines in test.output 0.15user 0.02system 0:00.21elapsed 77%CPU (0avgtext+0avgdata 77248maxresident)k 888inputs+80outputs (6major+5261minor)pagefaults 0swaps
ping remote-host
: checking availability and
connection quality
user@pc:~$ ping 141.2.247.163 PING 141.2.247.163 (141.2.247.163) 56(84) bytes of data. 64 bytes from 141.2.247.163: icmp_req=1 ttl=64 time=4.99 ms 64 bytes from 141.2.247.163: icmp_req=2 ttl=64 time=0.132 ms 64 bytes from 141.2.247.163: icmp_req=3 ttl=64 time=0.263 ms 64 bytes from 141.2.247.163: icmp_req=4 ttl=64 time=0.299 ms user@pc:~$ ping findfiles.net PING findfiles.net (85.10.210.3) 56(84) bytes of data. 64 bytes from findfiles.net (85.10.210.3): icmp_req=1 ttl=55 time=6.51 ms 64 bytes from findfiles.net (85.10.210.3): icmp_req=2 ttl=55 time=6.16 ms 64 bytes from findfiles.net (85.10.210.3): icmp_req=3 ttl=55 time=6.28 ms
chmod +x
: make file executable (x)
user@pc:~$ vi test.sh user@pc:~$ chmod -x test.sh
echo
: print message to screen
sleep 8
: sleep for 8 seconds
#! /bin/bash i=0 N=2 while test $i -le $N do a=`expr 50 \\* $i` b=`expr $a + 1` more "inputFile_$i.dat" | grep "Anna" > "outFile_$b.out" echo "ich gehe jetzt für $i Sekunden schlafen " $i sleep $i; i=`expr $i + 1` done cat outFile_*.out > outFile.all
user@pc:~$ ls inputFile_0.dat inputFile_1.dat inputFile_2.dat test.sh user@pc:~$ ./test.sh ich gehe jetzt für 0 Sekunden schlafen 0 ich gehe jetzt für 1 Sekunden schlafen 1 ich gehe jetzt für 2 Sekunden schlafen 2 user@pc:~$ ls inputFile_0.dat inputFile_2.dat outFile_1.out outFile.all inputFile_1.dat outFile_101.out outFile_51.out test.sh
user@pc:~$ more inputFile_*.dat :::::::::::::: inputFile_0.dat :::::::::::::: Ralph Junghans Anna Rosenkranz Joachim Neumayer Anna Furlger :::::::::::::: inputFile_1.dat :::::::::::::: Keine Anna hier, oder etwa doch? :::::::::::::: inputFile_2.dat :::::::::::::: Hier ist nun wirklich keine anna zu finden. user@pc:~$ more outFile.all Anna Rosenkranz Anna Furlger Keine Anna hier,
gnuplot datafile
xmgrace datafile
gimp
inkscape
alpine
ooffice