O'Reilly logo

Unix in a Nutshell, 4th Edition by Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beginner's Guide

If you're just beginning to work on a Unix system, the abundance of commands might prove daunting. To help orient you, the following lists present a small sampling of commands on various topics.

Communication

ftp

Interactive file transfer program.

login

Sign on to Unix.

mailx

Read or send mail.

slogin

Sign on to remote Unix using secure shell.

ssh

Connect to another system, securely.

Comparisons

cmp

Compare two files, byte by byte.

comm

Compare items in two sorted files.

diff

Compare two files, line by line.

diff3

Compare three files.

dircmp

Compare directories.

sdiff

Compare two files, side by side.

File Management

cd

Change directory.

chgrp

Change file group.

chmod

Change access modes on files.

chown

Change file owner.

cksum

Print a file checksum, POSIX standard algorithm.

cp

Copy files.

csplit

Break files at specific locations.

file

Determine a file's type.

head

Show the first few lines of a file.

less

A sophisticated interactive pager program for looking at information on a terminal, one screenful (or "page") at a time. The name is a pun on the more program.

ln

Create filename aliases.

locate

Find a file somewhere on the system based on its name. The program uses a database of files that is usually automatically rebuilt, nightly.

ls

List files or directories.

md5sum

Print a file checksum using the Message Digest 5 (MD5) algorithm.

mkdir

Create a directory.

more

Display files by screenful.

mv

Move or rename files or directories.

pwd

Print working directory.

rm

Remove files.

rmdir

Remove directories.

scp

Copy files to remote system securely.

split

Split files evenly.

tail

Show the last few lines of a file.

wc

Count lines, words, and characters.

Miscellaneous

banner

Make posters from words.

bc

Arbitrary precision calculator.

cal

Display calendar.

calendar

Check for reminders.

clear

Clear the screen.

info

The GNU Info system for online documentation.

man

Get information on a command.

nice

Reduce a job's priority.

nohup

Preserve a running job after logging out.

passwd

Set your login password.

script

Produce a transcript of your login session.

spell

Report misspelled words.

su

Switch to a different user.

Printing (BSD Commands)

lpr

Send to the printer.

lpq

Get printer status.

lprm

Cancel a printer request.

pr

Format and paginate for printing.

Printing (System V Commands)

cancel

Cancel a printer request.

lp

Send to the printer.

lpstat

Get printer status.

pr

Format and paginate for printing.

Programming

cc

C compiler.

ctags

C function references (for vi).

ld

Loader.

lex

Lexical analyzer generator.

make

Execute commands in a specified order.

od

Dump input in various formats.

splint

C program analyzer.

strace

Trace signals and system calls.

strip

Remove data from an object file.

truss

Trace signals and system calls.

yacc

Parser generator. Can be used with lex.

Searching

egrep

Extended version of grep.

fgrep

Search files for literal words.

find

Search the system for filenames matching patterns or attributes.

grep

Search files for text patterns.

strings

Display text strings found in binary files.

Shells

Bourne family shells:

bash

The GNU Project's Bourne Again Shell.

ksh

The Korn shell, either an original or clone, depending upon the operating system.

pdksh

The Public Domain Korn shell.

sh

The original Bourne shell, particularly on commercial Unix systems.

zsh

The Z-shell.

C shell family shells:

csh

The original BSD C shell.

tcsh

The "Tenex" C shell: a much-enhanced version of csh.

Shell Programming

basename

Print the last component of a pathname, optionally removing a suffix.

dirname

Print all but the last component of a pathname.

echo

Repeat command-line arguments on the output.

expr

Perform arithmetic and comparisons.

id

Print user and group ID and name information.

line

Read a line of input.

printf

Format and print command-line arguments.

sleep

Pause during processing.

test

Test a condition.

Storage

bunzip2

Expand files compressed with bzip2 (.bz2 files).

bzip2

Very high quality file compression program.

cpio

Copy archives in or out.

gunzip

Expand compressed (.gz and .Z) files.

gzcat

Display contents of compressed files (may be linked to zcat).

gzip

Compress files to free up space.

tar

File tree and tape archiver.

zcat

Display contents of compressed files.

System Status

at

Execute commands later.

crontab

Automate commands.

date

Display or set date.

df

Show free disk space.

du

Show disk usage.

env

Show environment variables.

finger

Display information about users.

kill

Terminate a running command.

ps

Show processes.

stty

Set or display terminal settings.

who

Show who is logged on.

Text Processing

awk

A pattern-matching programming language for working with text files.

cat

Concatenate files or display them.

cut

Select columns for display.

ex

Line editor underlying vi.

fmt

Produce roughly uniform line lengths.

iconv

General-purpose character-encoding conversion tool.

join

Merge different columns into a database.

paste

Merge columns or switch order.

sed

Noninteractive text editor.

sort

Sort or merge files.

tr

Translate (redefine) characters.

uniq

Find repeated or unique lines in a file.

vi

Visual text editor.

xargs

Process many arguments in manageable portions.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required