78
The table below explains commonly used UNIX commands:
Command | Function | Example |
---|---|---|
cd dirname | Changes current (working) directory to the specified directory. If cd is entered without a specified directory to move to, you are taken to your home directory. | cd work |
ls -a/-l/-al/-p/-R/-t/-x | Lists files in working directory. Typing ls by itself lists the file
names alone.
|
ls -a -l |
cp -i/-r oldfile newfile | This command makes a copy of a file. You must specify the name of
the file to be copied and the name of the new file to be created.
|
cp -i webpage.html webpage2.html |
rm -i/-r filename | This command erases the specified file.
|
rm -i work |
rmdir -r directoryname | This command is for erasing directories.
|
rmdir unix |
mv -i filename1 filename2 | This renames a file.
|
mv 1996work 1997work |
mv -i filename directoryname/filename | This command moves a file to another directory. The flag serves the same purpose as in the other mv command. | mv index.html webwork/index.html |
Tip:
Two periods (..) represents the above directory. For example, if you are in a directory called work which is under your home directory, you can enter cd .. to move to your home directory. Also, if in your work directory, you have a file called "index.html," you can enter mv index.html ../web to move the file to the web directory, which is on the same level as the work directory in your home directory.
This tip illustrates the importance of drawing a mental map of your UNIX work area. Remember that when a directory contains a subdirectory, the directory is "above" the subdirectory, which is "below" the first directory. For example:
DirectoryA Subdirectory1 Subdirectory2
![]() |
![]() |
This site was created especially for students of the UNC School of Journalism's JOMC 050 Class, and anyone else who may be interested. For more information, please contactdaikat@email.unc.edu |