All commands (14,187)

What's this?

commandlinefu.com 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

Show what PID is listening on port 80 on Linux

alias to close terminal with :q
Put this in your ~/.bashrc file (or the equivalent) If you use vim a lot, this alias will be immediately obvious. Your brain will thank you.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

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

google chart api
http://chart.apis.google.com/chart?chs=450x200&cht=p3&chtt=Browser+Usage+on+Wikimedia&chl=IE%2834.2%%29|Firefox%2823.6%%29|Chrome%2820.6%%29|Safari%2811.2%%29|Opera%285.0%%29|Android%281.9%%29|Other%283.5%%29&chd=t:34.2,23.6,20.6,11.2,5.0,1.9,3.5

Recursively chmod all dirs to 755 and all files to 644

Prints total line count contribution per user for an SVN repository
I'm working in a group project currently and annoyed at the lack of output by my teammates. Wanting hard metrics of how awesome I am and how awesome they aren't, I wrote this command up. It will print a full repository listing of all files, remove the directories which confuse blame, run svn blame on each individual file, and tally the resulting line counts. It seems quite slow, depending on your repository location, because blame must hit the server for each individual file. You can remove the -R on the first part to print out the tallies for just the current directory.

Summarize the number of open TCP connections by state
Useful for checking the number and state of TCP connections.

Get a Bulleted List of SVN Commits By a User for a Specifc Day (Daily Work Log)
* Replace USERNAME with the desired svn username * Replace the first YYYY-MM-DD with the date you want to get the log (this starts at the midnight event that starts this date) * Replace the second YYYY-MM-DD with the date after you want to get the log (this will end the log scan on midnight of the previous day) Example, if I want the log for December 10, 2010, I would put {2010-12-10}:{2010-12-11}

Create a file of repeated, non-zero
dd can be used with /dev/zero to easily create a file of all zero-bytes. Pipe that through tr and use octal conversions to change the byte values from zero to 0xff (octal 0377). You can replace 0377 with the byte of your choice. You can also use \\0 and \\377 instead of the quoted version.


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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: