tar and gzip on unix

May 10th, 2007

Being primarily a Linux user, I'm used to the GNU tar program with gzip included. UNIX tar (at least HP-UX) doesn't have gzip included as part of the tar option set. Here's how to do a tar+gzip as a single command:

tar cvf - . | gzip > ~/backup-020916.tar.gz

Sort by file size in Unix

October 16th, 2006

Sort by the 5th field, numeric, descending:

ls -l |sort -k5rn,5

Live Update Repair

October 11th, 2006

Search/replace in files using perl command line

August 15th, 2006

Here's a method for using a single perl command to search and replace for regular expressions in a file or multiple files

perl -pi -e s#orig text#replace text#g [filenames]

sshfs fstab entry

August 7th, 2006

Here's an example of a fstab entry for a sshfs mount.


# sshfs filesystems
# <file system> <mount point> <type> <options> <dump> <pass>
sshfs#username@remotesystem:/pub /mnt/pub fuse defaults 0 0