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 Truman State 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.

Essential Linux Commands

Command

Option

What it Does

Example

cd

Changes the working directory to the home
directory (a folder named your net ID).

cd

..

Changes the working directory to the folder
containing the current working directory.

cd ..

[directory]

Changes your working directory to the one
you specify.

cd my_project

exit

Exits the current working network point.
If I am logged into a node on ACME, typing
exit will move my working location to
the head node on ACME.

exit

ssh [cluster name]

Moves working location to another computer
in the network.

ssh acme

rlogin [node name]

Moves to a node in a cluster on the network.

rlogin node01

pwd

Returns the current working directory.

pwd

ls

Lists all the folders and files in the
working directory.

ls

cp [file] [location]

Copies file1 and makes a duplicate in the
same working directory that is called location
OR makes a copy of file1 in the different
specified directory called location/.
cp file.com copy.txt
OR
cp file.com pre_run/

-r

Same as the previous, but allows the copying
of folders (including their contents) too.

cp -r folder1 folder2/

scp [file] [cluster]

Copies files to another computer in the network.
The -r option works for secure copy too.

scp file.com acme

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.

rm file.com

-r

Deletes a folder.

rm -r my_jobs/

mkdir [folder name]

Makes a folder.

mkir my_jobs/

rmdir [folder name]

Deletes an EMPTY folder.

rmdir my_jobs/

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 the
top). Typing ?[text] will search the document
for instances of '[text]' above the current cursor
location. q quits.

less file.com

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 insert
mode, 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 insert
mode). To quit without saving, type :q!, then
hit enter.

vi file.com

cat [file name]

Prints the contents of a file to the Terminal window.

cat file.com