Category Archives: Unix Tidbits

Batch Rename One-Liner

Following is a simple way to perform batch renaming, using the Command line: ls *.jpg | awk ‘{print(“mv “$1” “$1)}’ | sed ‘s/jpg/jpeg/’ | /bin/sh If you wish to see the renaming commands before they are performed (just to make … Continue reading

Posted in Unix Tidbits | Leave a comment

Fast and Secure Remote File Transfer Using The Command Line

One of the fastest ways to transfer files between remote machines is using SSH: tar -cz *.jpg | ssh <username@host> “tar -xzC <path-to-expand>” This will create a single compressed archive of all jpg files in the current directory, transfer them … Continue reading

Posted in Unix Tidbits | 2 Comments

Unix Tidbit: Most Requested Web Resources

This is a quick and dirty way to find the most requested static resources of your site (e.g., images or javascript files), using Unix shell commands: grep -oE “GET /[^ \t]+\.(gif|png|js|css)” /var/log/httpd/access_log \ | sort | uniq -c | sort … Continue reading

Posted in Unix Tidbits | Tagged | Leave a comment

Unix Tidbit: Color Coded Directory Listing

Each time I move onto a new Unix machine (I recently bought a new iMac!), I change the look of the terminal directory listings, from this: to this: It’s quite simple — I edit one of the bash config files … Continue reading

Posted in Unix Tidbits | Tagged | Leave a comment