In the KDE taskbar, there is an icon depicting a monitor with a seashell. When you click this icon, a console window opens where you can enter commands. The console normally runs Bash (Bourne again shell), a program developed as part of the GNU project. It is, by far, the most widely used derivative of the Bourne shell (sh). The prompt on the shell's first line usually consists of the username, hostname, and current path, but it can be customized. When the cursor is behind this prompt, you can send commands directly to your computer system.
A command consists of several elements. The first element is always the actual command, followed by parameters or options. Commands are executed when you press Enter. Before doing so, you can easily edit the command line, add options, or correct typing errors. One of the most frequently used commands is ls, which can be used with or without arguments. Entering the plain ls command in the console shows the contents of the current directory.
Options are prefixed with a hyphen. The command ls -l, for instance, shows the contents of the same directory in full detail. Next to each filename, you can see the date when the file was created, the file size in bytes, and further details, which will be discussed later. One very important option that exists for many commands is the --help option. Entering ls --help displays all the options for the ls command.
You can also use the ls command to view the contents of other directories. To do so, the directory must be specified as a parameter. For example, to see the contents of Desktop, you would enter ls -l Desktop.
To use the shell efficiently, it is really useful to have some knowledge about the file and directory structures of a Linux system. You can think of directories as electronic folders in which files, programs, and subdirectories are stored. The top level directory in the hierarchy is the root directory, referred to as /. This is the place from which all other directories can be accessed.
The /home directory contains directories where individual users can store their personal files. The following figure shows the standard directory tree in Linux, with the home directories of the example users xyz, linux, and tux.
Figure G-1 Excerpt from a Standard Directory Tree

The directory tree of a Linux system has a functional structure that follows the Filesystem Hierarchy Standard. The following list provides a brief description of the standard directories in Linux.
Table G-1 Standard Linux Directories
There are two important functions of the shell that can make your work a lot easier:
Now that you know what a command looks like, which directories exist in NovellĀ® Linux Desktop, and how to speed up things when using Bash, put this knowledge into practice with a small exercise.
When working with files or directories, it is important specify the correct path. However, you do not need to enter the entire (absolute) path from the root directory to the respective file. Rather, you can start from the current directory. Address your home directory directly with a tilde (~). Accordingly, there are two ways to list the file Testfile in the directory test: by specifying the relative path with ls test/* or by specifying the absolute path with ls ~/test/*.
To list the contents of home directories of other users, enter ls ~username. In the above-mentioned directory tree, one of the sample users is tux. In this case, ls ~tux would list the contents of the home directory of tux.
Refer to the current directory with a dot (.). The next higher level in the tree is represented by two dots (..). By entering ls .., you can see the contents of the parent directory of the current directory. The command ls ../.. shows the contents of the directory two levels higher in the hierarchy.
Try this exercise to practice moving around in the directories of your Novell Linux Desktop system.
Another convenience offered by the shell is four types of wildcards:
Table G-2 Shell Wildcards
Assuming that your test directory contains the files Testfile, Testfile1, Testfile2, and datafile, the command ls Testfile? lists the files Testfile1 and Testfile2. Entering ls Test* will add Testfile. The command ls *fil* shows all the sample files. Finally, you can use the set wildcard to address all sample files whose last character is a number (for example, ls Testfile[1-9]).
Of the four types of wildcards, the most inclusive one is the asterisk (*). It can be used to copy all files contained in one directory to another one or to delete all files with one command. The rm *fil* command, for instance, would delete all files in the current directory whose name includes the string fil.
Linux includes two small programs for viewing text files directly in the shell. Rather than starting an editor to read a file like Readme.txt, simply enter the command less Readme.txt to display the text in the console window. Use the Space key to scroll down one page. Use Page Up and Page Down to move forward or backward in the text. To exit the less program, press Q.
Instead of less, you can also use the older program, more. However, it is less convenient because it does not allow you to scroll backwards.
The program less got its name from the precept that less
is more
and it can also be used to view the output of commands
in a convenient way. To see how this works, see the next section, Pipes.
Normally, the standard output in the shell is your screen or the console window, and the standard input is the keyboard. To forward the output of a command to an application such as less, use a pipeline (|).
To view the files in the test directory, you would enter the ls test | less command. The contents of the test directory will be displayed with less. This makes sense only if the normal output with ls would be too lengthy. For instance, if you view the contents of the dev directory with ls /dev, you will only see a small portion in the window. But you can view the entire list with ls /dev | less.
It is also possible to save the output of commands to a file. For example, ls test > Content generates a new file called Content that contains a list of the files and directories in test. View the file using the less Content command.
You can also use a file as the input for a command. For example, sort the text lines in Testfile with sort < Testfile. The output of the command sort is sent to the screen. The text is sorted by the first letters of the individual lines.
If you need a new file containing the sorted list, pipe the output of the command sort to a file. To test this, create an unsorted name list in an editor and save it under list in the test directory. Then change to test and enter the sort < unsortedlist > sortedlist command. Finally, view the sorted list with the less command.
Just like the standard output, the standard error output is sent to the console as well. However, to redirect the standard error output to a file named errors, append 2> errors to the corresponding command. Both standard output and standard error are saved to one file named alloutput if you append >& alloutput. Finally, to append the output of a command to an already existing file, the command must be followed by >> instead of a single >.
Now that you have already created a number of files and directories, consider the subject of archives and data compression. Suppose you want to have the entire test directory packed into one file that you can save on a floppy disk as a backup copy or send by e-mail. To do so, use the tar command (for tape archiver). With tar --help, you can view all the options for the tar command. The most important of these options are explained here:
Table G-3 tar Command Options
To pack the test directory with all its files and subdirectories into an archive named testarchive.tar, use the -c and -f options. For the testing purposes of this example, also add -v to follow the progress of the archiving, although this option is not mandatory. After using cd to change to your home directory where the test directory is located, enter tar -cvf testarchive.tar test. After that, view the contents of the archive file with tar -tf testarchive.tar. The test directory with all its files and directories has remained unchanged on your hard disk. To unpack the archive, you can enter tar -xvf testarchive.tar, but do not try this yet.
For file compression, the obvious choice on Linux is the popular gzip program. Just enter gzip testarchive.tar. With ls, you can now see that the testarchive.tar file is no longer there and that the testarchive.tar.gz file has been created instead. This file is much smaller and, therefore, much better suited for transfer via e-mail or storage on a floppy.
Now, unpack this file in the test2 directory created earlier. To do so, enter cp testarchive.tar.gz test2 to copy the file to that directory. Change to the directory using cd test2. A compressed archive with the .tar.gz extension can be unzipped with the gunzip command. Enter gunzip testarchive.tar.gz, which results in the testarchive.tar file, which then needs to be extracted (or untarred) with tar -xvf testarchive.tar. You can also unzip and extract a compressed archive in one step by adding the -z option. The complete command would be tar -xzvf testarchive.tar.gz. With ls, you can see that a new test directory has been created with the same contents as your test directory in your home directory.
mtools is a set of commands for working with MS-DOS file systems. The commands included in mtools allow you to address the first floppy drive as a:, just like under MS-DOS, and the commands are like MS-DOS commands except they are prefixed with m.
Table G-4 mtools Commands
After this crash course, you should be familiar with the basics of the Linux shell or command line. You might want to clean up your home directory by deleting the various test files and directories using the rm and rmdir commands. See Important Linux Commands for a list of the most important commands and a brief description of their functions.