Commands by empulse (3)

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

Archive all SVN repositories in platform indepenent form
Use of hotcopy for safety/stability of the backups.

Re-emerge all ebuilds with missing files (Gentoo Linux)

Create a CD/DVD ISO image from disk.
Many like to use 'dd' for creating CD/DVD iso images. This is bad. Very bad. The reason this is, is 'dd' doesn't have any built-in error checking. So, you don't know if you got all the bits or not. As such, it is not the right tool for the job. Instead, 'reaom' (read optical media) from the wodim package is what you should be using. It has built-in error checking. Similarly, if you want to burn your newly creating ISO, stay away from 'dd', and use: $ wodim -v -eject /path/to/image.iso

Deleting / Ignoring lines from the top of a file

check open ports without netstat or lsof

Backup your hard drive with dd
This will create an exact duplicate image of your hard drive that you can then restore by simply reversing the "if" & "of" locations. $ sudo dd if=/media/disk/backup/sda.backup of=/dev/sda Alternatively, you can use an SSH connection to do your backups: $dd if=/dev/sda | ssh [email protected] dd of=~/backup/sda.backup

Print all lines between two line numbers
Print all lines between two line numbers This command uses sed(1) to print all lines between two known line numbers in a file. Useful for seeing output in a log file, where the line numbers are known. The above command will print all lines between, and including, lines 3 and 6.

Partition a sequence of disk drives for LVM with fdisk
So, I'm using a CentOS VM in VirtualBox, and created four new disks in the SCSI controller. The VM created the folders: /dev/sda /dev/sdb /dev/sdc /dev/sdd Using a 'for loop' all disks are partitioned for LVM.

retab in vim, tab to space or space to tab, useful in python
usage: :[rang]ret[!][tabstop value] python is indent sensitive, after command :set list you may see your codes are mixed with tab and space ret can help you to convert space to tab or tab to space

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: