UnixTools01: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(109 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Unix-Tools - Teil 1 (für Anfänger) = |
|||
= Bash 1 = |
|||
= Files, Directories, Working Directory = |
|||
== login, logout (on a local terminal) == |
|||
* user name , password |
|||
* id |
|||
* who |
|||
* last |
|||
* history |
|||
Changing a password: |
|||
* password |
|||
Q&E: |
|||
# Was passiert, wenn Sie mehrmals (erfolglos) versuchen, sich mit dem falschen Passwort anzumelden? Warum ist dieses Verhalten des Systems sinnvoll? |
|||
# Sie haben Ihr Passwort vergessen, was nun? |
|||
# Wie erstellt man ein sicheres Passwort? Wie/wo speichert man es? |
|||
== ssh - login on a different computer == |
|||
* ssh redlich@gruenau.informatik.hu-berlin.de |
|||
* hostname |
|||
Q&E: |
|||
# Was passiert, wenn Sie bei ssh den Nutzernamen falsch schreiben? |
|||
# Was passiert, wenn Sie bei ssh den host name falsch schreiben? |
|||
# Sie arbeiten auf einem Rechner A und verwenden dort ssh, um sich auf Rechner B einzuloggen. Welchen user name / welches password müssen Sie bei ssh verwenden? Das von Rechner A, oder das von Rechner B? |
|||
== files, directories, working directory == |
|||
* ls |
* ls |
||
* pwd |
* pwd |
||
Line 32: | Line 7: | ||
* ls -l |
* ls -l |
||
* Die Verzeichnisse . und .. |
* Die Verzeichnisse . und .. |
||
[[UnixTools01_03|genauer]] |
|||
== Pfadnamen == |
|||
* a/b/c |
|||
* /a/b/c |
|||
* usage of <TAB> when entering file names |
|||
= Path Names = |
|||
* ., .., und andere Dateien di emit . beginnen, z.B. .bash_rc |
|||
* a/b/c relativer Path |
|||
* ls -la |
|||
* /a/b/c absoluter Path |
|||
* usage of <TAB> when entering file names in bash |
|||
* .. |
* ~/.. |
||
* /tmp/../etc/../../bin/../usr |
|||
* ./a |
|||
* /usr/bin/././.. |
|||
[[UnixTools01_04|genauer]] |
|||
== basic shell commands == |
|||
= Basic Shell Commands = |
|||
* cat |
* cat |
||
* touch |
* touch |
||
Line 50: | Line 27: | ||
* mkdir |
* mkdir |
||
* rmdir |
* rmdir |
||
* mv |
|||
[[UnixTools01_05|genauer]] |
|||
Q&E: |
|||
# Was passiert, wenn Sie mit rmdir ein Verzeichnis löschen wollen, das nicht leer ist? |
|||
= Using Wildcards to identify files = |
|||
* echo Hello World |
|||
* echo * |
|||
== Using Wildcards to identify files == |
|||
* ls * |
|||
* ls * |
* ls * |
||
* ls *.* |
* ls *.* |
||
Line 63: | Line 41: | ||
* ls *a* |
* ls *a* |
||
* rm /tmp/a* |
|||
* echo Hello World |
|||
* |
* ls /tmp/[a-c]* |
||
* ls /*/bin/a* |
|||
[[UnixTools01_06|genauer]] |
|||
== Editor== |
|||
= Editor - Erstellen und Bearbeiten von Text-Dateie n= |
|||
* nano |
* nano |
||
* alternatives: vi, vim, nedit, emacs |
* alternatives: vi, vim, nedit, emacs |
||
[[UnixTools01_07|genauer]] |
|||
== basic tools == |
|||
= more basic tools = |
|||
* more |
* more |
||
* wc |
* wc |
||
* tail |
|||
* grep |
* grep |
||
* tail |
|||
* head |
|||
* find |
* find |
||
* Expert Tipp: grep muster $(find / -name patern -print) |
|||
[[UnixTools01_08|genauer]] |
|||
= Getting help = |
|||
* grep --help |
|||
[[UnixTools01_09|genauer]] |
|||
== Redirection - part 1 == |
|||
= Redirection - part 1 = |
|||
redirecting output of a programm to another file |
redirecting output of a programm to another file |
||
* ls /bin/a* > file.txt |
* ls /bin/a* > file.txt |
||
Line 86: | Line 75: | ||
append output to a file |
append output to a file |
||
* ls / |
* ls /bin/b* >> file.txt |
||
let a programm take its input from a file (redirecting input) |
let a programm take its input from a file (redirecting input) |
||
Line 92: | Line 81: | ||
* wc < file.txt |
* wc < file.txt |
||
let the output of programm be used as input of another |
let the output of programm be used as input of another program |
||
* ls -lisa /bin | more |
* ls -lisa /bin | more |
||
* ls -lisa /bin | wc |
* ls -lisa /bin | wc |
||
[[UnixTools01_10|genauer]] |
|||
== Redirection, Wildcards - part 2 == |
|||
advanced redirection |
|||
* << END |
|||
* ls * 2> /dev/null |
|||
* grep 2>&1 | more |
|||
= Argumente mit Sonderzeichen = |
|||
== Advanced filenames == |
|||
* ls [a-c]* |
|||
* touch "Good Morning" |
* touch "Good Morning" |
||
* touch '$*()#!' |
* touch '$*()#!' |
||
[[UnixTools01_12|genauer]] |
|||
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. |
|||
= Redirection - part 2 = |
|||
* ls * 2> /dev/null |
|||
* grep --help |
|||
* ls 2>&1 | more |
|||
* << END |
|||
[[UnixTools01_11|genauer]] |
|||
= Alias = |
|||
* alias ll='ls -lisa' |
|||
* .bashrc (erstes Kennenlernen) |
|||
[[UnixTools01_13|genauer]] |
|||
= Spraxche ändern = |
|||
export LANG=en_US |
|||
export LANGUAGE=en_US |
|||
export LANG=ru-RU |
|||
Q&E: |
|||
export LANGUAGE=ru-RU |
|||
# 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. |
|||
[[UnixTools01_14|genauer]] |
Latest revision as of 10:43, 13 December 2024
Unix-Tools - Teil 1 (für Anfänger)
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 - Erstellen und Bearbeiten von Text-Dateie n
- 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 program
- ls -lisa /bin | more
- ls -lisa /bin | wc
Argumente mit Sonderzeichen
- touch "Good Morning"
- touch '$*()#!'
Redirection - part 2
- ls * 2> /dev/null
- ls 2>&1 | more
- << END
Alias
- alias ll='ls -lisa'
- .bashrc (erstes Kennenlernen)
Spraxche ändern
export LANG=en_US export LANGUAGE=en_US
export LANG=ru-RU export LANGUAGE=ru-RU