Commands by lordtoran (27)

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

convert Decimal to IP from stdin
https://stackoverflow.com/questions/10768160/ip-address-converter

list files recursively by size

Prepend a text to a file.
The original command is great, but I often want to prepend to every line.

Remove embedded fonts from a pdf.
It's sometimes useful to strip the embedded fonts from a pdf, for importing into something like Inkscape. Be warned, this will increase the size of a pdf substantially. I tried this with only gs writing with -sDEVICE=pdfwrite but it doesn't seem to work, so I just pipe postscript output to ps2pdf for the same effect.

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"

Silently deletes lines containing a specific string in a bunch of files
This command will find all occurrences of one or more patterns in a collection of files and will delete every line matching the patterns in every file

url shortner using google's shortner api
First get a api key for google url shortner from here https://developers.google.com/url-shortener/ Then replace the API_KEY in the command

List available upgrades from apt (package names only)
Usefull if you only want to see the package names, or if you want to use them in a script.

Generate random valid mac addresses
Ruby version. Also, a perl version: $perl -e 'printf("%.2x.",rand(255))for(1..5);printf("%.2x\n",rand(255))'

Stop and continue processing on a terminal
This will send the ASCII sequence for DC3 to the currently running tty which results in SIGSTOP (19). You can continue with ASCII sequence for DC1 by pressing CTRL+q which results in SIGCONT (18).


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: