Datasheet

19
Working with the Shell
19.1.3 Bash Functions
There are two important functions of the shell that can make your work a lot eas-
ier:
History To repeat a command that has been entered before, press
until the
previous command appears at the prompt. Move forward through the list
of previously entered commands by pressing
. To edit the command line,
just move the cursor to the desired position using the arrow keys and start
typing. Use
Ctrl -
R to search in the history.
Expansion Expand a filename to its full length after typing its first letters until
it can be uniquely identified. To do so, type the first letters then hit
Tab .
If there are several filenames starting with the same letters, obtain a list of
them by hitting
Tab twice.
First Example: Managing Files
Now that you know what a command looks like, which directories exist in SUSE
LINUX, and how to speed up things when using Bash, put this knowledge into
practice with a small exercise.
1. Open a console from the KDE desktop by clicking the shell icon.
2. Enter the ls command to see the contents of your home directory.
3. Use the command mkdir (which stands for make directory) to create a new
subdirectory called test by entering mkdir test.
4. Now launch the Kate editor by pressing
Alt -
F2 and entering kate in the
input field. Type a few letters in the editor then save the file as Testfile
in your home directory. Linux distinguishes between uppercase and lower-
case. For this example, use an uppercase T.
5. View the contents of your home directory again. Instead of typing ls again,
just press
twice and the ls command should reappear at the prompt. To
execute the command, hit
Enter . The newly created directory test should
appear in blue letters and Testfile in black. This is how directories and
files can be distinguished in a console.
249SUSE LINUX