...
A directory is a special type of file. Linux uses a directory to hold information about other files, the equivalent of a folder in Windows. You can think of a directory as a container that holds other files or directories. The working directory is the directory where you are currently working. When you first login to a Linux system, your working directory will be your home directory. To view which directory you are currently in, issue the pwd command; this displays the present working directory.
$ pwd /home/jolocluster/tufts/a/u/auser01
To list the files that are contained in your present working directory, use the ls command. $PWD is an environment variable that holds the path to the present working directory.
$ ls /home/jolo$PWD myfile myfile2 otherfile
...
If you ever get lost while moving around the directory structure you can use one of three methods to get back to your default home directory. Issue the cd command with no arguments, the default action is to return to your home directory. Use the tilde ~ user name notation or the$HOME environment variable. For example, if my username is jolo, to return to my home directory I could do one of the following:
$ cd $ cd ~jolo~auser01 $ cd $HOME
$HOME is an environment variable which contains the path to your home directory. There are several environment variables which are defined for you; to view all of them issue the env command.
...
mv moves a file to another location. For example, to move a file from /home/jolo/netprog to /home/jolo/unixnetprog in the home directory to the unix directory in the home directory:
$ mv /home/jolo~/netprog/myFile /home/jolo~/unix
This can also be used to rename a file in the same directory. For example, to rename myFile to myFile.old:
...
cp copies files or directories. To copy a file from /home/jolo/unix to /home/jolo/netprog:
$ cp ~/home/jolounix/netprog/myOtherFile ~/home/jolo/unixnetprog
rm removes files:
$ rm /home/jolo~/netprog/myOtherFile
When discussing files and the file system, it is important to note the difference between a "relative path" and the "absolute path". The absolute or full path is the entire directory structure pointing to a file. A relative path is the path from where you are now (your present working directory) to the file in question. An easy way to know if a path is absolute is to check if it contains the "/" character at the beginning of the path. For example, assume there is a file in my home directory called foo. Since my home directory is /home/jolo, I could list the file using "ls" with the absolute path:
...