MISC shortcuts

From ZWHLUG

Jump to: navigation, search

tar.gz a file or directory

tar -czf <filename>.tar.gz <target>

tar.bz2 a file or directory

tar -cjf <filename>.tar.bz2 <target>

Mount an iso

mount -o loop -t iso9660 <filename>.iso /mnt/<mountpoint>

Find files older than X days

find /<path>/* -type f -mtime +[<number-of-days>]

Remove files older than X days

find /<path>/* -type f -mtime +[<number-of-days>] -prune -exec rm -rf {} \;

Replace <source> by <target> in <file> using sed

sed -i 's/<source>/<target>/' <file>
Views
Personal tools