5.4 Examples

Let's say we are currently in /home/noob. The following sequence describes and illustrates the use of certain commands and the use of various forms of paths.

ls *.txt lists all the files that ends with the extension .txt in the current working directory, /home/noob.

mkdir txt creates a new directory below the current working directory. This means the full path to the newly created directory is /home/noob/txt. Note that mkdir does not change the working directory!

cd txt changes the current directory to the subdirectory txt.

pwd confirms that the current directory is now /home/noob/txt.

mv ../*.txt . tells the operating system to move all the files with the extension .txt in the parent directory (..) into the current working directory (.).

ls /home/noob/*.txt uses the absolute path to check and make sure all the files with .txt extension are, indeed, deleted from the home directory of noob.



Copyright © 2006-07-05 by Tak Auyeung