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

Unite pdf files
pdfunite is a part of the poppler-utils. poppler-utils package is only 150KB. The alternative - pdftk package is 14MB! Install poppler-utils if you need simple pdf operation commands like unite, separate, info, text/html conversions

Smart `cd`.. cd to the file directory if you try to cd to a file
This little function will smarten 'cd'. If you try to cd into a file (which I guess we all have done), it cd's into the directory of that file instead. I had to use nesten if's, to get cd to still work with 'cd' (to get to $HOME), 'cd -' (to get to last directory), and 'cd foo\ bar'.

Finding all files on local file system with SUID and SGID set

Replace spaces in filenames with underscores
I realize there's a few of these out there, but none exactly in this form, which seems the cleanest to me

Delete empty directories
Recursively delete empty directories. Use with care.

Function to change prompt
Bash function to change your default prompt to something simpler and restore it to normal afterwards.

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

Execute a command with a timeout

Merge PDFs with Ghostscript wrapped in a function
This is an expansion on a previous entry, which I've wrapped in a function and placed in my profile. The "$@" is a positional parameter, much like "$*", but the parameters are passed on intact, without interpretation or expansion; so you can simply call the function like this: mergepdf * This will output a merged PDF of all PDFs in the current directory. Alternatively, you can simply list them like so: mergepdf 00.pdf 01.pdf 02.pdf ... N.B. Passing a wildcard will merge all PDFs in the current directory in name order, e.g. 00.pdf 01.pdf aa.pdf ab.pdf

Analyse writing style of writing style of a document
Style analyses the surface characteristics of the writing style of a document. It prints various readability grades, length of words, sentences and paragraphs. It can further locate sentences with certain characteristics. If no files are given, the document is read from standard input. style is part of "diction" package


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: