UNIX

$\bullet$
Important UNIX commands:

command function
man COMMAND display information about COMMAND
cd PATH change the current directory
ls PATH list files in the directory
cp FILE1 FILE2 copy FILE1 to FILE2
rm FILE delete FILE
mv FILE1 FILE2 rename FILE1 into FILE2
mkdir DIR create a new directory DIR
rmdir DIR remove the (empty) directory DIR
cat FILE display the content of FILE on the screen
more FILE display the content of FILE, stepping through the pages
VAR=VALUE set the value of the variable VAR to VALUE
echo $VAR display the value of variable VAL
set show the values of all variables
$1, .. $9 command line arguments of a shell script
if, for, until, while control the program flow in a shell script
# ignore the rest of this line - it's a comment

$\diamond$
ls -l -t /home/peter

display all files in the directory /home/peter, showing a detailed list (-l), and sort it according to file modification time, beginning with the latest file (-t).

$\bullet$
UNIX distinguishes strictly between lower and capital letters. As a consequence, large.txt and LaRgE.TxT are different files, and typing 'LS' doesn't list the files.

$\bullet$
The command interpreter (the ``shell'') interprets ? and * as wildcards for one letter or an arbitrary number of letters. This mechanism works for all commands, but sometimes in a different way as in DOS.

$\diamond$
Assume the current directory contains the files a.txt, b.txt, a.bak and the directory juhu.bak. The command

mv *.txt *.bak

is expanded to

mv a.txt b.txt a.bak juhu.bak

which moves all three files into the juhu.bak directory - probably not what was intended!

$\bullet$
Like in DOS one can use >, » and < to redirect output or input of a command to a file and | to connect output and input of two commands.

previous    contents     next

Peter Junglas 8.3.2000