100% found this document useful (1 vote)
158 views

Linux Commands Quick Reference

This document provides detailed documentation on Linux commands including at, date, halt, kill, newaliases, passwd, ps, and shutdown. It describes the commands, their options, and parameters in a multi-page format.

Uploaded by

mishur18
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
158 views

Linux Commands Quick Reference

This document provides detailed documentation on Linux commands including at, date, halt, kill, newaliases, passwd, ps, and shutdown. It describes the commands, their options, and parameters in a multi-page format.

Uploaded by

mishur18
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

1

9
9
5
-
2
0
0
3

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d
.

T
e
c
h
R
e
p
u
b
l
i
c


a
n
d

i
t
s

l
o
g
o

a
r
e

t
r
a
d
e
m
a
r
k
s

o
f

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

R
e
p
r
o
d
u
c
t
i
o
n

o
f

t
h
i
s

p
u
b
l
i
c
a
t
i
o
n

i
n

a
n
y

f
o
r
m

i
s

p
r
o
h
i
b
i
t
e
d
.
This is a single-user version, and only the original purchaser can print copies for his or her use.
at
Execute a command or script at a specified
time and at regular intervals.
at [[-V] [-q queue] [-f file] [-m] [-l] [-d] [-b]
[-v] time] | [-c job [job...]]
[-V]: Show the version of at.
[-q queue]: Specifies the queue to use.
[-f file]: Get the job information from a file.
[-m]: Email job status to user after completion.
[-l]: List the jobs currently in the queue.
[-d]: Remove the job from the queue.
[-b]: Allows a job to be run based on the
current system status.
[-v]: Shows completed jobs still in the queue.
time: The time that the job should run.
MM/DD/YY and/or HH:MM specification is
supported.
[-c job [job...]]: The task that should be
performed at the time specified.
date
Display and set the system date and time
Date [-u | --utc | --universal] [-d | --
date=datestring] [-R | --rfc-822]
[[yyyy]mmddhhmm[yy][.ss]]
[-u | --utc | --universal]: Print/set universal
time.
[-d | --date=datestring]: Display the time
shown by the string specified here.
[-R | --rfc-822]: Show the time in rfc-822
format.
[[yyyy]mmddhhmm[yy][.ss]]: The format for
the date and time.
halt
Power down or restart the system.
halt [-d] [-f] [-h] [-i] [-n] [-p] [-w]
[-d]: Dont write wtmp record before shutting
down.
[-f]: Force a shutdown or restart.
[-h]: Place hard drives into standby before
shutting down.
[-i]: Shut down network interfaces before
shutting down.
[-n]: Dont sync before shutting down. Implies a
-d.
[-p]: Halt with a poweroff rather than restart.
[-w]: Dont shutdown or restart, but write wtmp
record.
kill
Terminate a system process.
kill [-l [signal] | [-s signal | -p]] [-a] [--] pid ...
[-l signal]: Print a list of signal names. Red Hat
Linux 9 has 63 signal names.
[-s signal]: The signal to send to the process.
Signal 9 for example, will send a SIGKILL
signal to a process effectively killing it.
[-p]: Just print the process id for the specified
process and do not send it any signals.
[-a]: Dont restrict commandname-to-pid
conversion.
newaliases
Rebuild the mail aliases database.
Newaliases does not take any parameters and
is functionally equivalent to sendmail -bi.
passwd
Manage users passwords.
passwd [-d | --delete] [-f | --force] [-i | --
inactive=days] [-k | --keep-tokens] [-l | --
lock] [-n | --minimum=days] [-S | --status]
[--stdin] [-u | --unlock] [-w | --
warning=days] [-x | --maximum=days]
[username]
[-d | --delete]: Root only: Delete the password
for the user.
[-f | --force]: Force the operation to complete.
[-i | --inactive=days]: Root only: The account
grace period. The number of days after a
password expires before an account is
disabled.
[-k | --keep-tokens]: Keep authentication
tokens that have not expired.
[-l | --lock]: Root only: Lock the specified
account.
[-n | --minimum=days]: Root only: The
minimum number of days that must pass
before the password can be changed again.
[-S | --status]: Root only: Display the password
status of the specified account.
[-u | --unlock]: Root only: Unlock the specified
account.
[-w | --warning=days]: Root only: The number
of days warning that a user receives that his
password is to expire.
[-x | --maximum=days]: Root only: The
maximum life of a password.
[username]: The username on which to
perform the operation.
ps
Display process statistics.
ps [a] [-A] [-a] [C] [c] [-C processname]
[{--cols num | --columns num | --width
num}] [-d] [e] [-e] [{f | --forest}] [-f] [g] [{-G
RGID | --Group RGID}] [{-g groupname | --
group groupname}] [{h | --no-headers}]
[-H] [--headers] [--html] [{j | -j}] [{l | -l}] [L]
[{--lines num | --rows num}] [{m | -m}] [n]
[{N | -n}] [-N | --deselect] [{--nul | --null |
--zero}] [O] [{o | -o | --format}] [{p pid | -p
pid | --pid pid}] [r] [s] [{S | --cumulative}]
[{-s session | --sid session}] [--sort
sortkey] [{-t tty | t tty | T tty | --tty tty}] [{-U
RUID | --User RUID}] [{-u userid | --user
userid}] [v] [{w | -w}] [x] [X] [-y]
[a]: Show information for all processes on this
terminal including those belonging to other
users
[-A]: Show information for all processes
[-a]: Show information for all processes with a
TTY except session leaders
[C]: Show the raw CPU time
[c]: Show the true command name
[-C processname]: Show information for
processes that match the name specified
[{--cols num | --columns num | --width
num}]: The screen width
[-d]: Show information for all processes except
session leaders
[e]: Show the environment after each
command
[-e]: Show information for all processes with a
TTY except session leaders
[{f | --forest}]: Display: process listing with
ASCII art
[-f]: Display: full process listing
[g]: Really, we mean it this time. Show ALL
process information.
[{-G RGID | --Group RGID}]: Show information
for processes with a matching real group ID
[{-g groupname | --group groupname}]:
Show information for processes matching the
effective group name
[{h | --no-headers}]: Display: do not print
header lines
[-H]: Display: process hierachy
[--headers]: Repeat the header lines
[--html]: Print html escaped output
[{j | -j}]: Display: jobs format
[{l | -l}]: Display: long listing format
[L]: List all formats
[{--lines num | --rows num}]: Set the screen
height
[{m | -m}]: Display: all threads
[n]: Display: numeric output for WCHAN and
USER
[{N | -n}]: Set namelist file
[-N | --deselect]: Negate the selection
[{--nul | --null | --zero}]: Unjustified output with
NULs
[O]: Sort order: overloaded
[{o | -o | --format}]: Display: User define
format
[{p pid | -p pid | --pid pid}]: Show information
for processes with a matching process ID
[r]: Show information for running processes
[s]: Display: Signal format
[{S | --cumulative}]: Include dead child
process information
[{-s session | --sid session}]: Show
information for processes belonging to the
matching session
[--sort sortkey]: Sort order
[{-t tty | t tty | T tty | --tty tty}]: Show
information for processes on the terminal
specified
[{-U RUID | --User RUID}]: Show information
for processes with a matching real user ID
[{-u userid | --user userid}]: Show information
for processes with a matching effective user
ID
[v]: Display: virtual memory format
[{w | -w}]: Display: wide output
[x]: Show information for processes that do not
have controlling TTYs
SYSTEM
Continued on next page


