A summary of
basic and useful
UNIX Commands:

Musings

Home

UNIX Notes



User

Command
Options
Notes
Command
Options
Notes
id

UID, GID, and groups
cat
hexdump

type a file
view contents, -C is a good option
who
umH
logged in users
less
more
head
tail

page through a file
passwd

change password
grep
egrep

powerful search, pattern matching
pwd

current directory
wc

count lines, words, characters
echo
$HOME
$PATH
variable names, etc.
sort

sort files
cd
~
$HOME
.. (dot-dot)
-
change directories
cut

select columns in files
ls
dir
l,a,F,d,R
directories
sed


stream editor
mkdir
rmdir

make and remove
diretories
enscript
groff
troff
nroff
b, G
-Tascii
-Tps
-man
-l
-mm
-e
-t
-p

ascii output
ps output
man page processing
print
memo
equations
tables
diagrams & flow charts
mv
cp

move
copy
docbook2<x>

Target formats:
dvi, html, man, pdf, ps, rtf, tex, texi, txt
chmod
chown
a+rwx
755
711
R
change protections
<x>2<y>
document converters:
ascii, bm, bw, dos, dsc, epsi,fax, g3, html, man, pal,
pax, pbm, pdf, pfa, pfb, pk, ppm, ps, ras, rgb,texi, tiff,
unix,
ps
fg
bg
&
au
| less
| grep
>
>>
<
2>
&>

output
append output
input
standard error
both error and output
exit
^d
logout

log out
tar
gzip
gunzip
xvf
cvf
z
z filters tar through gzip and gunzip
date


find
<path>
<selection>
<action>
find files
> search paths
> file names, types, etc.
> print, ls, exec
type
which
a
find executable in PATH
export
export variables to child processes
history

use past commands
pico

a simple screen editor
rm

remove files
vi

i - insert
a - append
<ESC> - back to command mode
ZZ - save and quit
:q! - quit without saving
u - undo
/ - search forward
? - search backward
:s/a/b - substitute b for a on current line
NOTE: Lots of other commands
touch

change file timestamp
create empty file
emacs

^x^c - quit
^x^s - save file
see tutorial
alias



lpr
lpstat
lprm
lpc

print
status of printer
remove a print job
interactive printer control
acroread
ghostscript

Adobe Acrobat Reader
faster pdf, ps viewer
ksnapshot

screen/window capture
xsane
scanimage

scanner control
xterm
chvt <n>
ddcprobe

bring up a terminal
virtual terminals, 7 is the X display
info about the graphics card and monitor








Client

Command
Options
Notes
Command
Options
Notes
mozilla
mozilla-rebuild-databases.pl

use which to find the executable
see /usr/lib/mozilla-<version>
ifconfig
mii-tool
ethtool
up, down
display, config, start/stop interface
info about I/F
more info about I/F
firefox
opera
konqueror

browsers
route

netstat
arp
ip
tc
add, del
n
rn
routing, gateway

lots of options
arp resolutions
deep controls
evolution
pine
mutt
mail

e-mailers
ping
traceroute
tracepath
mtr
dig
host
nslookup
arping
nmap








sP
IPv4



DNS

(old)
telnet
ftp

classic commands iptables
lokkit

security by packet filtering
ssh
secure telnet


wget
gftp

multiple ftp files
GUI



rsync
rlogin
rcp
rsh

older commands



Admin

Command
Options
Notes
Command
Options
Notes
su
visudo

become another user
rpm qa
qf
qi
qR
ql
qd
dc
--rebuilddb
To rebuild rpm db:
> rm -f /var/lib/rpm/__db*
> db_verify /var/lub/rpm/Packages
> rpm --rebuilddb
redhat-config-<x>
system-config-<x>


a bunch of GUI's,
use <tab> to see the
whole list
xconfig

setup X
kudzu

hardware scan
lsmod
insmod
modinfo
rmmod

handle dynamic kernel modules
mount
umount
t
see:
/etc/fstab
/etc/
fdisk
sfdisk
mkfs
resize2fs
parted
-l (ell)
dangerous commands
dmesg

log files
fsck

check file system
useradd
groupadd
usermod
userdel
chage
vipw

user, group accounts
df
du
quotacheck
edquota
repquota
usrquota
grpquota
quotaon
quotaoff
warnquota
quota
repquota

free space

quotas
top
gnome-system-monitor
ksysguard

show process information
up2date

updates from RedHat
free
vmstat

memory
ac
accton
sa
lastcomm

user connect time accounting
swapon
iostat
mpstat
sar
w
lsof
fuser
lslk
ltrace
strace
s
c
P
swap info
Other information
ps
pstree
top
jobs
kill

process status and control
sh, bash, csh, tcsh

/etc/shells
init
runlevel

force a run level
current run level
service
<daemon>
start
stop
restart
status
handling daemons now
chkconfig
service
on, off
start,stop,status,restart
setting boot daemons
at
cron

scheduling tasks
mkbootdisk

make boot disk or CD
lpadmin

install printers by hand
this is really painful
shutdown
r, h, now
shutdown with power off or reboot
pam

see /usr/share/doc/pam-?/
html, pdf, ps and txt versions
of documentation
chattr
lsattr

file attributes

setfacl
getfacl
m, x, b
R, L
file access control lists
new in core 2
cat /proc/version

kernel version, etc.
mt
mtx

tape drive controls
rsync

backup/sync file systems
dump
restore

backup file systems also




Server Information

Server Information Commands
Command
Options
Notes
ifconfig

ip addresses, change also
ip
controlling links, addresses, routes, rules, etc.
arp
IP address resolution
route
IP Paths, change also
nslookup
DNS workings
host

DNS host searching, change also
dig
DNS database searching
getent
database queries:
aliases, ethers, group, hosts,
netgroup, networks, passwd,
protocols, rpc, services, shadow
netstat
networking status and information:
connections, tables, statistics,
masquerading, multicasting
rpcinfo
port information and control
nc
listen to TCP and UDP connections
tcpdump
capture and process TCP/IP packets
ethereal
GUI packet capture and decoding


Server Categories

Type
App
Commands
Daemon
Package
Options
Config files
How-To
Comments
Security
iptables
iptables
iptables-save
iptables-restore
iptables
iptables
-h
-L -v --line-numbers
I, A, R, D, N, X, P, E
p, s, d, j, i, o

  • networking-concepts-HOWTO
  • packet-filtering-HOWTO
  • netfilter-hacking-HOWTO
  • netfilter-mirror-HOWTO
  • netfilter-double-nat-HOWTO
  • NAT-HOWTO
  • netfilter-extensions-HOWTO
first crack at network packets
filters on ip, E/N, port (protocol), interface
Term: netfilter, netfilter.org
tcp wrappers
xinetd
xinetd
xinetd

/etc/hosts.allow
/etc/hosts.deny
xinetd HOWTO after iptables
filters on source/destination
ip and dns names
Network
Connections
Router
Gateway
netstat
route


r
/etc/sysconfig/network
/etc/sysctl.conf
The Linux Networking Overview HOWTO use iptables NAT (MASQ)
DNS
named
dig
host
nslookup
nsupdate
named
bind
bind-utils

/etc/named.conf
/etc/host.conf
/etc/hosts
/etc/resolv.conf
DNS HOWTO DNS name resolution
VPN

ciped-cb
cipe


The Linux Cipe+Masquerading mini-HOWTO /etc/sysconfig/network-scripts/ifdown-cipcb
and ifup-cipcb - not included in Fedora 4
Proxy
squid
squid-client
squid
squid

/etc/squid/mime.conf
/etc/squid/msntauth.conf
/etc/squid/squid.conf
/etc/squid/cachemgr.cong
Transparent Proxy with Linux and Squid mini-HOWTO caching proxy server
DHCP
dhcpd
dhcrelay
dhcpd dhcp

