Linux
Mount SMB Share
Label fat32 vfat Filesystem
ACL
setfacl -x u:foo DEST
setfacl -m g:bar:r-- DEST
setfacl -x g:bar DEST
setfacl -m d:u:foo:r-- DIR
setfacl -m d:g:bar:r-- DIR
setfacl -m m:r-- DEST
setfacl -m d:m:r-- DIR
Archiving / Backup
Backup Remotehost with tar
Add redundancy to files
Create a DVD image larger than 2GB
Complete Compressed Partionbackup Into an Image
dd if=/dev/zero of=/delme1 bs=4048; rm /delme1;
mount /dev/hda1 / -o remount,ro;
Local
Remote
ssh host -c blowfish 'dd if=/dev/hda1 bs=4048 | bzip2' | dd of=/image_hda1.bz
Detect interactive shells
...
else
...
fi
Change output of a shellscript and restore output again later
exec 1>>/var/log/mylogfile.txt
...
exec 1>&3
exec 3>&-
Change file content without temporary files with sponge
Usually you have to use temporary files if you want to change the content of a file, as you can not read and write to a file simultaneously. This can be very inconvenient, especially as secure creation of temp files is not too easy. One solution for this problem is sponge:
However, this does only work if sponge writes to a file. If you redirect its output this will not work. In Debian sponge can be found in the moreutils package.
System Infos
# df -ah
# top -n1
htop
# vmstat 5 3
smartctl --all /dev/sda
memstat -w
Who blocks a mounted drive
If you can not unmount a mounted drive find out who blocks it
fuser /mnt/foo
Benchmarks
Use zcav to measure the speed of a mass storage device depending on the position on the drive you are currently reading from
gnuplot
set yrange [0:*]
set format y '%g Blocks/s'
set format x '%g MB'
plot "zcav.txt" using 1:2 title "Foo"
Benchmark a drive with bonnie++
Networks
Show which settings the networkmanager is using, for example show DNS server that is being used