Commands by leavittx (2)

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
Replace 'csv_file.csv' with your filename.

Run bash on top of a vi session (saved or not saved), run multiple commands, instead of one at a time with :!(bashcommand), type exit and [enter] to get back to where you left off in vi.

Monitor logs in Linux using Tail
Works in Ubuntu, I hope it will work on all Linux machines. For Unixes, tail should be capable of handling more than one file with '-f' option. This command line simply take log files which are text files, and not ending with a number, and it will continuously monitor those files. Putting one alias in .profile will be more useful.

ssh X tunneling over multiple ssh hosts (through ssh proxy)
Simply makes it possible to launch any X application residing on sshhost through sshproxy and display it on your screen where ever you are.

Stream YouTube URL directly to MPlayer
A function for streaming youtube to mplayer. The option "-g" for youtube-dl tells it to output the direct video URL, instead of downloading the video. "-fs" tells MPlayer to go FullScreen, and "-quit" makes it less verbose. Requires: youdube-dl ( ) (Tested in zsh)

I hate `echo X | Y`
apart from not being generalisable to all shells, `Y <<< X` seems nicer to me than `echo X | Y`, e.g. $ <<< lol cat; it reads easier, you type less, and it also looks cool

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Zip each file in a directory individually with the original file name
This will list the files in a directory, then zip each one with the original filename individually. video1.wmv -> video2.wmv -> This was for zipping up large amounts of video files for upload on a Windows machine.

Get your external IP address
Yeah I know it's been up here a million times, but this service is a really clean and nice one. Nothing but your IP address on it. Actually I was to write something like this, and noticed this on appspot... ;)

Quick HTML image gallery
My take on the original: even though I like the other's use of -exec echo, sed just feels more natural. This should also be slightly easier to improve. I expanded this into a script as an exercise, which took about 35 minutes (had to look up some docs):

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: