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

archlinux:Delete packages from pacman cache that are older than 7 days
Sometimes my /var/cache/pacman/pkg directory gets quite big in size. If that happens I run this command to remove old package files. Packages that we're upgraded in last N days are kept in case you are forced to downgrade a specific package. The command is obviously Arch Linux related.

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

List all authors of a particular git project
List everyone who committed to a particular project, listed alphabetically. To list by commits, add -n to the shortlog.

Convert CSV to JSON - Python3 and Bash function
Based / Inspired by malathion's below command http://www.commandlinefu.com/commands/view/20528/convert-csv-to-json Is written for python3 and is very easy to use csv2json *csv will convert all files ending in csv to json eg csv2json file.csv will output a file to file.json Validity of json tested in python3 and below site https://jsonformatter.curiousconcept.com/

Remove git branches that do not have a remote tracking branch anymore

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

grep -v with multiple patterns.
Use multiple patterns with grep -v. So you can print all lines in a file except those containing the multiple patterns you specify.

quick copy
Utilizes shell expansion of {} to give the original filename and a new filename as arguments to `cp`. Can easily be extended to make multiple copies.

shell bash iterate number range with for loop

locate a filename, make sure it exists and display it with full details
use the locate command to find files on the system and verify they exist (-e) then display each one in full details.


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: