Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Dan Berlyoung

Convert Mac to Unix line endings in VI

If you open a text file in VI and see one big line with lots of '^M' where the line endings are supposed to be, use this command to fix it.
(Enter the the ^M by hitting ctrl-v and then the return key.)

:1,$s/^M/\r/g

Human Readable ls and df commands

Simple but useful to know...

To get a ls (file list) or df (disk free) to show in K,M or G instead of *huge* numbers of bytes without commas, use the -h flag.

ls -lh
df -h

Get all files in ftp server directory using WGET

It's a PITA to recursively get all files in a directory using ftp. Instead use wget.

wget -r ftp://account_name:password@example.com/directoryname

Reverse DNS from command line

Quick and easy way to look up a domain name given an IP address.

dig -x 17.254.3.183