Intro to UNIX

Basic Unix Commands

This is a set of useful "starter" commands in Unix. To find out more about any of them, see the manual page (man commandName).

Navigating directories
cd dirName (change directory) mkdir dirName (make directory)
pwd (print current working directory) rmdir dirName (remove directory)
[Recommended alias: back]
Listing & Seeing Files
ls [aliases: l, ll, recent] (list files) touch (change modification date)
cat (concatenate, or just view) grep (search for pattern)
more/less (view page-by-page) diff (compare files)
head/tail (view top/bottom)
vi/emacs/nano (editors)
Copying, Moving, Removing Files
cp (copy) ln (link)
mv (move, or rename)
rm (remove)
Changing File Permissions
chmod (change mode/permissions)
Other general, useful commands
passwd (change password) clear (clear the screen)
man (manual page, e.g., man passwd) echo (print to screen)
exit, logout (exit the shell, log out) wc (word/line/character count)
who (show who is logged on) date (show date and time)
Remote login/file copy
ssh (start remote secure shell) scp (remote secure copy)
Dealing with processes
ps (process status) kill (kill process)
Basic sys admin type commands
sudo (do as superuser) uptime (time since reboot)
df (display free disk space) find (find files)
du (disk usage) mount/unmount (disks)
apt-get/yum (get Linux packages)
Basic networking commands
ping (send echo request) arp -an (address resolution protocol)
traceroute (trace route to host) netstat -nr (show network status)
Compiling and testing programs
cc, CC (C and C++ compilers) gcc (Gnu C & C++ compilers)
gcc -Wall -Wextra -Wpedantic -Wformat -Wshadow -Wredundant-decls -Wstrict-prototypes
The -W options generate warnings about questionable constructions; these sometimes indicate programmer confusion or actual logic errors. (You can also use -Wtraditional to catch some non-traditional C constructs that GCC allows, or -Wmissing-prototypes to find functions that do not have prototypes in header files.)
cflow, dbx, gdb (for C debugging; different debuggers have been available on different systems)

Alyce Brady, Kalamazoo College