Commands by pyrux (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

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

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

ssh tunnel with auto reconnect ability

Mac OS X: remove extra languages to save over 3 GB of space.
This will get the job done in the most efficient way - spawning only one `rm` process. "On-the-fly" find data is displayed through `tee` and you should have plenty of time to ctrl-c if needed before it's too late. You may need to re-run this after major Software Updates. To leave more languages in, add more ``-and \! -iname "lang*"'' statements: $ sudo find / -iname "*.lproj" -and \! -iname "en*" -and \! -iname "spanish*" -print0 | tee /dev/stderr | sudo xargs -0 rm -rfv **Edit: note the 2nd sudo near the end of the pipeline - this is necessary.

Compare two directories
Output of this command is the difference of recursive file lists in two directories (very quick!). To view differences in content of files too, use the command submitted by mariusbutuc (very slow!): $ diff -rq path_to_dir1 path_to_dir2

View Processeses like a fu, fu
I don't truly enjoy many commands more than this one, which I alias to be ps1.. Cool to be able to see the heirarchy and makes it clearer what need to be killed, and whats really going on.

start a VNC server for another user

Function to output an ASCII character given its decimal equivalent
I've corrected the function. My octal conversion formula was completely wrong. Thanks to pgas at for setting me straight. The new function is from pgas and is very fast.

github push-ing behind draconian proxies!
If you are behind a restrictive proxy/firewall that blocks port 22 connections but allows SSL on 443 (like most do) then you can still push changes to your github repository. Your .ssh/config file should contain: Host * ForwardX11 no TCPKeepAlive yes ProtocolKeepAlives 30 ProxyCommand /usr/local/bin/proxytunnel -v -p -d %h:443 Host User git Hostname ChallengeResponseAuthentication yes IdentityFile ~/.ssh/id_rsa IdentitiesOnly yes Basically proxytunnel "tunnels" your ssh connection through port 443. You could also use corkscrew or some other tunneling program that is available in your distro's repository. PS: I generally use "" as the SSH-HOST so that urls of the kind [email protected]:USER/REPO.git work transparently :) You

Generate a random password 30 characters long
The pwgen program generates passwords which are designed to be easily memorized by humans, while being as secure as possible. Human-memorable passwords are never going to be as secure as completely completely random passwords. [from pwgen man page]

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: