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

edit hex mode in vim
return to normal mode from hex mode :%!xxd -r

List your largest installed packages.
Calculates the size on disk for each package installed on the filesystem (or removed but not purged). This is missing the $ | sort -rn which would put the biggest packges on top. That was purposely left out as the command is slightly on the slow side Also you may need to run this as root as some files can only be checked by du if you can read them ;)

find unreadable file

bulk rename files with sed, one-liner
Renames all files in a directory named foo to bar. foobar1 gets renamed to barbar1 barfoo2 gets renamed to barbar2 fooobarfoo gets renamed to barobarfoo NOTE: Will break for files with spaces AND new lines AND for an empty expansion of the glob '*'

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"

search ubuntu packages to find which package contains the executable program programname
search ubuntu's remote package source repositories for a specific program to see which package contains it

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

find all files containing a pattern, open them using vi and place cursor to the first match, use 'n' and ':n' to navigate

Make changes in .bashrc immediately available
You may want to just use the shortcut "." instead of "source"

Copy structure
Clone directory structure without the files


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: