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

Timer with sound alarm

get all Google ipv4/6 subnets for a iptables firewall for example (updated version)
google has added 2 more netblocks...

SSH Copy ed25519 key into your host

seq can produce the same thing as Perl's ... operator.
Optionally, one can use {1..50} instead of seq. E.g. for i in {1..50} ; do echo Iteration $i ; done

Remove all but One
$ rm-but() { ls -Q | grep -v "$1" | xargs rm -r ; } Add this to your .bashrc file. Then whenever you need to remove all files/directories but one from present working directory. Run: $ rm-but Notes: 1. This doesn't affect the hidden files. 2. Argument is actually as string. And all files/directories having this string in there name are left untouched.

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

exit if another instance is running
runs only one instance.

convert (almost) any image into a video
This is an extract from a larger script which makes up slideshow videos from images. $seconds is the number of seconds the video will last, and $num is a loop counter which numbers the videos for concat into a longer video later, so they will be in order. The dev/null bit on the end cuts ffmpeg's verbosity.

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

Number of connections to domains on a cPanel server


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: