man -k [key word] find manual for command related to a keyword
export VAR=value 'set' a command shell environment variable
~/.profile user shell commands/variables
/etc/profile global system shell commands/variables
grep -i foo foo.txt report string foo matches in file foo.txt
.htaccess this file declares server side include
and MIME type extensions served
set REQUEST_METHOD POST Example of how to set an environment variable
... use set to view state
talk willco@inow.com live chat session, ctrl C to quit
.forward place this file containing a forward
address in home directory. chmod 644?
mail
q quits and deletes read messages
pre * will unread all messages such that quit does not delete them
w n [file] saves message body only
s n [file] saves entire message
x quits with no message deletion
useradd -u UID -d /home/username -c "User Name" username -m
passwd [opt user] change password, defaults to current user
passwd -l username lock out user
passwd -S username report user password status
smbpasswd user:user update SMB (MS Windows file sharing) passwd
pwd show current file path
rm -R [path/file] will summariliy delete dir and its children
rm -fr ... recursive and skips user prompts
cp -a old new preserve file properties i possible
chmod 760 [file/dir] rwx, rw, -
chown [user].[group]
chmod g+s [dir] new child dir's will inherit parent group
Users and Groups
grep -i foo foo.txt report string foo matches in file foo.txt
ps list active processes
kill [p#] kill active process by number
kill -n 9 [p#] kill hung process by number (SIGKILL)
gzip [file1] compress to file.gz
gunzip [file1.gz] uncompress to file1
tar cvf [archive] * create archive file of all files in current directory
tar xvf [src] extract files from archive
zip -r foo.zip set/*
uuencode [src] [name] > [dest]
uudecode [file]
du recursive directory showing block use
ln [org] [lnk] make a hard file link
ln -s [org] [lnk] make symbolic link
foo & runs foo as background task
tr '\r' '\n' < in > out Macintosh -> UNIX
tr -d "\r" < in > out MSDOS-> UNIX
vi
/ locate text forward
? locate text reverse
ma mark block start
mb mark block end
:'a,'bd delete block
yy copy line
P insert line below
G move to last line
:0 move to first line
:set nowrap don't wrap long line, set wrap to enable
:set ic ignore case for locate text
:set noic use case for locate text
find [path] -name [file]
find -iname "*.c" -exec grep -i "foobar" -H -n {} \;
df show disk space usage
diff -b [f1] [f2] show non-white space differences between files
tail -f [file] watch file being appended, ^C to end
watch ls -l 2 second refresh of ls command
uname -a report system information
lsmod list kernel modules currently active
Helpful DNS diagnostic commands (typically part of bind-utils package) ...
whois zaptech.org
dig jabber.zaptech.org
dig jabber.zaptech.org any
dig @ns1.sparkworx.com jabber.zaptech.org
su - invoke root shell w/root environment
date -u output UTC time instead of local time
a2ps -Plp192.168.11.21 foo.c
scp RPMS/apache-1.3.20-16.i386.rpm fredness@tester.local:/home/fredness
killall httpd
nohup ./httpd & from terminal session, invoke command in background (creates nohup.out)
ci foobar.txt RCS commit
co -l foobar.txt RCS checkout
rlog foobar.txt RCS show commit log
rcsdiff foorbar.txt RCS diff current vs last commit
rcsdiff foorbar.txt 1.1 1.2
w show who's logged in
netstat -l what is listening
netstat -a what is listening and sending
netstat -tp show process id of tcp connections
cat /proc/ide/svwks machine technical attributes
hdparm -i hard disk technical attributes
# show all filenames, for each name if present also cat the file
find . -name "*" -exec sh -c "echo file:{} && cat {}" \;
# show files older than 60 days
find . -atime +60 -exec sh -c "ls -l {};" \;
# fancy ftp handling, may not be part of most distros base install
ncftpget -d stdout -u username -p passwd -R ftp://somesite.com/public_html
# test pulling slave data from a DNS master
dig axfr @pentium.lan.zaptech.org zaptech.com
# recursive ftp download using username with a '@'
wget -r ftp://leighster%40sprintmail.com:password@ftp-www.earthlink.net
# wget, another recursive example
wget ftp://bubble/httpdocs/* -r --user bubble --password pop
# Find all files with name Root, search and replace text
find -name Root -exec sh -c "sed -s s/happy-neuron.com/63.131.132.56/g {} > sed; mv sed {}" \;