1
9
9
5
-
2
0
0
3

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d
.

T
e
c
h
R
e
p
u
b
l
i
c


a
n
d

i
t
s

l
o
g
o

a
r
e

t
r
a
d
e
m
a
r
k
s

o
f

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

R
e
p
r
o
d
u
c
t
i
o
n

o
f

t
h
i
s

p
u
b
l
i
c
a
t
i
o
n

i
n

a
n
y

f
o
r
m

i
s

p
r
o
h
i
b
i
t
e
d
.
bunzip2
Uncompress files that were compressed with
bzip2.
bunzip2 [-1 .. -9] [--best] [-c | --stdout] [-d |
--decompress] [-f | --force] [--fast] [-h | --
help] [-k | --keep] [-L | --license] [-q | --
quiet] [-s | --small] [-t | --test] [-v | --
verbose] [-V | --version] [-z | --compress]
[-1 .. -9]: Set the block size for the output file. 1
is 100K and 9 is 900K.
[--best]: Same as specifying -9
[-c | --stdout]: Output to standard output
[-d | --decompress]: Decompress file
[-f | --force]: Overwrite any existing output files
[--fast]: Same as specifying -1
[-h | --help]: Get help on command usage
[-k | --keep]: Dont delete the input files
[-L | --license]: Display the version of this
command and license information
[-q | --quiet]: Only display critical errors
[-s | --small]: Run using a small memory
footprint
[-t | --test]: Verify integrity of resulting file
[-v | --verbose]: Provide detailed output
[-V | --version]: Display the version of this
command
[-z | --compress]: Compress the output file
cd
Changes the current directory.
cd directory
directory: The directory to which you would
like to change.
chgrp
Change the group ownership of files and
directories.
chgrp [-R | --recursive ] [--dereference] [-h |
no-dereference] [-c | --changes] [-f | --
silent | --quiet] [-v | --verbose] [--version]
group file [...]
[-R | --recursive]: Recurse into subdirectories
and apply the change.
[--dereference]: Apply the change to the target
of a symbolic link
[-h | --no-deference]: Apply the change to the
symbolic link and not its target.
[-c | --changes]: Report only when changes
are made to the file ownership.
[-f | --silent | --quiet]: Print no status or error
messages.
[-v | --verbose]: Report all details of the
operation.
[--version]: Print the version of the utility.
group: The group to which to assign
ownership.
file [...]: The files to which to assign the
aforementioned group ownership.
chmod
Changes permissions on files.
chmod [-R | --recursive ] [-c | --changes]
[-f | --silent | --quiet] [-v | --verbose] [--
version] [--reference=rfile] mode file [...]
[-R | --recursive]: Recurse into subdirectories
and apply the change.
[-c | --changes]: Report only when changes
are made to the file permissions.
[-f | --silent | --quiet]: Print no status or error
messages.
[-v | --verbose]: Report all details of the
operation.
[--version]: Print the version of the utility.
[--reference=rfile]: Use rfile mode rather than
mode values.
mode: The ugo permissions to assign to
the file.
file [...]: The files to which to assign the
aforementioned permissions.
FILE SYSTEM
Continued on next page
This is a single-user version, and only the original purchaser can print copies for his or her use.
[X]: Display: Linux i386 format
[-y]: Dont show flags
shutdown
Shut down the system. Must be logged in as
root.
shutdown [-a] [-c] [-f] [-F] [-h] [-n] [-k] [-r]
[-t seconds] time [message]
[-a]: Use /etc/shutdown.allow.
[-c]: Cancel an in-progress shutdown.
[-f]: Skip the file system check upon reboot.
[-F]: Force a file system check upon reboot.
[-h]: Halt the system after the shutdown is
complete.
[-n]: Go down fast and dont use init.
[-k]: Only warn about a pending shutdown but
dont actually do it.
[-r]: Reboot the system after the shutdown.
[-t seconds]: The number of seconds to wait
before sending the kill signal.
time: The time to shutdown (ie - now)
[message]: The warning message to send to
attached users.
sudo
Run a command as another user.
sudo [-k] | [-K] | [-l] | [-v] | [-V] | [-b] [-H] [-P]
[-S] [-p prompt] [-u username | #uid] [-s] |
[command]
[-k]: kill: invalidates a users timestamp.
[-K]: sure kill: remove a users timestamp.
[-l]: Shows the allowed commands for the user.
[-v]: Validate the users timestamp.
[-V]: Version
[-b]: Runs the specified command in the
background.
[-H]: Sets the HOME variable to match the
user specified.
[-P]: Preserve the users group vector.
[-S]: Causes sudo to read password from
file rather than terminal.
[-p prompt]: Use a custom password
prompt.
[-u username | #uid]: The user or user ID.
[-s]: Runs the shell specified in the SHELL
variable.
[command]: The command to run.
top
top [b] [c] [C] [d delay] [i] [p pid] [q] [s] [S]
[n iterations]
[b]: Batch mode. Use with n to specify the
number of iterations.
[c]: Display command line rather than
command name.
[C]: SMP systems: display total CPU
statistics.
[d delay]: The delay between screen
updates.
[i]: Ignore idle and zombie processes.
[p pid]: Monitor processes with the specified
process ID. This parameter can be specified
20 times.
[q]: Refreshes without delay.
[s]: Run in secure mode.
[S]: Show process utilization as a cumulative
figure building on the previous process.
[n iterations]: Use with b to run a certain
number of times.
useradd
Add a new user to the system. Must be logged
in as root.
useradd [-A {method | DEFAULT},...] [-c
comment] [-d homedir] [-e expiredate]
[-f inactivetime] [-g initialgroup] [-G
group[...]] [-m [-k skeletondir]] [-n] [-r]
[-s shell] [-u uid [-o]] login
[-A {method | DEFAULT},...]: The name of the
program that will authenticate the user.
[-c comment]: A comment to associate with
the user account.
[-d homedir]: The location of the users
home directory.
[-e expiredate]: The date that the users
account will expire.
[-f inactivetime]: The grace period for the
users account after the password expires
after which it is disabled.
[-g initialgroup]: The name or number of the
users primary group association.
[-G group[...]]: Other groups that the user
belongs to. These values are separated by
commas.
[-m]: Create the users home directory
[-k skeletondir]: and copy the files located
in /etc/skel to it.
[-n]: Add a group with the same name as the
new users account name.
[-r]: Set the flag that marks this account as a
system account.
[-s shell]: The users login shell.
[-u uid]: The users id. Must be unique
[-o]: unless this option is specified.
login: The name of the new user account.
SYSTEM continued


1
9
9
5
-
2
0
0
3

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d
.

T
e
c
h
R
e
p
u
b
l
i
c


a
n
d

i
t
s

l
o
g
o

a
r
e

t
r
a
d
e
m
a
r
k
s

o
f

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

R
e
p
r
o
d
u
c
t
i
o
n

o
f

t
h
i
s

p
u
b
l
i
c
a
t
i
o
n

i
n

a
n
y

f
o
r
m

i
s

p
r
o
h
i
b
i
t
e
d
.
chown
Change file ownership
chown [-R | --recursive ] [--dereference]
[-h | no-dereference] [--
from=curr_owner:curr_grp] [-c | --changes]
[-f | --silent | --quiet] [-v | --verbose]
[--version] [--reference=rfile] file [...]
[-R | --recursive]: Recurse into subdirectories
and apply
the change.
[--dereference]: Apply the change to the target
of a symbolic link
[-h | --no-deference]: Apply the change to the
symbolic link and not its target.
[--from=curr_owner:curr_grp]: Only change
the file ownership if the current owner
information matches this.
[-c | --changes]: Report only when changes
are made to the file ownership.
[-f | --silent | --quiet]: Print no status or error
messages.
[-v | --verbose]: Report all details of the
operation.
[--version]: Print the version of the utility.
[--reference=rfile]: Use rfile mode rather than
mode values.
cp
Copies files.
cp [-a | --archive] [-b | --backup[=control]]
[--copy-contents] [-d] [-f | --force] [-i | --
interactive] [-H] [-l | --link] [-L | --
dereference] [-p] [--preserve=attributelist]
[--no-preserve=attributelist] [--parents] [-P
| --no-dereference] [-R | -r | --recursive]
[--remove-destination] [--reply={yes | no |
query}] [--sparse=conditions] [--strip-
trailing-slashes] [-s | --symbolic-link] [-S | -
-suffix=suffix] [--target-directory=path]
[-u | --update] [-v | --verbose] [-x | --one-
file-system]
[-a | --archive]: Same as -dpR. Preserve the
original file structure and attributes.
[-b | --backup[=control]]: Backup files that will
be overwritten by the process.
[--copy-contents]: Copy contents of special
files.
[-d]: Do not follow symbolic links.Copy the link
as a link.
[-f | --force]: Remove destination files if there
are problems overwriting it.
[-i | --interactive]: Before overwriting
destination files, prompt for approval.
[-H]: Follow command line symlinks.
[-l | --link]: Links files rather than copying
them.
[-L | --dereference]: Follow symlinks. Copy the
files rather than the link.
[-p]: Same as specifying --
preserve=mode,ownership,timestamps.
[--preserve=attributelist]: Preserve the
specified attributes.
[--no-preserve=attributelist]: Do not preserve
the specified attributes.
[--parents]: Append the source path to the
directory specified.
[-P | --no-dereference]: Do not follow
symlinks. Copy the link instead.
[-R | -r | --recursive]: Recurse into
subdirectories for operation.
[--remove-destination]: Before attempting to
overwrite a destination file, remove it.
[--reply={yes | no | query}]: The answer that
should be provided in response to prompts.
[--sparse=conditions]: Control how sparse
files are created.
[--strip-trailing-slashes]: Remove any trailing
slashes from command line arguments.
[-s | --symbolic-link]: Make symbolic links
rather than copy the files.
[-S | --suffix=suffix]: Override backup suffix.
[--target-directory=path]: The directory to
which to copy files.
[-u | --update]: Copy only when source is
newer than destination.
[-v | --verbose]: See all output.
[-x | --one-file-system]: Stay on the same file
system.
df
Shows free disk space statistics.
df [-a | --all] [-B | --block-size] [-h | --human-
readable] [-H | --si] [-I | --inodes] [-k] [--l | --
local] [--no-sync] [-P | --portability] [--sync]
[-t | --type=type] [-T | --print-type] [-x | --
exclude-type=type]
[-a | --all]: Include 0 block file systems.
[-B | --block-size]: Use the specified block size.
[-h | --human-readable]: Print sizes in
readable formats such as 1M, 2G, etc.
[-H | --si]: Same as human-readable but uses
powers of 1000 instead of 1024.
[-I | --inodes]: Show inode information instead
of blocks.
[-k]: Same as --block-size=1K.
[--l | --local]: Show only local file systems.
[--no-sync]: Do not sync before getting stats.
[-P | --portability]: Use POSIX output format.
[--sync]: Sync before getting stats.
[-t | --type=type]: Show listings for only the file
systems specified.
[-T | --print-type]: Show the file system type.
[-x | --exclude-type=type: Exclude the
specified file systems.
du
Show disk usage information.
du [-a | --all] [-b | --bytes] [-B | --block-size]
[-c | --total] [-D | --dereference-args] [-h | --
human-readable] [-H | --si] [-k] [--l | --
count-links] [-L | --dereference] [-S | --
separate-dirs] [-s | --summarize] [-X file | --
exclude-from=file] [file] [-x]
[-a | --all]: Include 0 block file systems.
[-b | --bytes]: Show file sizes in bytes.
[-B | --block-size]: Use the specified block
size.
[-c | --total]: Show a grand total.
[-D | --dereference-args]: Follow symlinks.
[-h | --human-readable]: Print sizes in
readable formats such as 1M, 2G, etc.
[-H | --si]: Same as human-readable but uses
powers of 1000 instead of 1024.
[-k]: Same as --block-size=1K.
[--l | --count-links]: Count size more than once
if the file is hard linked.
[-L | --dereference]: Follow all symlinks.
[-S | --separate-dirs]: Do not include
subdirectories.
[-s | --summarize]: Show just a summary for
each argument.
[-X file | --exclude-from=file]: Exclude files
that match the specified pattern.
[file]: The directories and files to include.
[-x]: Skip directories on different file systems.
fsck
The file system checker. Checks for errors on
the systems drives. Must be logged in as root.
fsck [-P] [-n] [-y] [-c] [-f] [-v] [-b] [-B] [-j] [-l]
[-L]
[-P]: Automatic repair.
[-n]: Make no changes.
[-y]: Assume yes to all.
[-c]: Check for bad blocks.
[-f]: Force checking.
[-v]: Verbose.
[-b]: Use alternate superblock.
[-B]: Force Blocksize.
[-j]: Set journal location.
[-l]: Add bad blocks to list.
[-L]: Get bad blocks list.
grep
A powerful search utility to find information
in files.
grep [-A | --after-context=num] [-a | --text]
[-B | --before-context=num] [-b | --byte-
offset] [--binary-files=type] [-C | --
context=num] [-c | --count] [--
color[=when]] [-D | --devices=action] [-d | -
-directories=action] [-E | --extended-
regexp] [-e | --regexp=pattern] [--
exclude=pattern] [--exclude-from=file] [-f | -
-file=file] [-F | --fixed-strings] [-G | --basic-
regexp] [-h | --no-filename] [-H | --with-
filename] [-i | --ignore-case] [-I] [--
include=pattern] [-l | --files-with-matches]
[-L | --files-without-match] [--label=label]
[--line-buffered] [-m | --max-count=num]
[--mmap] [-n | --line-number] [-NUM] [-o | --
only-matching] [-P | --perl-regexp] [-q | --
quiet | --silent] [-R | -r | --recursive] [-s | --
no-messages] [-U | --binary] [-u | --unix-
byte-offsets] [-v | --invert-match] [-V | --
version] [-w | --word-regexp] [-x | --line-
regexp] [-Z | --null] [-z | --null-data] pattern
files
[-A | --after-context=num]: Print num lines of
trailing context.
[-a | --text]: Same as specifying binary-
files=text.
[-B | --before-context=num]: Print num lines
leading context.
[-b | --byte-offset]: Print byte offsets.
[--binary-files=type]: Consider binary files to
be the type specified. One of text, binary or
without-match.
[-C | --context=num]: Print num lines of output
context.
[-c | --count]: A count of the pattern matches
by file.
FILE SYSTEM continued
Continued on next page
This is a single-user version, and only the original purchaser can print copies for his or her use.


1
9
9
5
-
2
0
0
3

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d
.

T
e
c
h
R
e
p
u
b
l
i
c


a
n
d

i
t
s

l
o
g
o

a
r
e

t
r
a
d
e
m
a
r
k
s

o
f

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

R
e
p
r
o
d
u
c
t
i
o
n

o
f

t
h
i
s

p
u
b
l
i
c
a
t
i
o
n

i
n

a
n
y

f
o
r
m

i
s

p
r
o
h
i
b
i
t
e
d
.
[--color[=when]]: Uses color when condition
matches.
[-D | --devices=action]: How should devices
be handled? read or skip.
[-d | --directories=action]: How should
directories be handled? read, recurse or
skip.
[-E | --extended-regexp]: The pattern
specified is made of up of an extended
regular expression.
[-e | --regexp=pattern]: The pattern specified
is a regular expression.
[--exclude=pattern]: Matching files will not be
searched.
[--exclude-from=file]: Files that match
patterns from the specified file will not be
searched.
[-f | --file=file]: Get the pattern from the file in
this switch.
[-F | --fixed-strings]: The pattern specified is
made of up newline separated strings.
[-G | --basic-regexp]: The pattern specified is
made of up a basic regular expression.
[-h | --no-filename]: Do not print the filename
for a match.
[-H | --with-filename]: For each match, print
the filename in which it was found.
[-i | --ignore-case]: Ignore case.
[-I] : Same as specifying binary-files=without-
match
[--include=pattern]: Matching files will be
included in the search.
[-l | --files-with-matches]: A list of files that
had a match.
[-L | --files-without-match]: A list of files that
did not have a match.
[-m | --max-count=num]: Stop searching after
the specified number of matches.
[-o | --only-matching]: Output only the portion
of the line that matches the search pattern.
[-P | --perl-regexp]: The pattern specified is
made of up a Perl regular expression.
[-q | --quiet | --silent]: Suppress output.
[-R | -r | --recursive]: Same as --
directories=recurse.
[-s | --no-messages]: Do not display error
messages.
[-U | --binary] [-u | --unix-byte-offsets]: Does
not strip carriage return character.
[-v | --invert-match]: Select lines that do not
match the pattern.
[-V | --version]: Get program version
information.
[-w | --word-regexp]: Match whole words only.
[-x | --line-regexp]: Match whole lines only.
[-z | --null-data]: The data line does not end
with newline but with 0 bytes instead.
pattern: The pattern to match.
files: The search file or location.
gunzip
Compress files.
gunzip [-# | --fast | --best] [-a] [-c] [-f] [-h] [-l]
[-L] [-n] [-N] [-r] [-t] [-v] [-V] [-S suffix]
[name ...]
[-# | --fast | --best]: The speed and efficiency
of the process. --fast (or -1) is speedy but
less compressed while --best (-9) is the most
compressed but slowest.
[-a | --ascii]: Use ASCII text mode.
[-c | --stdout | --to-stdout]: Use the standard
output.
[-f | --force]: Force compression.
[-l | --list]: For each file, list both its
compressed and uncompressed size, the
compression ratio and the name of the
uncompressed file.
[-n | --no-name]: Do not save the original
filename and time stamp when compressing
files.
[-N | --name]: Save the original filename and
time stamp when compressing files.
[-r | --recursive]: Recurse into subdirectories.
[-S suffix | --suffix suffix]: The standard suffix
is .gz. Use the option to specify a different
suffix.
[-v | --verbose]: Display as much output as
possible.
[name ...]: The files to compress.
gzip
Compress files.
gzip [-a] [-c] [-d] [-f] [-h] [-l] [-L] [-n] [-N] [-r]
[-S suffix] [-t] [-v] [-V] [-# | --fast | --best]
[name ...] -9 -1
[-a | --ascii]: Use ASCII text mode.
[-c | --stdout | --to-stdout]: Use the standard
output.
[-d | --decompress | --uncompress]:
Uncompress files.
[-f | --force]: Force compression.
[-h]: Help.
[-l | --list]: For each file, list both its
compressed and uncompressed size, the
compression ratio and the name of the
uncompressed file.
[-L]: License.
[-n | --no-name]: Do not save the original
filename and time stamp when compressing
files.
[-N | --name]: Save the original filename and
time stamp when compressing files.
[-r | --recursive]: Recurse into subdirectories.
[-S suffix | --suffix suffix]: The standard suffix
is .gz. Use the option to specify a different
suffix.
[-t]: Test.
[-v | --verbose]: Display as much output as
possible.
[-V]: Version.
[-# | --fast | --best]: The speed and efficiency
of the process. --fast (or -1) is speedy but
[name ...]: The files to decompress.
-9: Best compress.
-1: Fast compress.
head
Show the contents of the beginning of a file.
head [-c | --bytes=size] [-n | --lines=num]
[-q | --quiet | --silent] [-v | --verbose]
[-c | --bytes=size]: Print the first size bytes of
the file.
[-n | --lines=num]: Print the first num lines of
the file.
[-q | --quiet | --silent]: Dont print file name
headers.
[-v | --verbose]: Print file name headers.
ln
Create a link to a file.
[--backup[=control]] [-b] [-d | -F | --directory]
[-f | --force] [-i | --interactive] [-n | --no-
dereference] [-s | --symbolic] [-S | --
suffix=suffix] [--target-directory=directory]
[--backup[=control]]: Make a backup of
existing destination files.
[-b]: Same as --backup, but does not take an
argument.
[-d | -F | --directory]: Super users can hard
link directories using this option.
[-f | --force]: Remove destination files if they
exist.
[-i | --interactive]: Prompt whether destination
files should be removed.
[-n | --no-dereference]: Follow a symbolic link.
Treat the link as a normal file.
[-s | --symbolic]: Create a symbolic link.
[-S | --suffix=suffix]: Change the backup
suffix.
[--target-directory=directory]: The directory in
which to create the link.
ls
Displays a directory listing.
[-a | --all] [-A | --almost-all] [--author] [-b | --
escape] [--block-size=size] [-B | --ignore-
backups] [-c] : [-C] : [--color[=when]] [-d |
--directory] [-D | --dired] [-f] : [-F | --
classify] [--full-time] [-g] : [-G | --no-group]
[-h | --human-readable] [-H | --dereference-
command-line] [-i | --inode] [-I | --
ignore=pattern] [-k] : [-l] : [-L | --
dereference] [-m] : [-n | --numeric-uid-gid]
[-N | --literal] [-o] [-p | --file-type] [-q] [-Q | -
-quote-name] [--quoting-style=word] [-r | --
reverse] [-R | --recursive] [-s | --size] [-S]
[--show-control-chars] [--si] [--sort=word]
[-t] [-T | --tabsize=columns] [-u] [-U] [-v]
[-w | --width=columns] [-x] [-X] [-1]
[-a | --all]: Show all entries, including those
that start with .
[-A | --almost-all]: Show all entries except
those that start with.
[--author]: Show the author.
[-b | --escape]: Print octal escapes for non-
printable characters.
[--block-size=size]: Use the specified size as
the block size.
[-B | --ignore-backups]: Do not list implied
entries with a trailing ~.
[-c]: When used with -lt, sort by and show the
ctime field. With -l, show ctime and sort by
name.
[-C]: Display in columns.
[--color[=when]]: Uses color.
[-d | --directory]: Show directory entries rather
than contents.
[-D | --dired]: Create output for emacs.
[-f]: Do not sort.
[-F | --classify]: Append indicators to file
entries.
[--full-time]: Same as -l --timestyle=full-iso
[-g]: Same as -l but does not show owner
information.
FILE SYSTEM continued
This is a single-user version, and only the original purchaser can print copies for his or her use.
Continued on next page
[-G | --no-group]: Do not display group
information.
[-h | --human-readable]: Print sizes in
readable formats such as 1M, 2G, etc.
[-H | --dereference-command-line]: Follow
symbolic links
[-i | --inode]: Print inode information for each
entry.
[-I | --ignore=pattern]: Do not list implied
entries matching the specified pattern.
[-k]: Same as --block-size=1K.
[-l]: Use a long listing format.
[-L | --dereference]: For links, show
information for the linked file rather than for
the link.
[-m]: Fill width with comma delimited entries.
[-n | --numeric-uid-gid]: Same as -l but show
numeric user and group IDs.
[-N | --literal]: Print raw entry names.
[-o]: Same as -l but dont show group
information.
[-p | --file-type]: Append indicator (/=@|) to
entries.
[-q | --hide-control-chars]: Print a ? in place
of non-printable characters.
[-Q | --quote-name]: Enclose entry within
quotes.
[-r | --reverse]: Sort in reverse order.
[-R | --recursive]: Recurse into subdirectories.
[-s | --size]: Print file sizes in blocks.
[-S]: Sort by file size.
[--si]: Same as human-readable but uses
powers of 1000 instead of 1024.
[--sort=word]: Sort by one of extension, none,
size, time, version
[-t]: Sort by time.
[-T | --tabsize=columns]: Set column width
(default is 8)
[-u]: Show access time
[-U]: Do not sort files.
[-v]: Sort by version.
[-w | --width=columns]: Set screen width.
[-x]: Show entries in lines rather than columns.
[-X]: Sort by extension.
[-1]: List one file per line.
mount
mount [[-lhV] | -a [-f] [-F] [-n] [-r] [-s] [-v] [-w]
[-t vfstype] [-O optlist] |
[[-f] [-n] [-r] [-s] [-v] [-w] [-o options [,...]]
device | dir] |
[[-f] [-n] [-r] [-s] [-v] [-w] [-t vfstype]
[-o options] device dir]]
[-a]: Mount all file systems from fstab.
[-f]: Fakes mounting the file system. Use with -
v to see what is happening.
[-F]: Use with -a. Fork the mount process for
each device.
[-n]: Mount file systems without writing to
/etc/mtab.
[-o options [,...]]: A comma separated list of
options used to control the way that a file
system is mounted.
[-O optlist]: Use with -a and limit the
filesystems to which -a is applied.
[-r]: Same is -o ro. Mounts the file system in
read only mode.
[-s]: Allow unsupported (sloppy) mount options
at the command line.
[-t vfstype]: vfstype indicates the type of file
system on the target device.
[-w]: Same as -o rw. Mount the file system as
a read/write device.
device: The device to mount.
dir: The mount point directory.
mv
Move files from one location to another.
mv [--backup[=control]] [-b] [-f | --force] [-I |
--interactive] [--reply={yes | no | query}]
[--strip-trailing-slashes] [-S | --
suffix=suffix] [--target-directory=directory]
[-u | --update] [-v | --verbose] source
destination
[--backup[=control]]: Make a backup of
existing files at the destination location.
[-b]: Same as --backup but takes no
parameters.
[-f | --force]: Same as --reply=yes. Force
overwrite of destination files without
prompting.
[-I | --interactive]: Same as --reply=query.
Ask before overwriting files.
[--reply={yes | no | query}]: Should files at the
destination location be overwritten?
[--strip-trailing-slashes]: Remove trailing
slashes from source.
[-S | --suffix=suffix]: Change the backup
suffix.
[--target-directory=directory]: Move source
argument into the directory specified.
[-u | --update]: Overwrite destination files only
when they dont exist or when the source is
newer.
[-v | --verbose]: Show all details.
rm
Delete files.
rm [-d | --directory] [-f | --force] [-i | --
interactive] [-r | -R, --recursive] [-v| --
verbose]
[-d | --directory]: Root only: Remove a
directory even if its not empty.
[-f | --force]: Force the process and dont
prompt for deletion.
[-i | --interactive]: Prompt the user before
removing a file.
[-r | -R, --recursive]: Remove contents of
subdirectories.
[-v| --verbose]: Display all output.
touch
Update access and modification times on a file
to the current time.
[-a] [-B seconds | --backward=seconds] [-c |
--no-create] [-d=date| --date=date]
[-F=seconds | --forward=seconds] [-m]
[-r=file | --reference=file] [-t timestamp]
[--time=word]
[-a]: Change access time only.
[-B seconds | --backward=seconds]: Change
the time to go back the specified number of
seconds.
[-c | --no-create]: Dont create files.
[-d=date| --date=date]: Set the date to the
date specified.
[-F=seconds | --forward=seconds]: Set the
time forward the specified number of
seconds.
[-m]: Change only the modification time.
[-r=file | --reference=file]: Use the time from
the file specified.
[-t timestamp]: Use the time specified. The
format is YYYYMMDDhhmm.ss.
[--time=word]: Set the time to the word
specified.
umount
umount [[-f] [-n] [-r] [-v] device] | [-a [-f] [-n]
[-r] [-v] [-t vfstypes] [-O options]]
[-a]: Unmount all of the file systems from
/etc/mtab.
[-f]: Force a file system to unmount.
[-n]: Unmount and dont write to /etc/mtab.
[-O options]: Unmount the file systems with
the options in /etc/fstab.
[-r]: If unmount fails, attempt to remount
read-only.
[-v]: Verbose. Show all detail.
[-t vfstypes]: Unmount the file systems with
the matching type.
device: Dismount the device specified.
FILE SYSTEM continued


1
9
9
5
-
2
0
0
3

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d
.

T
e
c
h
R
e
p
u
b
l
i
c


a
n
d

i
t
s

l
o
g
o

a
r
e

t
r
a
d
e
m
a
r
k
s

o
f

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

R
e
p
r
o
d
u
c
t
i
o
n

o
f

t
h
i
s

p
u
b
l
i
c
a
t
i
o
n

i
n

a
n
y

f
o
r
m

i
s

p
r
o
h
i
b
i
t
e
d
.
This is a single-user version, and only the original purchaser can print copies for his or her use.


1
9
9
5
-
2
0
0
3

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

A
l
l

r
i
g
h
t
s

r
e
s
e
r
v
e
d
.

T
e
c
h
R
e
p
u
b
l
i
c


a
n
d

i
t
s

l
o
g
o

a
r
e

t
r
a
d
e
m
a
r
k
s

o
f

C
N
E
T
N
e
t
w
o
r
k
s
,

I
n
c
.

R
e
p
r
o
d
u
c
t
i
o
n

o
f

t
h
i
s

p
u
b
l
i
c
a
t
i
o
n

i
n

a
n
y

f
o
r
m

i
s

p
r
o
h
i
b
i
t
e
d
.
This is a single-user version, and only the original purchaser can print copies for his or her use.
finger
Get user information.
finger [-l] [-m] [-p] [-s] [user ...]
[user@host ...]
[-l]: Same as -s but includes users home
directory, home phone number, login shell,
mail status and contents of .plan, .project,
.pgpkey, and .forward. Shows in list format.
[-m]: Prevent user name matching.
[-p]: Used with -l to suppress the display of
.plan, .project and .pgpkey.
[-s]: display the users login name, real name,
terminal name, write status, idle time, login
time, office location and office phone number.
[user ...] [user@host ...]: The user IDs for
which to display information.
ifconfig
Configure network interfaces. Must be logged
in as root.
ifconfig interface [aftype] options |
address ...
Inet: TCP/IP.
Inet6: IPV6.
ax25: AMPR Packet Radio.
ddp: Apple Talk.
iPX: IPX.
netrom: AMPR Packet Radio
ifdown
Shut down a network interface. Must be logged
in as root.
ifdown interface_name
interface_name: The name of the interface to
shut down.
ifup
Bring up a network interface. Must be logged in
as root.
ifup interface_name
interface_name: The name of the interface to
start up.
mail
Send and receive mail.
mail [-i] [-I] [-n] [-N] [-v] [-f [name] | -u user |
[[-s subject] [-c cc-addr] [-b bcc-addr]
to-addr...]
[-i]: Ignore TTY interrupts.
[-I]: Run the mail program in interactive mode.
[-n]: Dont read /etc/mail.rc at application start.
[-N]: Dont show initial message headers.
[-v]: Verbose. Show all mail details.
[-f [name]]: Read mbox contents or the
contents of the specified file.
[-u user]: Read contents of another users
mbox.
[-s subject]: The subject of the new message.
[-c cc-addr]: The list of users to which to send
carbon copies.
[-b bcc-addr]: The list of users to which to
send blind carbon copies.
to-addr...: The users to which to send a
message.
NETWORKING
These commands and their switches are based on Red Hat 9.
Specific line switches may vary from version to version. If you
have a question about a specific command, use man
command to access the help file for that command.
Most of the commands in this chart will run no matter what
user ID youve used to log in to your Linux system. However,
some commands will only work when youre logged in as root.
Instead of logging off and back on as root, you can quickly
switch your login by typing su- at the command prompt and
entering the root password.
Linux administrators can make use of numerous timesaving
tips and shortcuts when working with the open source
operating system. Here are just a few of the most important
shortcuts to keep in mind when administering Linux from the
command line:
Use the Backspace key to delete the last character
entered.
CTRL-U deletes all the text entered on the command line.
CTRL-C aborts the command that is executing.
CTRL-Z suspends the command that is executing.
Tab: Instructs the shell to complete a command line
statement automatically using previous entries.
Up arrow: Displays the last used command.
Down arrow: Displays the next command used (after
you've displayed a previous command using the Up arrow).
?: Used as a wildcard in commands to instruct Linux to
search for logical character replacements.
LINUX TIPS
Customer Service:
845-566-1866 or
toll free 800-217-4339
Visit us online at
TechRepublic.com
Project Editor:
Toni Bowers
Technical Editors:
Janice Conard, John Sheesley
Technical Writer:
Scott Lowe
Graphic Artist:
Natalie S. Eckerle
1995-2004 CNET Networks, Inc.
All rights reserved. TechRepublic
and its logo are trademarks of
CNET Networks, Inc.

You might also like