Essential Unix Commands
This page serves as a unix manual to help users get to know unix commands and allow for more efficient research in the command line.
Most of the information on this page comes from Dr. Bill Miller III at A. T. Still University.
Here are some of the most important/frequently used commands. These are the basics to using linux machines and working on the command line.
Command |
Option |
What it Does |
Example |
---|---|---|---|
cd |
Changes the working directory to the home
directory (a folder named your net ID).
|
|
|
|
Changes the working directory to the folder
containing the current working directory.
|
|
|
|
Changes your working directory to the one
you specify.
|
|
|
exit |
Exits the current working network point.
If I am logged into a node on ACME, typing
exit will move my working location tothe head node on ACME.
|
|
|
ssh [cluster name] |
Moves working location to another computer
in the network.
|
|
|
rlogin [node name] |
Moves to a node in a cluster on the network.
|
|
|
pwd |
Returns the current working directory.
|
|
|
ls |
Lists all the folders and files in the
working directory.
|
|
|
cp [file] [location] |
Copies
file1 and makes a duplicate in thesame working directory that is called
location OR makes a copy of
file1 in the differentspecified directory called
location/ . |
cp file.com copy.txt OR
cp file.com pre_run/ |
|
|
Same as the previous, but allows the copying
of folders (including their contents) too.
|
|
|
scp [file] [cluster] |
Copies files to another computer in the network.
The
-r option works for secure copy too. |
|
|
mv [item] [location] |
Moves a file (or folder if using the
-r option) to the specified location. This is
used to rename files as well.
|
mv file.com jobs/ OR
mv file.com file2.com |
|
rm [file] |
Deletes a file.
|
|
|
|
Deletes a folder.
|
|
|
mkdir [folder name] |
Makes a folder.
|
|
|
rmdir [folder name] |
Deletes an EMPTY folder.
|
|
|
less [file name] |
Opens a file for viewing only. Once viewing
the file,``shift+g`` will take you to the bottom
of the document (
g alone will take you to thetop). Typing
?[text] will search the documentfor instances of '[text]' above the current cursor
location.
q quits. |
|
|
vi [file name] |
Opens a file for viewing or editing. Files start in
viewing mode. While in viewing mode, typing
dd will delete the line on which the cursor resides.
To enter insert mode, type
i . Once in insertmode, you can make changes to the text. To exit
insert mode, hit the
esc key. To save and quit,type
:wq then hit enter (while not in insertmode). To quit without saving, type
:q! , thenhit
enter . |
|
|
cat [file name] |
Prints the contents of a file to the Terminal window.
|
|
If you have these commands down, here are a few more (in some more detail) that might be useful as well: