You are on page 1of 14

UNIX Command Summary

There are MANY commands available for you in a UNIX shell account. A list of
them follows (in no particular order). Remember, you can always read the
manpage on each command for more information.

ls ................. show directory, in alphabetical


order
logout ............. logs off system
mkdir .............. make a directory
rmdir .............. remove directory (rm -r to delete
folders with files)
rm ................. remove files
cd ................. change current directory
man (command) ...... shows help on a specific command
talk (user) ........ pages user for chat - (user) is a
email address
write (user) ....... write a user on the local system
(control-c to end)

pico (filename) .... easy to use text editor to edit


files
pine ............... easy to use mailer
more (file) ........ views a file, pausing every
screenful

sz ................. send a file (to you) using zmodem


rz ................. recieve a file (to the unix
system) using zmodem

telnet (host) ...... connect to another Internet site


ftp (host) ......... connects to a FTP site
archie (filename) .. search the Archie database for a
file on a FTP site
irc ................ connect to Internet Relay Chat
lynx ............... a textual World Wide Web browser
gopher ............. a Gopher database browser
tin, trn ........... read Usenet newsgroups

passwd ............. change your password


chfn ............... change your "Real Name" as seen on
finger
chsh ............... change the shell you log into

grep ............... search for a string in a file


tail ............... show the last few lines of a file
who ................ shows who is logged into the local
system
w .................. shows who is logged on and what
they're doing
finger (emailaddr).. shows more information about a
user
df ................. shows disk space available on the
system
du ................. shows how much disk space is being
used up by folders
chmod .............. changes permissions on a file
bc ................. a simple calculator

make ............... compiles source code


gcc (file.c) ....... compiles C source into a file
named 'a.out'

gzip ............... best compression for UNIX files


zip ................ zip for IBM files
tar ................ combines multiple files into one
or vice-versa
lharc, lzh, lha .... un-arc'ers, may not be on your
system

dos2unix (file) (new) - strips CR's out of dos text


files
unix2dos (file) (new) - adds CR's to unix text files

Basic UNIX commands

Note: not all of these are actually part of UNIX itself, and you may not find them
on all UNIX machines. But they can all be used on turing in essentially the same
way, by typing the command and hitting return. Note that some of these commands
are different on non-Solaris machines - see SunOS differences.
If you've made a typo, the easiest thing to do is hit CTRL-u to cancel the whole
line. But you can also edit the command line (see the guide to More UNIX).
UNIX is case-sensitive.

Files

 ls --- lists your files


ls -l --- lists your files in 'long format', which contains lots of useful
information, e.g. the exact size of the file, who owns the file and who has the
right to look at it, and when it was last modified.
ls -a --- lists all files, including the ones whose filenames begin in a dot,
which you do not always want to see.
There are many more options, for example to list files by size, by date,
recursively etc.
 more filename --- shows the first part of a file, just as much as will fit on
one screen. Just hit the space bar to see more or q to quit. You can use
/pattern to search for a pattern.
 emacs filename --- is an editor that lets you create and edit a file. See the
emacs page.
 mv filename1 filename2 --- moves a file (i.e. gives it a different name, or
moves it into a different directory (see below)
 cp filename1 filename2 --- copies a file
 rm filename --- removes a file. It is wise to use the option rm -i, which will
ask you for confirmation before actually deleting anything. You can make
this your default by making an alias in your .cshrc file.
 diff filename1 filename2 --- compares files, and shows where they differ
 wc filename --- tells you how many lines, words, and characters there are in
a file
 chmod options filename --- lets you change the read, write, and execute
permissions on your files. The default is that only you can look at them and
change them, but you may sometimes want to change these permissions. For
example, chmod o+r filename will make the file readable for everyone, and
chmod o-r filename will make it unreadable for others again. Note that for
someone to be able to actually look at the file the directories it is in need to
be at least executable. See help protection for more details.
 File Compression
o gzip filename --- compresses files, so that they take up much less
space. Usually text files compress to about half their original size, but
it depends very much on the size of the file and the nature of the
contents. There are other tools for this purpose, too (e.g. compress),
but gzip usually gives the highest compression rate. Gzip produces
files with the ending '.gz' appended to the original filename.
o gunzip filename --- uncompresses files compressed by gzip.
o gzcat filename --- lets you look at a gzipped file without actually
having to gunzip it (same as gunzip -c). You can even print it directly,
using gzcat filename | lpr .

Directories

Directories, like folders on a Macintosh, are used to group files together in a


hierarchical structure.

 mkdir dirname --- make a new directory


 cd dirname --- change directory. You basically 'go' to another directory, and
you will see the files in that directory when you do 'ls'. You always start out
in your 'home directory', and you can get back there by typing 'cd' without
arguments. 'cd ..' will get you one level up from your current position. You
don't have to walk along step by step - you can make big leaps or avoid
walking around by specifying pathnames.
 pwd --- tells you where you currently are.

MS-DOS and command line overview

Below is a listing of each of the MS-DOS commands currently listed on


Computer Hope and a brief explanation of what each of the commands
do. The below commands are all MS-DOS commands, which means not all
the below commands will work in your version of MS-DOS and/or Windows
command line. Clicking on the command will open the help page for that
command with full details about it.

Command Description Type

Defines functions that change display graphics,


ansi.sys File
control cursor movement, and reassign keys.
Causes MS-DOS to look in other directories when
append External
editing a file or running a command.

Displays, adds, and removes arp information from


arp External
network devices.

assign Assign a drive letter to an alternate letter. External

assoc View the file associations. Internal

Schedule a time to execute commands or


at External
programs.

Lists connections and addresses seen by Windows


atmadm Internal
ATM call manager.

attrib Display and change file attributes. External

Recovery console command that executes a series


batch Recovery
of commands in a file.

Recovery console command that allows a user to


bootcfg Recovery
view, modify, and rebuild the boot.ini

break Enable / disable CTRL + C feature. Internal

cacls View and modify file ACL's. External

call Calls a batch file from another batch file. Internal

cd Changes directories. Internal

Supplement the International keyboard and


chcp External
character set information.

chdir Changes directories. Internal


chdsk Check the hard disk drive running FAT for errors. External

chkntfs Check the hard disk drive running NTFS for errors. External

Specify a listing of multiple options within a batch


choice External
file.

cls Clears the screen. Internal

cmd Opens the command interpreter.  

Easily change the foreground and background


color Internal
color of the MS-DOS window.

command Opens the command interpreter.  

comp Compares files. External

compact Compresses and uncompress files. External

Open Control Panel icons from the MS-DOS


control External
prompt.

convert Convert FAT to NTFS. External

copy Copy one or more files to an alternate location. Internal

ctty Change the computers input/output devices. Internal

date View or change the systems date. Internal

Debug utility to create assembly programs to


debug External
modify hardware settings.

Re-arrange the hard disk drive to help with loading


defrag External
programs.
del Deletes one or more files. Internal

delete Recovery console command that deletes a file. Internal

deltree Deletes one or more files and/or directories. External

dir List the contents of one or more directory. Internal

Recovery console command that disables Windows


disable Recovery
system services or drivers.

diskcomp Compare a disk with another disk. External

Copy the contents of one disk and place them on


diskcopy External
another disk.

Command to view and execute commands that


doskey External
have been run in the past.

dosshell A GUI to help with early MS-DOS users. External

drivparm Enables overwrite of original device drivers. Internal

echo Displays messages and enables and disables echo. Internal

edit View and edit files. External

edlin View and edit files. External

emm386 Load extended Memory Manager. External

Recovery console command to enable a disable


ename Recovery
service or driver.

Stops the localization of the environment changes


endlocal Internal
enabled by the setlocal command.
erase Erase files from computer. Internal

exit Exit from the command interpreter. Internal

Expand a Microsoft Windows file back to it's


expand External
original format.

extract Extract files from the Microsoft Windows cabinets. External

Displays a listing of MS-DOS commands and


fasthelp External
information about them.

fc Compare files. External

Utility used to create partitions on the hard disk


fdisk External
drive.

find Search for text within a file. External

findstr Searches for a string of text within a file. External

fixboot Writes a new boot sector. Recovery

fixmbr Writes a new boot record to a disk drive. Recovery

for Boolean used in batch files. Internal

format Command to erase and prepare a disk drive. External

ftp Command to connect and operate on a FTP server. External

Displays or modifies file types used in file


ftype Recovery
extension associations.

goto Moves a batch file to a specific label or location. Internal

graftabl Show extended characters in graphics mode. External


Display a listing of commands and brief
help External
explanation.

Allows for batch files to perform conditional


if Internal
processing.

ifshlp.sys 32-bit file manager. External

Network command to view network adapter


ipconfig External
settings and assigned values.

keyb Change layout of keyboard. External

label Change the label of a disk drive. External

lh Load a device driver in to high memory. Internal

Recovery console command that displays the


listsvc Recovery
services and drivers.

loadfix Load a program above the first 64k. External

loadhigh Load a device driver in to high memory. Internal

lock Lock the hard disk drive. Internal

logoff Logoff the currently profile using the computer. External

Recovery console command to list installations


logon Recovery
and enable administrator login.

map Displays the device name of a drive. Recovery

md Command to create a new directory. Internal


mem Display memory on system. External

mkdir Command to create a new directory. Internal

mode Modify the port or display settings. External

more Display one page at a time. External

Move one or more files from one directory to


move Internal
another directory.

msav Early Microsoft Virus scanner. External

msd Diagnostics utility. External

Utility used to load and provide access to the CD-


msdex External
ROM.

Displays protocol statistics and current TCP/IP


nbtstat External
connections using NBT

Update, fix, or view the network or network


net External
settings

Configure dynamic and static network information


netsh External
from MS-DOS.

Display the TCP/IP network protocol statistics and


netstat External
information.

nlsfunc Load country specific information. External

Look up an IP address of a domain or host on a


nslookup External
network.

path View and modify the computers path location. Internal


pathping View and locate locations of network latency. External

Command used in batch files to stop the


pause Internal
processing of a command.

Test / send information to another network


ping External
computer or network device.

Changes to the directory or network path stored


popd Internal
by the pushd command.

power Conserve power with computer portables. External

print Prints data to a printer port. External

prompt View and change the MS-DOS prompt. Internal

Stores a directory or network path in memory so it


pushd Internal
can be returned to at any time.

qbasic Open the QBasic. External

rd Removes an empty directory. Internal

ren Renames a file or directory. Internal

rename Renames a file or directory. Internal

rmdir Removes an empty directory. Internal

route View and configure windows network route tables. External

Enables a user to run a program as a different


runas External
user.

scandisk Run the scandisk utility. External


scanreg Scan registry and recover registry from errors. External

set Change one variable or string to another. Internal

Enables local environments to be changed without


setlocal Internal
affecting anything else.

Change MS-DOS version to trick older MS-DOS


setver External
programs.

Installs support for file sharing and locking


share External
capabilities.

Changes the position of replaceable parameters in


shift Internal
a batch program.

shutdown Shutdown the computer from the MS-DOS prompt. External

Create a disk cache in conventional memory or


smartdrv External
extended memory.

Sorts the input and displays the output to the


sort External
screen.

Start a separate window in Windows from the MS-


start Internal
DOS prompt.

Substitute a folder on your computer for another


subst External
drive letter.

switches Remove add functions from MS-DOS. Internal

sys Transfer system files to disk drive. External

Telnet to another computer / device from the


telnet External
prompt.
time View or modify the system time. Internal

title Change the title of their MS-DOS window. Internal

Visually view a network packets route across a


tracert External
network.

tree View a visual tree of the hard disk drive. External

type Display the contents of a file. Internal

undelete Undelete a file that has been deleted. External

unformat Unformat a hard disk drive. External

unlock Unlock a disk drive. Internal

ver Display the version information. Internal

Enables or disables the feature to determine if


verify Internal
files have been written properly.

Displays the volume information about the


vol Internal
designated drive.

Copy multiple files, directories, and/or drives


xcopy External
from one location to another.

Architecture
Linux kernel map and bigger Interactive map

Linux is a monolithic kernel. Device drivers and kernel extensions run in kernel
space (ring 0 in many CPU architectures), with full access to the hardware,
although some exceptions run in user space. The graphics system most people use
with Linux doesn't run in the kernel, in contrast to that found in Microsoft
Windows.

Kernel mode preemption allows device drivers to be preempted under certain


conditions. This feature was added to handle hardware interrupts correctly and
improve support for symmetric multiprocessing (SMP). Preemption also improves
latency, increasing responsiveness and making Linux more suitable for real-time
applications.

You might also like