Linux commands and file management

Getting informations about text line commands - man

Using the command man [command] (e.g. man cd or man du) the manpage of the command will be shown.
There you will find explanations about that command and its options .This is a very useful command. Use this
command whenever you want to know what a command does, how its syntax is and what options are available
for that command.

Changing the directory - pwd, cd

Command pwd shows you the path of the current directory, the so called working directory. You may change the
working directory using cd [directory path]. You may enter the path relative or absolute (relative to the the
current working directory, absolut paths starts in the root directory (symbolized by a / in the beginning).
With cd .. you move up one directory level. Your own home direectory can be reached by the command cd.

Overview - ls

The command ls will show you the content of the working directory. ls -l (alias ll) is more detailed. Using
ls -a (alias la) will additionally show files and directories beginning with a dot (these are usually configuration
files).
In every directory exists the directories . und .., there . stands for the current directory and .. for the
superordinate directory (e.g. ls .. gives you the directory content of the superordinate directory one level
above).

Access permissions - chmod

acronym files directories atribute value
r read list directory's content 4
w write write to directory 2
x excecute recurse a directory tree 1


The access permissions have to be set for the user groups owner, group and others (ugo).

The attribute values will be summed up for each user group separately and concatenated to a three digit number.
Changes of access permissions then can be specified by chmod [rights] [file], e.g. chmod 751 test .
The command ll or ls -l will show you the currently set permissions for the working directory, e.g. in our
example you could see:
-rwxr-x--x 1 user gruppe 0 18. Okt 16:00 test
In this example the user has the permission to read, write and execute (rwx); the group is allowed to read and
execute (r-x); others are only allowed to execute (--x). Typical values for directories and programs are 755, 711
and 700, for files 644 or 600.
The option -R (= recursive) will change the directories permissions and additionally the permissions of all
included objects like subdirectories and files. Example: chmod -R 711 testdirectory

Display files and directories - cat, kate, gedit, vi, emacs, mcedit, mkdir

The command cat [filename] will print the content of a file (on the standard output).

To create, edit and save files you may use an editor. You will find the editor kate browsing the K-Menu -->
Applications --> Utilities --> Advanced Text Editor (Kate). Or you just type kate as a command line to a text
console. The same applies for the editor gedit.
The editors vi, emacs und mcedit are invoked by typing the name to a command line of a shell.

Create, copy, move, remove files and directories - cp, mv, rm, mkdir

Use the command mkdir [name of new directory] to create a new directory.
Command cp [file1] [file2] copies a file.
cp -r [directory1] [directory2] copies a directory including its content (files and subdirectories).
You may use the command mv [file1] [file2] to move or rename a file or directory.
The command rm -r [file] deletes (removes) a file. To delete an empty directory, you may use
rmdir [directory], rm -r [directory] deletes a directory and its content, including all subdirectories
recursively. If the directory you want to remove contains many files und you don't want to get asked for each
file should be deleted or not you should use rm -rf [directory]. The -f option forces the command to
delete content without asking! Please note! All these deletion commands are irreversible.

If you move files to the recycle bin, don't forget to empty sometimes. The content of the recycle bin uses
disk space as well.

Finding the full absolute path of shell commands - which

The command which [command] will show you the position of a shell command in the directory structure.
Example input: which java
Example output: /usr/bin/java

Some usefull links to other parts of the FAQ

Changing your password - yppasswd
Disk quota - quota, du
Removable media - mount, mtools
Printout - lpq, lpr, lpquota, psnup, pdftops