A list of commands and their syntax, some of which for some reason, seem to escape me only when I need it.

tar -cvf (create a tar archive from a directory)

tar -cvf – * | ssh root@ ‘cd /home;tar xvf -’ (creates a tar archive of current directory and sends it via ssh to a destination host and unpacks at the destination)

zip -r (create a zip archive from a directory)

rsync -auEv (copy files locally from one location to another keeping all permissions and modification dates and Executibility)

rsync -auvEe ssh root@192.168.0.1:/home/me/folder1 /home/you (copies from another host using ssh and the remote user “root” to login and gain access to /home/me/folder1 and copy it locally to /home/you/folder1)

strace -p (run strace on a currently running process id number)

ssh -x (provides additional information when running a command)

ssh -L 9999:192.168.0.1:3389 @192.168.0.23 (creates a local port 9999 that will forward traffic through 192.168.0.23 via ssh to 192.168.0.1 port 3389. a.k.a encrypt your rdesktop session)

ssh -XC @ (remotely connect to a machine running sshd, also exporting your display and enabling compression)

iostat 1 100 (run iostat every second 100 times)

netstat -rn (show routing table, and don’t resolve names)

netstat -an (show all enabled ports and sockets on an operating system)

arp -a (show the current arp table)

dmidecode (show hardware information for your running system)

rpm -qPpl (displays the files contained in a rpm patch file that is not installed)

rpm -qa –qf ‘%{name}%{version}%{release}%{arch}\n’ | egrep ‘’ (lists the name, version, release and architecture information for all packages that match the criteria)

rpm -ql (displays all files are their locations that are associated with the package specified)

iptables -A INPUT -p tcp –dport 22 -s 192.168.0.2 -j DROP (creates a rule in memory that allows iptables to drop incoming ssh connections that originate from 192.168.0.2.) Add this to a start script to make this persistent!

setfacl -m d:u:bob:rw /home/bob (set a user acl with read/write access on the directory /home/bob)

free (show memory related information)

ldd /usr/bin/sshd (shows all shared libraries that the ssh daemon uses/requires)

find /etc -depth | cpio -pdmV /tmp/etcbackup (searches for everything listed in /etc (recursive) and sends the results to cpio, which in turn places all files in /tmp/etcbackup..this is much cleaner than cp -a..Also, you can add a “u” to the cpio to do this unconditionally.)

find /var -print | xargs du |sort -g (searches in /var and all sub directories (recursive) below for all files and puts them in numerical order according to their size.)