This section gives insight into the most important commands of your Novell Linux Desktop system. Along with the individual commands, parameters are listed and, where appropriate, a typical sample application is introduced. To learn more about the various commands, use the man pages, accessed using man followed by the name of the command (for example, man ls).
In the man pages, move up and down with the PgUp and PgDn keys. Move between the beginning and the end of a document with Home and End. End this viewing mode by pressing Q. Learn more about the man command itself with man man command.
Adjust the settings to your needs. It makes no sense to write ls file(s), if no file named file(s) actually exists. You can usually combine several parameters, for example, by writing ls -la instead of ls -l -a.
HINT:There are many more commands than listed here. For information about other commands, or more detailed information, we recommend the O’Reilly publication Linux in a Nutshell.
This section introduces the most important file commands you will need in your every day life with a Linux system.
|
Command |
Description |
|---|---|
|
ls [option(s)] [file(s)] |
If you run ls without any additional parameters, the program lists the contents of the current directory in short form. -l Detailed list. -a Displays hidden files. |
|
cp [option(s)] source target |
Copies source file to a target file. -i Waits for confirmation, if necessary, before an existing target file is overwritten. -r Copies recursively (includes subdirectories) |
|
mv [option(s)] source target |
Copies source file to target file, then deletes the original source file. -b Creates a backup copy of the source file before moving. -i Waits for confirmation, if necessary, before an existing target file is overwritten. |
|
rm [option(s)] files |
Removes the specified files from the file system. Directories are nor removed by rm unless the -r option is used. -r Deletes any existing subdirectories. -i Waits for confirmation before deleting each file. |
|
ln [option(s)] source target |
Creates an internal link from the source file to the target file. Normally, such a link points directly to the source file on the same file system. However, if ln is executed with the -s option, it creates a symbolic link that only points to the directory in which the source file is located, enabling linking across file systems. -s Creates a symbolic link. |
|
cd [options(s)] [directory] |
Changes the current directory; cd without any parameters changes to the user’s home directory. |
|
mkdir [option(s)] directoryname |
Creates a new directory. |
|
rmdir [option(s)] directoryname |
Deletes the specified directory, if it is already empty. |
|
chown [option(s)] username.group files |
Transfers ownership of a file to the user with the specified username. -R Changes files and directories in all subdirectories. |
|
chgrp [option(s)] groupname files |
Transfers the group ownership of a given file to the group with the specified group name. The file owner can change group ownership only if he is a member of both the current and the new group. |
|
chmod [options] mode files |
Changes the access permissions. The mode parameter has three parts: group, access, and access type. group accepts the following characters:
For access, grant access with + and deny it with -. The access type is controlled by the following options:
As an alternative, a numeric code can be used. The four digits of this code are composed of the sum of the values 4, 2, and 1 (the decimal result of a binary mask). The first digit sets the set user ID (SUID) (4), the set group ID (2), and the sticky (1) flags. The second digit defines the permissions of the owner of the file. The third digit defines the permissions of the group members, and the last digit sets the permissions for all other users. The read permission is set with 4, the write permission with 2, and the permission for executing a file is set with 1. The owner of a file would usually receive a 7 (the sum of all permissions). |
|
gzip [parameters] files |
This program compresses the contents of files using complex mathematical algorithms. Files compressed in this way are given the extension .gz and need to be uncompressed before they can be used. To compress several files or even entire directories, use the tar command. -d Decompresses the packed gzip files so they return to their original size and can be processed normally (like the command gunzip). |
|
tar options archive files |
tar puts one or more files into an archive. Compression is optional. tar is a complex command with a number of options available. The most frequently used options are the following: -f Writes the output to a file and not to the screen as is usually the case. -c Creates a new tar archive. -r Adds files to an existing archive. -t Outputs the contents of an archive. -u Adds files, but only if they are newer than the files already contained in the archive. -x Unpacks files from an archive (extraction). -z Packs the resulting archive with gzip. -j Compresses the resulting archive with bzip2. -v Lists files processed. The archive files created by tar end with .tar. If the tar archive was also compressed using gzip, the ending is .tgz or .tar.gz. If it was compressed using bzip2, the ending is .tar.bz2. Application examples can be found in Archives and Data Compression. |
|
locate pattern(s) |
The locate command can find which directory a specified file is located in. If desired, use to specify filenames. The program is very fast, because it uses a database specifically created for the purpose (rather than searching through the entire file system). This very fact, however, also results in a major drawback: it is unable to find any files created after the latest update of its database. The database can be generated by root with updatedb. |
|
updatedb [options(s)] |
This command performs an update of the database used by locate. To include files in all existing directories, run the program as root. It also makes sense to place it in the background by appending an ampersand (&), so you can immediately continue working on the same command line (updatedb &). |
|
find [option(s)] |
With find, search for a file in a given directory. The first argument specifies the directory to start the search in. The option -name must be followed by a search string, which can also include wildcards. Unlike locate, which uses a database, find scans the actual directory. |
This section introduces some of the most important commands you need in managing your system.
|
Command |
Description |
|---|---|
|
top [options(s)] |
Provides a quick overview of the processes currently running. Press H to access a page that briefly explains the main options to customize the program. |
|
ps [option(s)] [process ID] |
If run without any options, this command displays a table of all your own programs or processes—those you started. The options for this command are not preceded by hyphen. aux Displays a detailed list of all processes, independent of the owner. |
|
kill [option(s)] process ID |
Unfortunately, sometimes a program cannot be terminated in the normal way. In most cases, you should still be able to stop such a runaway program by executing the kill command, specifying the respective process ID (see top and ps). kill sends a TERM signal that instructs the program to shut itself down. If this does not help, the following parameter can be used: -9 Sends a KILL signal instead of a TERM signal. This brings the specified process to an end in almost all cases. |
|
killall [option(s)] processname |
This command is similar to kill, but uses the process name (instead of the process ID) as an argument, killing all processes with that name. |
|
Command |
Description |
|---|---|
|
passwd [option(s)] [username] |
Users can change their own passwords at any time using this command. The administrator root can use the command to change the password of any user on the system. |
|
su [option(s)] [username] |
The su command makes it possible to log in under a different user name from a running session. When using the command without specifying a user name, you will be prompted for the root password. Specify a user name and the corresponding password to use the environment of the respective user. The password is not required from root, as root is authorized to assume the identity of any user. |
|
halt [option(s)] |
To avoid loss of data, you should always use this program to shut down your system. |
|
reboot [option(s)] |
Does the same as halt except the system performs an immediate reboot. |
|
clear |
Cleans up the visible area of the console. It has no options. |