UnixTools01: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 14: | Line 14: | ||
[[UnixTools01_01a|genauer]] |
[[UnixTools01_01a|genauer]] |
||
= ssh - login on a different computer = |
|||
* ssh redlich@gruenau.informatik.hu-berlin.de |
* ssh redlich@gruenau.informatik.hu-berlin.de |
||
* hostname -f |
* hostname -f |
||
Line 20: | Line 20: | ||
[[UnixTools01_02|genauer]] |
[[UnixTools01_02|genauer]] |
||
= Files, Directories, Working Directory = |
|||
* ls |
* ls |
||
* pwd |
* pwd |
||
Line 29: | Line 29: | ||
= Path Names = |
|||
* a/b/c relativer Path |
* a/b/c relativer Path |
||
* /a/b/c absoluter Path |
* /a/b/c absoluter Path |
||
Line 39: | Line 39: | ||
[[UnixTools01_04|genauer]] |
[[UnixTools01_04|genauer]] |
||
= Basic Shell Commands = |
|||
* cat |
* cat |
||
* touch |
* touch |
||
Line 48: | Line 48: | ||
[[UnixTools01_05|genauer]] |
[[UnixTools01_05|genauer]] |
||
= Using Wildcards to identify files = |
|||
* echo Hello World |
* echo Hello World |
||
* echo * |
* echo * |
||
Line 63: | Line 63: | ||
[[UnixTools01_06|genauer]] |
[[UnixTools01_06|genauer]] |
||
= Editor= |
|||
* nano |
* nano |
||
* alternatives: vi, vim, nedit, emacs |
* alternatives: vi, vim, nedit, emacs |
||
[[UnixTools01_07|genauer]] |
[[UnixTools01_07|genauer]] |
||
= more basic tools = |
|||
* more |
* more |
||
* wc |
* wc |
||
Line 79: | Line 79: | ||
= Getting help = |
|||
* grep --help |
* grep --help |
||
[[UnixTools01_09|genauer]] |
|||
= Redirection - part 1 = |
|||
redirecting output of a programm to another file |
redirecting output of a programm to another file |
||
Line 99: | Line 100: | ||
* ls -lisa /bin | more |
* ls -lisa /bin | more |
||
* ls -lisa /bin | wc |
* ls -lisa /bin | wc |
||
[[UnixTools01_10|genauer]] |
|||
= Redirection, Wildcards - part 2 = |
|||
* << END |
* << END |
||
* ls * 2> /dev/null |
* ls * 2> /dev/null |
||
Line 107: | Line 109: | ||
* ~/file.txt |
* ~/file.txt |
||
* ~redlich/file2.txt |
* ~redlich/file2.txt |
||
[[UnixTools01_11|genauer]] |
|||
= Argumente, z.B. Dateinamen, mit Sonderzeichen = |
|||
* touch "Good Morning" |
* touch "Good Morning" |
||
* touch '$*()#!' |
* touch '$*()#!' |
||
[[UnixTools01_12|genauer]] |
|||
Q&E: |
Q&E: |
Revision as of 12:45, 28 November 2024
Unix-Tools: Bash 1 (Anfänger)
login, logout
- Login screen
- Bash-Kommandos
- Logout
- Wer bin ich, und wo?
- id
- who
- hostname
- history
ssh - login on a different computer
- ssh redlich@gruenau.informatik.hu-berlin.de
- hostname -f
- uname -a
Files, Directories, Working Directory
- ls
- pwd
- cd
- ls -l
- Die Verzeichnisse . und ..
Path Names
- a/b/c relativer Path
- /a/b/c absoluter Path
- usage of <TAB> when entering file names in bash
- ~/..
- /tmp/../etc/../../bin/../usr
- /usr/bin/././..
Basic Shell Commands
- cat
- touch
- rm
- mkdir
- rmdir
- mv
Using Wildcards to identify files
- echo Hello World
- echo *
- ls *
- ls *.*
- ls a*
- ls *a
- ls *a*
- rm /tmp/a*
- ls /tmp/[a-c]*
- ls /*/bin/a*
Editor
- nano
- alternatives: vi, vim, nedit, emacs
more basic tools
- more
- wc
- grep
- tail
- head
- find
- Expert Tipp: grep muster $(find / -name patern -print)
Getting help
- grep --help
Redirection - part 1
redirecting output of a programm to another file
- ls /bin/a* > file.txt
- ls > /dev/null
append output to a file
- ls /bin/b* >> file.txt
let a programm take its input from a file (redirecting input)
- more < file.txt
- wc < file.txt
let the output of programm be used as input of another progra,
- ls -lisa /bin | more
- ls -lisa /bin | wc
Redirection, Wildcards - part 2
- << END
- ls * 2> /dev/null
- grep 2>&1 | more
- ~/file.txt
- ~redlich/file2.txt
Argumente, z.B. Dateinamen, mit Sonderzeichen
- touch "Good Morning"
- touch '$*()#!'
Q&E:
- Legen Sie eine Datei an, die 'Hello World!" heisst (mit Leerzeichen), und löschen Sie diese Datei anschliessend wieder.
- Löschen Sie im aktuellen Verzeichnis eine Datei, die '--help' heisst
- Legen Sie eine Datei an, die '2*3' heisst
- Versuchen Sie eine Datei anzulegen, die "///A///' heist.
Q&E:
- Normalerweise gibt grep alle diejenigen Zeilen der Eingabe aus, die ein angegebenes Muster enthalten. Lesen Sie die Hilfe-Seite des Befehls grep, und finden Sie heraus, wie Sie grep aufrufen müsen, damit alle Zeilen ausgegeben werden, die ein bestimmtes Mustzer NICHT enthalten.