/etc/sysconfig/dhcpd
/etc/sysconfig/dhcrelay
DHCP mini-HOWTO dhcp server
NIS
ypbind
ypcat
ypchfn
ypchsh
ypmatch
yppasswd
ypwhich
yppoll
ypset
yptest
ypbind
rpc.yppasswdd
rpc.rpc.ypxfrd

ypbind
ypserv
yp-tools

/etc/yp.conf
/etc/ypserv.conf
/etc/sysconfig/yppasswdd
The Linux NIS(YP)/NYS/NIS+ HOWTO Sun NIS name server
without domainname, this will not work
hostname
domainname
nodename
dnsdomainname
nisdomainname
ypdomainname

net-tools



Set various names used mostly by NIS, but also by others
Printers
Printer
(lots of commands)
cupsd cups
cups-devel
cups-libs
cups-lpd

/etc/cups/cupsd.conf
/etc/cups/classes.conf
/etc/cups/classes.conf
/etc/cups/printers.conf
/etc/pam.d/cups
http://www.cups.org/documentation.php
printer configuration
web interface available
File Servers
NFS
exportfs
nfsstat
nhfsgraph
nhfsnums
nhfsrun
nhfsstone
showmount
rpc.gssd
rpc.idmapd
rpc.mountd rpc.nfsd
rpc.svcgssd
rpc.portmap
rpc.statd rpc.lockd rpc.rquotad
nfs-utils
/etc/exports
/etc/idmapd.conf
/etc/gssapi_mech.conf
Linux NFS-HOWTO can behave badly, not very secure
Samba
smbclient
smbd
nmbd
winbindd
samba
samba-common
samba-client
samba-swat

/etc/samba/smb.conf
SMB HOWTO swat and redhat/system-config-samba overwrite the default - save default config first
> see samba.org
NetWare


mars-nwe



Old technology
Mail



Sendmail
hoststat
mailq.sendmail
makemap
newaliases.sendmail
purgestat
rmail.sendmail
mailstats
makemap
praliases
sendmail.sendmail
smrsh
sendmail
sendmail
sendmail-cf
sendmail-doc
sendmail-devel

/etc/mail/sendmail.cf
/etc/mail/sendmail.mc
/etc/sysconfig/sendmail
The Linux Electronic Mail Administrator HOWTO This is really complicated
Postfix






Not in Fedora 4
POP

dovecot
dovecot

/etc/dovecot.conf
wiki.dovecot.org
new POP/IMAP server in Fedora 1
package was imap
ftp
vsFTP

vsftpd
vsftpd

/etc/vsftpd.conf
/etc/vsftp.user_list


HTTP
Apache
ab
htdbm
htdigest
htpasswd
logresolve
apachectl
totatelogs
suexec
httpd
httpd
httpd-manual
httpd-devel

/etc/httpd/conf/httpd.conf
Apache-Overview-HOWTO.html
other documentation at apache.org
Tomcat

tomcat5
tomcat5
tomcat5-jasper-javadoc
tomcat5-webapps
tomcat5-jasper
tomcat5-servlet-*-api
tomcat5-servlet-*-api-javadoc
tomcat5-admin-webapps

/etc/tomcat5/tomcat5.conf

See tomcat.apache.org
webalizer
webalizer

webalizer

/etc/webalizer.conf

generate web pages of statistics
typically only as localhost
News
innd


inn

/etc/news/inn.conf


Database
MySQL
mysqladmin
mysql
mysqlimport
mysqlshow
mysqld
mysql
mysql-server

/etc/my.cnf

reference manual on-line
PostGre

postmaster
postgresql
postgresql-livs
postgresql-server

/var/lib/pgsql/data


Time





/etc/ntp.conf


SNMP
snmpd
snmptrapd




/etc/snmp/snmp.conf



Programming

Type
Methods
Includes
Examples
Comments
Processes
fork
exec
#include <stdio.h>   // used in printf
#include <stdlib.h>  // used in atoi and wait
#include <unistd.h>  // used in fork and getpid
#include <time.h>    // used in nanosleep

fork some child processes

ND.