Home
About
Projects
Articles
Resources
Music

*nix One-Liners

These are just notes I make to myself about how to do things.

Find newest files in a file tree:

find . -type f -printf "%T@ %p\n" | sort -nr | tee allfiles.txt | head -4

Five ways to duplicate a directory tree:

cp -ra <source> [<source2> ... ] <destination>
tar c <source1> [<source2> ... ] | tar xp -C <destination>
find <source> [<source2> ... ] | cpio -padm <destination>  # -uvr
find <source> [<source2> ... ] | cpio -oa | cpio -idm <destination>

To duplicate a directory tree to a different host, use two tar or cpio processes as above, running the pipe over ssh. Or

scp -rp [[user@]host:]<source1> [[user@]host:]<destination>

To convert windows media files to mp3

ffmpeg -i input.wma [-ab <bitrate>] [-ac <channels>] output.mp3

To burn a cd

mkisofs -o output.iso -r -J <files>
cdrecord dev=<scsiId> driveropts=burnfree -data output.iso