This course teaches the basics of programming and working with text files. It is designed for people with no programming experience, and is practical and interactive.
ls
- List files in current directory/folder/Verzeichnisman
- Manual (documentation) of a command. Also online in Deutsch & English. These are usually referred to as "man pages"--help
- Common command argument to show quick helppwd
- Print working directory (folder)cd
- Change to a new directory. "." (without quotes) represents your current directory, and ".." represents the parent directorymv
- Move or rename a file/Dateicp
- Copy a filemkdir
- Make a new directory (folder)rm
- Remove (delete) a file. Use rmdir
for empty directoriescat
- Concatenate (show) a filemore
- Show a text file one screen at a time. Use the spacebar to go down, q
to quithead
- Show the first few lines of a text filetail
- Show the last few lines of a text filedos2unix
- Convert a Windows-formatted text file to Unix formatunix2dos
- Vice versanano
- Simple text editorantiword
- Convert Word document to plaintext filecatdoc
- Like antiword
pdftk
- Useful tool for working with PDFs. For example, to join two files: pdftk file1.pdf file2.pdf cat output new.pdf
. You can also split, extract specific pages, rotate, encrypt/decrypt, fill-in PDF forms. echo
- Display a message. For example, echo 'hello world'
gzip
- Compress a file (also: zip
, xz
)gunzip
- Uncompress a file (also: unzip
, unxz
)zcat
- Display a compressed file (also: xzcat
)wc
- Count the number of characters, words, and lines of a text file. --max-line-length
is also usefuldiff
- Show differences between two text filessort
- Sort the lines of a text fileshuf
- Shuffle (randomize) the lines of a text fileuniq
- Merge repeated lines in a text file (or with --count
: show number of repeated lines. Useful on sorted input)cut
- Extract a column from a text filepaste
- Merge multiple columns from different text filesgrep
- Search for a given pattern in a text file. Useful arguments: -r
, -i
, -c
, -e
, -v
, -o
, -w
(spells ricevow :-)pcregrep
- Like grep
but more advanced. See below for a handout on pattern matching (regular expressions).tr
- Substitute characters in a text fileperl -p -e
- Advanced substitutions/replacements in a text filewget
- Download a file from the webiconv
- Convert text from one encoding to another (eg. ISO-8859-1 to UTF-8)fortune
- Try it and see!clear
- Clear the screen (but it doesn't clean your monitor :-)history
- See what you've been typing in your shellexit
- Exit command-line shellcommand1 | command2
- Pipe: Make the output of one command as the input to another commandcommand > output.txt
- Redirect the output of a command into a filecommand >> output.txt
- Append the output of a command to the end of a (possibly already existing) filecommand1 && command2
- Only do command2
if command1
is successful (no errors)command1 || command2
- Do command2
regardless of whether command1
is successfulx=42
- Save the value 42 to a variable x
. You can use the variable later as $x
if [...] command fi
- Do command
if the thing in square brackets is truefor x in a b c d; do command; done
- Loop (wiederholt) over list a b c d
, doing command
each time@
at sign - das At-Zeichen / die Klammeraffe#
hash / pound / number sign - die Raute / das Doppelkreuz^
caret - das Einfügezeichen / das Caret-Zeichen&
ampersand / and - das Et-Zeichen / das Und-Zeichen / das Kaufmannsund*
asterisk / star / times - das Sternchen-
dash / hyphen / minus - der Bindestrich|
pipe / vertical bar - der senkrechte Strich/
slash / forward slash - der Schrägstrich\
backslash - der Backslash / der Rückstrich:
colon - der Doppelpunkt / das Kolon;
semicolon - der Strichpunkt / das Semikolon~
tilde - die Tilde_
underscore - der Unterstrich( )
parentheses - Runde Klammern[ ]
square brackets - Eckige Klammern{ }
curly brackets - Geschweifte/geschwungene Klammern< >
less-than sign / greater-than sign - Kleiner-als-Zeichen / Größer-als-Zeichen