Quick Linux Command Reference
- List CDROM info:
cat /proc/sys/dev/cdrom/info
- Mount .iso under an empty directory:
mount -o loop file.iso /mount_point
- Rip data CD
dd if=/dev/cdrom of=cd_image.iso
- Write ISO to USB Flash drive
dd if=cdrom.iso of=/dev/sdx bs=2048 conv=sync,notrunc
- Download the latest Slackware64 Patches (14.1)
wget -mirror -nd ftp://slackware.mirrors.tds.net/pub/slackware/slackware64-14.1/patches/packages/*.txz
- Download the latest Slackware64 Patches (13.37)
wget -mirror -nd ftp://slackware.mirrors.tds.net/pub/slackware/slackware64-13.37/patches/packages/*.txz
- Download the latest Slackware64 Patches (13.1)
wget -mirror -nd ftp://slackware.mirrors.tds.net/pub/slackware/slackware64-13.1/patches/packages/*.txz
- Download the latest Slackware Patches (13.1)
wget -mirror -nd ftp://slackware.mirrors.tds.net/pub/slackware/slackware-13.1/patches/packages/*.txz
- Download the latest Slackware Patches (12.2)
wget -mirror -nd ftp://slackware.mirrors.tds.net/pub/slackware/slackware-12.2/patches/packages/*.tgz
- Check the md5sums of the downloaded patches:
sed -n "s_\./packages/__;/.*\.txz$/p" CHECKSUMS.md5 | md5sum -c
- Create a MD5 checksum file:
find ./* -type f -print0 | xargs -0 md5sum > CHECKSUMS.MD5
- List Deleted Open Files:
lsof | grep '(deleted)'
- Copy directory structure:
rsync -a --include '*/' --exclude '*' /path/to/source /path/to/dest
- Extract .tar.gz (or .tgz)
tar xzvf <archive name>
- Extract .bz2 (or .tbz2)
tar xjvf <archive name>
- Backup files:
rsync --verbose --progress --stats --compress --rsh=/usr/bin/ssh --recursive --times --perms --owner --group [--delete] /sourcedir/* xxx.xxx.xxx.xxx:/destdir
- Combine multiple avi files into one:
mencoder -oac copy -ovc copy -o output.avi input1.avi input2.avi
- Backup DVD to harddrive (need to mount first)
vobcopy -m -o /dest/path/
- Set up a SOCKS proxy
ssh -D <port> <host>
- Check ntp servers
ntpq -p
- Check installed PEAR packages
pear list -a
- Get public IP address from ifconfig.me (icanhazip.com and whatismyip.org work similar):
curl ifconfig.me
- Resolve NetBIOS name
nbdlookup <server>
- Run a script remotely
ssh user@host 'bash -s' < /path/script