Datasheet

6. Move Testfile into the subdirectory test with the command mv. To
speed this up, use the expansion function: just enter mv T and press
Tab .
As long as there is no other file beginning with this letter in the directory,
the shell expands the file name and adds the string estfile. Otherwise, add
a letter or two yourself and test
Tab each time to see whether the shell can
now expand the name. Finally, type a space then test after the expanded
file name and press
Enter to execute the command.
7. At this point, Testfile should no longer be in the directory. Check this by
entering ls again.
8. To see whether the file has been successfully moved, change into the direc-
tory test with the command cd test. Now enter ls again. You should
see Testfile in the listing. Change back to your home directory at any
point by entering only cd.
9. To make a copy of a file, use cp. For instance, enter cp Testfile
Testbackup to copy Testfile to Testbackup. Once again, the com-
mand ls can be used to see whether both files are in the directory.
21.1.4 Specifying Paths
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 direc-
tory to the respective file. Rather, you can start from the current directory. Ad-
dress your home directory directly with ~. Accordingly, there are two ways to list
the file Testfile in the directory test: by entering 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 repre-
sented by two dots. By entering ls .., see the contents of the parent directory of
the current directory. The command ls ../.. shows the contents of the direc-
tory two levels higher in the hierarchy.
Second Example: Working with Paths
Here is another example to illustrate how to move around in the directories of
your SUSE LINUX system.
260 21.1. Introduction to Bash