Unix Commands

Command Effect
pwd Displays present working directory, also called the current directory
ls Lists the names of the files in the current directory
dir Lists in detail the files in the current directory
ls  -l Lists the files and details about them
ls  -a Lists all the files in the directory including hidden files
ls  -al Lists all the files in the directory and details about them
ls  -al  |more Lists all files and details one page at a time
man  command Shows the manual page for the unix command, for example man ls hows the manual page for ls.
ctrl-c Kills the man page, or any other unix program in process
cd  .. Changes directories up one directory
cd Changes back to your home directory (root of your user account)
cd  ~/ Changes back to your home directory (root of your user account)
cd  / Changes to the root directory of the system
mkdir practice Makes a directory named practice in the current directory
cd practice Changes directory to practice
chmod ### file Change mode (permissions) to ### on file. See the Permissions tutorial for more information.
cp practice.html practice2.html Copies practice.html and renames it practice2.html
mv practice.html practice3.html Renames practice.html by moving it to a file named practice3.html (assuming practice3.html does not already exist). If practice3.html were a directory, the command would move the file practice.html into the practice3.html directory.
rm practice.html Removes the file practice.html
rm* Removes all of the files in the current directory (be careful!!!)
rmdir practice Removes the directory named practice (directory must be empty)
pico practice.html Opens the pico text editor to create (or edit) a file named practice.html
ctrl-g Get help for pico (while editing a file)
ctrl-x Exit Pico
y Agree to save the file
Enter To accept the filename practice.html

When using cp, cd, mv, chmod (or most other UNIX commands) UNIX assumes that the files and/or directories you list are in the current (present working) directory. If not you need to either change (via cd) into the directory the file is or tell UNIX where it should look.

For instance, if you are in your home directory and want to copy a file, blahfile, that is a subdirectory called blahdir, to your home directory you could type cp blahdir/blahfile . which tells UNIX to look for blahfile inside of blahdir and copy it to . which is the current directory. ~ and .. can also be used in this style (separate directory and filenames with a /)


Please send comments to CGS3063 STAFF