UNIX Command Cheat Sheet

When learning a new operating system things can be quite daunting, for those people who have come to UNIX from a Microsoft background you will find quite a few similarities between the way UNIX and DOS behave, in reality DOS is very similar to UNIX as it is loosely based on it. If you are interested UNIX stands for UNiplexed Information and Computing, this catchy acronym and indeed the Operating system were dreamt up in 1969 by a team at Bell Labs consisting of Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna, more information here.

Below you will find a list of UNIX commands with their DOS equivalents, this page will also explain how Shell Commands can interact making them even more powerful and useful.

Action
DOS
UNIX
change directory
cd
cd
change file protection
attrib
chmod
compare files
comp
diff
copy file
copy
cp
delete file
del
rm
delete directory
rd
rmdir
directory list
dir
ls
edit a file
edit
vi/pico
environment
set
printenv
find string in file
find
grep
help
help
man
make directory
md
mkdir
move file
move
mv
rename file
ren
mv
show date and time
date, time
date
show disk space
chkdsk
df
show file
type
cat
show file by screens
type filename | more
more
sort data
sort
sort

 


 

Help on any UNIX command.

man {command}
Type man ls to read the manual for the ls command.
man {command} > {filename}
Redirect help to a file to download.
whatis {command}
Give short description of command.
apropos {keyword}
Search for all UNIX commands that match keyword, eg apropos file.


List a directory

ls {path}
It's ok to combine attributes, eg ls -laF gets a long listing of all files with types.
ls {path_1} {path_2}
List both {path_1} and {path_2}.
ls -l {path}
Long listing, with date, size and permisions.
ls -a {path}
Show all files, including important .dot files that don't otherwise show.
ls -F {path}
Show type of each file. "/" = directory, "*" = executable.
ls -R {path}
Recursive listing, with all subdirs.
ls {path} > {filename}
Redirect directory to a file.
ls {path} | more
Show listing one screen at a time.
dir {path}
Useful alias for DOS people, or use with ncftp.

 


 

Change to directory

cd {dirname}
There must be a space between.
cd ~
Go back to home directory, useful if you're lost.
cd ..
Go back one directory.
cdup
Useful alias, like "cd ..", or use with ncftp.

 


 

Make a new directory

mkdir {dir name}
e.g. mkdir test

 


 

Remove a directory

rmdir {dirname}
Only works if {dirname} is empty.
rm -r {dirname}
Remove all files and subdirs. Careful!

 


 

Print working directory

pwd
Show where you are as full path. Useful if you're lost or exploring.

 


 

Copy a file or directory

cp {file1} {file2}
cp -r {dir1} {dir2}
Recursive, copy directory and all subdirs.
cat {newfile} >> {oldfile}
Append newfile to end of oldfile.

 


 

Move (or rename) a file

mv {oldfile} {newfile}
Moving a file and renaming it are the same thing.
mv {oldname} {newname}

 


 

Delete a file

rm {filespec}
? and * wildcards work like DOS should. "?" is any character; "*" is any string of characters.
ls {filespec}
Good strategy: first list a group to make sure it's what's you think...
rm {filespec}
Good strategy: first list a group to make sure it's what's you think...

 


 

View a text file

more {filename}
View file one screen at a time.
less {filename}
Like more, with extra features.
cat {filename}
View file, but it scrolls.
cat {filename} | more
View file one screen at a time.
page {filename}
Very handy with ncftp.
vi {filename}
Use text editor and don't save.

 

Customer Feedback

A.D.I. LTD

Here at A.D.I. We approached Nettop for a bespoke I.T. system to enhance the productivity and efficiency of our business, since day one Nettop have exceeded our expectations of how customer service should be, they constantly provide excellent advice and value for money.

SVSNI LTD

SVSNI provide cutting edge surveillance systems to companies world wide, this work requires a fast and reliable IT infrastructure. Nettop were able to design and implement such a system whilst working to our timescales and within our budgetary requirements.

Leading Edge

At Leading edge when we look for a business partner we tend to look for three things; are they competent, do they seem to care about our business and are they a cultural match (in other words do we get on with them on a personal level) In the four years we have been working with Nettop we have found them to be excellent in all three areas. I have no hesitation in recommending them.

Hames Partnership

In our business IT is a very large factor to consider and therefore we require a competent and reliable service available to us at all times. Nettop full fill this requirement and more, with their vast knowledge and friendly manner. We will continue to recommend them to our clients and colleagues.

Comer Industries

Comer industries is a company which is constantly aiming for innovation and customer satisfaction. When we select Partners we are generally tempted in looking for similar peculiarities, but it is not always easy and immediate. With Nettop we have found it during the first meeting, together with a high level of professionalism and competence. It has not been difficult starting a business relationship which it is going to be durable and fruitful.

Our Customers