Misc

Reduce console output

In /etc/sysctl.conf:

kernel.printk = 4 4 1 7

Then

$ sysctl -p /etc/sysctl.conf

Bash for loop

$ for i in {0..9}; do echo "$i"; done

Create a 1GB file

$ dd if=/dev/zero of=tempfile bs=1M count=1000 conv=fdatasync,notrunc

Find large files

$ find . -size +100M | xargs ls -lh

Wipe harddisk

Shred, just overwrite with zeros

# shred -vzn 0 /dev/sdX

Shred, overwrite two times with pseudo random data, than with zeros

# shred -vzn 2 /dev/sdX

Badblocks

# badblocks -s -w -t random -v /dev/sdX

dd, overwrite with pseudo random data

# dd if=/dev/urandom of=/dev/sdX bs=1M

Copy directory

$ tar -cSp --numeric-owner --atime-preserve -f - . | ( cd /target && tar -xSpv --atime-preserve -f - )
$ rsync -azv --delete /src/foo /target

Mount ISO

$ mount -o loop -t iso9660 file.iso /mnt

SSH tunnel

$ ssh -L 1025:localhost:25 foo@server.example.com

External monitor / beamer

$ xrandr --output LVDS --mode 1024x768 --output VGA --mode 1024x768 --same-as LVDS
$ xrandr --output LVDS --mode 1680x1050 --output VGA --off

Download files with wget

$ wget -r -l1 -A "pattern*" -nd http://server.example.com/

Verify checksum of files

$ for file in *.md5; do cat $file; md5sum `basename $file .md5`; echo; done
$ for file in *.sha1; do cat $file; sha1sum `basename $file .sha1`; echo; done

Verify GPG signature of files

$ for file in *.asc; do gpg -v $file; done