Commands by mij (1)

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

Convert CSV to JSON with miller
Using the csv tool `miller` you can transform a csv file into a json array of objects, where the properties are the values of the csv header line and the values are the values of the subsequent lines.

All what exists in dir B and not in dir A will be copied from dir B to new or existing dir C
Assumed dir A, B, C are subdirs of the current dir Exact syntax of the command is: rsync -v -r --size-only --compare-dest=/path_to_A/A/ /path_to_B/B/ /path_to_C/C/ (do not omit end-slashes, since that would copy only the names and not the contents of subdirs of dir B to dir C) You can replace --size-only with --checksum for more thorough file differences validation Useful switch: -n, --dry-run perform a trial run with no changes made

commandline dictionary
Note: 1) Replace 'wonder' with any word you looking the meaning for in the above example 2) Need to install these packages: wordnet & wordnet-base (latter should be automatically installed because of dependency) 3) Combined size of packages is about 30MB on my old ubuntu system (I find it worth it)

list block devices
Shows all block devices in a tree with descruptions of what they are.

List your largest installed packages (on Debian/Ubuntu)
dpigs is in the package debian-goodies (debian/ubuntu)

Optimal way of deleting huge numbers of files
Optimal way of deleting huge numbers of files Using -delete is faster than: $ find /path/to/dir -type f -print0 | xargs -0 rm $ find /path/to/dir -type f -exec rm {} + $ find /path/to/dir -type f -exec rm \-f {} \;

Convert a flv video file to avi using mencoder

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

Using Git, stage all manually deleted files.
You'll probably want to pass in the -rf options if you have to delete a directory or something.

List total available upgrades from apt without upgrading the system
This let's you find out the total packages that have available upgrades. Usefull if you want to check or show the total available upgrades on your system.

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: