commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
works best in a shell script run at startup. It will ping localhost once and output to null, after it does that, acpi is called for temperature in fahrenheit and piped through to another loop that feeds notify-send for a tooltip. After waiting five minutes, it will start over.
urldecode files in current directrory
tired of opening tabs and fill in search forms by hand? just pipe the search terms you need into this surfraw loop. you can use any browser you have installed, but a graphical browser with a tabbed interface will come in handy. surfraw can be found here:
Watch the temperatures of your CPU cores in real time at the command line. Press CONTROL+C to end.
GORY DETAILS: Your computer needs to support sensors (many laptops, for example, do not). You'll need to install the lm-sensors package if it isn't already installed. And it helps to run the `sensors-detect` command to set up your sensor kernel modules first. At the very end of the sensors-detect interactive shell prompt, answer YES to add the new lines to the list of kernel modules loaded at boot.
finds all epub files in the current directory and all child directories and converts them to .mobi format.
all of the ebook-convert -options are optional; the only parameters you are required to pass are the incoming file and the outgoing file, with the extension.
Has been tested on Ubuntu 10.10
Recursively find php files and replace tab characters with spaces.
"\*.php" -- replace this with the files you wish to find
"expand" -- replace tabs with spaces (use "unexpand" to replace spaces with tabs)
"-t4" -- tabs represent 4 spaces
Note: The IFS="" in the middle is to prevent 'read' from eating leading/trailing whitespace in filenames.
Warn: use convmv or detox if you can: they are the right tools.
But if you want to do it manually, you can use this command to find the problematic files and transliterate their accented characters to their ascii equivalent.
(Useful when doing cd backup: growisofs may fail on files which come from the old iso8859-* days.)
POSIX requires this "string truncating" functionality.
might as well use it, at least for very small tasks where invoking sed and using RE is overkill.
This shows a list of channels from seeon.tv website to watch shows and movies
Show disk space info, grepping out the uninteresting ones beginning with ^none while we're at it.
The main point of this submission is the way it maintains the header row with the command grouping, by removing it from the pipeline before it gets fed into the sort command. (I'm surprised sort doesn't have an option to skip a header row, actually..)
It took me a while to work out how to do this, I thought of it as I was drifting off to sleep last night!
a simple interactive tool to convert Simplified Chinese (typed by pinyin) to Traditional Chinese
This is a simple bash function and a key binding that uses commandlinefu's simple and easy search API. It prompts for a search term, then it uses curl to search commandline fu, and highlights the search results with less.
Take a folder full of files and split it into smaller folders containing a maximum number of files. In this case, 100 files per directory.
find creates the list of files
xargs breaks up the list into groups of 100
for each group, create a directory and copy in the files
Note: This command won't work if there is whitespace in the filenames (but then again, neither do the alternative commands :-)
Center the output text in max line length of buffered output pipe;
Change YOUR TEXT HERE to the text you want.
On figlet -f banner, you can change it to any figlet font you have installed.
One variant for Star Wars fans could be this:
while [ 1 ]; do clear; echo 'Star Wars' | figlet -f starwars -t | while IFS="\n" read l; do echo "$l"; sleep 0.01; done; done
NOTICE: You need to install figlet.
On Ubuntu, this command is:
sudo apt-get install figlet
On Debian, this command is:
aptitude install figlet
just an alternative to #7818
i use this after ripping internet radio streams to number the files as they originally played (even though streamripper can do this with -q).
to number other types of files, or all files, just change the *mp3. to rename directories only you could use
... ls -lt | grep ^d | cut -d ":" -f2 | cut -d " " -f2- | while read ...