
Common UNIX Commands
Introduction
The following list and brief description of several UNIX commands are intended to give a new user a good starting point for managing their UNIX account.
Most UNIX commands have a large number of options to allow different functionality for the same command. To see the various options for a particular command, type "man command_name".
|
Help Command |
Description |
Example |
|
man (stands for "manual") |
Returns help on a given command. For help on how to use help type: man man |
man ls |
File Commands
|
Command |
Description |
Example |
|
more (display text in a file) |
Returns the contents of a given file. (Space bar scrolls down one page; the "b" key scrolls up one page; the "q" key exits.) |
more .cshrc |
|
less (similar to "more") |
Returns the contents of a file. (Space bar scrolls down one page; the "p" key scrolls up one page; the "q" key exits.) |
less .cshrc |
|
grep pattern filename (stands for "Global Regular Expression Print") |
Returns lines inside the file filename which match the specified pattern. |
grep ls .cshrc |
|
rm ("remove") |
Permanently delete a file. |
rm filename |
|
cp ("copy") |
Copy a file. |
cp filename1 filename2 |
|
mv ("move") |
Move or rename a file. |
mv filename1 directory/ OR mv filename1 filename2 |
|
lp ("line printer") |
Sends a specified file line printer for pickup in dispatch located in LC-4. |
lp filename |
Directory Commands
|
Command |
Description |
Example |
|
ls ( "list") |
Returns a list of file names in the current directory. |
ls |
|
dir ( "directory") |
Returns a more detailed list of the files in the current directory. |
dir |
|
pwd ("print working directory") |
Gives the full pathname of the current directory. |
pwd |
|
quota –v |
Returns the amount of disk space you have available. 1 block is approximately equal to 1 KB. |
quota –v |
|
mkdir ( "make directory") |
Creates a directory called temp |
mkdir temp |
|
cd ( "change directory") |
Changes your current directory. |
cd temp |
|
cd ~ OR cd |
Returns you to your home directory. |
|
|
cd .. |
Moves you up one directory level. |
cd .. |
|
rmdir ("remove directory") |
Deletes a directory. (Note: this will only work if the directory is already empty. To delete a non-empty directory, you must first remove [rm] all the files it contains.) |
rmdir temp |
Process Commands
Processes are user programs controlled by the UNIX operating system (the kernel). Each process is assigned a unique process ID number (PID) to enable the kernel to keep track of them. For example, starting the "pico" text editor would cause a process to start with the name "pico" and assign the process a unique PID.
|
Command |
Description |
Example |
|
ps ("process status") |
Displays a list of the user’s current processes. Typing ps as soon as you log in will show you what shell you are running (default is "csh"). |
ps |
|
kill –9 |
Terminates the command or process with specified Process ID #. (Note: running kill -9 against the PID number associated with your shell will log you out.) |
kill -9 26023 |
|
Ctrl-z (suspend process) |
Will cause most processes to become suspended (placing them in the background). |
|
|
fg ( "foreground") |
Places the most recently suspended process in the foreground. |
fg |
|
bg ("background") |
Places a numbered job in the background. |
bg 19161 |
|
jobs |
Lists the current processes and assigns them a job number. (Typing %jobnumber will place that process in the foreground.) |
jobs |
|
& (typed after a command) |
Starts a command in the background. (Type ps to see the background process; type fg to bring it back to the foreground.) |
lynx & |
|
Ctrl-c (abort) |
Mostly used to break out of a program when no other options exist. For example, when a program (process) is looping out of control. |
For More Information
For more about directory structure on UNIX, see the Quick Start entitled, "Directory Information on UNIX."
Information Technology Services Helpdesk, LC-27
(518) 442-3700
Submit a Help Desk Request at:
http://www.albany.edu/its/help/help-request.html