1999 Dec 20
You can avoid learning many of UNIX file and directory commands by using a file manager such as xfm.
In UNIX, almost all data is stored in files. C++ programs, executable programs such as netscape and emacs, and even directories are files. Here are some operations you can perform on files:
You can also duplicate a file using the cp copy command. For example, to create a new file called bar whose contents is exactly the same as the file foo, use the command
To obtain more information about the file, use the -l option to learn about the file's permissions, owner, group, size, date, and name.
Removed files cannot usually be recreated. If you remove files and suddenly discover you did not mean to do so, stop all your work and run around until you find a UNIX guru who can help you recover what remains of your files before more of them permanently disappear.
A directory is a collection of files and possibly other directories.
Here are some operations you can perform on directories:
You can specify which directory to show: ls directory-name.
Note only a directory with no files can be destroyed.
Since a directory can be stored inside another directory, there is a tree of directories and files. For example, the file creating this document may be located at /users/joldham/CS1320/files.ltx. The directory / contains the directory users, which contains the directory joldham, which contains the directory CS1320, which contains the file files.ltx.
One can move files and directories around the directory hierarchy using the mv command. For example, mv file directory moves the specified file into the specified directory.
So that we do not have to specify this lengthy string to use a file, the shell remembers the current directory. For example, when I start a shell, the current directory is /users/joldham. This is also my home directory, where all my files are placed unless I take explicit action to move them elsewhere. ~ is a nickname for my current directory.
Operations you can perform on the current directory include:
The dirs, pushd, and popd commands permit one to to maintain a stack of directories. The current directory is the one on top of the stack, but it is easy to add, remove, and rearrange the directories. Read the documentation for these commands if you are interested.
Many of these commands can take multiple arguments or arguments with regular expressions. Read the GNU WWW pages or the info pages for more information.
For more information, read the following: