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

Download 10 random wallpapers from images.google.com

Decode base64-encoded file in one line of Perl
Another option is openssl.

Install pip with Proxy
Installs pip packages defining a proxy

Convert the output of one or more (log, source code ...) files into html,
Requires the "enscript" package. frank@zappa:~# sudo apt-get install enscript Or http://www.codento.com/people/mtr/genscript/ "use your head"

Generate a sequence of numbers.

list files recursively by size

create a new script, automatically populating the shebang line, editing the script, and making it executable.
The first argument is the interpreter for your script, the second argument is the name of the script to create.

delete all bitbucket repos via rest API v2 (req: jq and curl)
bitbucket paginates at around 1360 characters, so if you have several pages of repos in git hub you can just add "?page={1..4}" the url used to get all the repos. you can also use -v for the deletion curl if you want to see the response from the server.

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 A USB Cable Into A Smart Home Gadget
An old USB A/B cable is all you need to make your own Smart Home hardware! Cut off and discard the B-portion of the USB cable. On the A side, connect the RED (+) and WHITE (D-) wires via a 1 kiloohm resistor. $Picture: http://imgur.com/dJGVlAU Now plug the cable into a USB port on your Linux computer. Your hardware is ready! Run the above command after changing variable mysms to your personal email-to-SMS gateway info as required by your cellular service provider. The command uses the amazing usbmon tool (see link below) to detect the cable. For the curious, to view the raw usbmon output, run this command: (Also see the sample output) $usbmon -i usb0 How does it work? When the red and white wires are connected (via the 1 kiloohm resistor) the USB hardwere is tricked into thinking that a new USB device is trying to start up. We then use the usbmon utility to capture the host USB events as it tries to talk to the cable. The expect utility watches the usbmon stream and waits for the disconnect text "-2:128" before sending the SMS message. Finally, the sendmail tool is used to email the SMS message to your smartphone via your cellular provider's SMS-to-email gateway. As a result, when the electrical connection between the red and white wire is interrupted, or the USB cable is unplugged from your computer, you get an SMS notification of the disconnect event on your smartphone. Could this be the cheapest smart home gadget ever? What are YOU going to sense with it? Please let me know in the comments and please don't forget to click it up! $ $Links: $ http://www.linuxcertif.com/man/8/usbmon/ http://en.wikipedia.org/wiki/USB#Pinouts http://imgur.com/dJGVlAU


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: