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:
ls -1 shows one file per line (update: -1 was not really needed)
wc -l counts the lines received from the previous command
Look for a string in one of your codes, excluding the files with svn and ~ (temp/back up files). This can be useful when you're looking for a particular string in one of your source codes for example, inside a directory which is under version control (e.g. svn), removing all the annoying files with ~ (tilde) from the search. you can even change the command after -exec to delete (rm) or view (cat) files found by 'find' for example
most usefull when creating batch scripts using several usb drives and some commands like mkntfs needs a device name
the -w option for grep is here to filter lines when you have multiple drives with the same volume label. Without this option, the grep command will return
For reverse, there's asc2xml
asc2xml < entitiesfile > utf8file
They come as a part of the html-xml-utils debian package.
PS. Tried to submit sample data, but the site autoconverted the non ascii to html entities. So a bit of imagination is needed.
Like the given command, but combines _DISPLAY=":0.0"_ with _export DISPLAY_ to get _export DISPLAY=":0.0"_ and only imports if DISPLAY is set successfully.
Find top 5 big files
use this comand to see which switch port your network interface is using.
but remind, there is no network traffic for 10 minutes or how long you run the comand.
if you start the comand via ssh, port will come up again after the "for loop" has endet
Works for any mathematical operation, even converting numbers from one base to another.
Creates a git repository in a predefined location.
When you do a ls -1 | xargs rm it wouldn't workd because those files have spaces. So you must use
find -print0 and xargs -0
unzips all zip files in any subdirectory under the current directory. The zip files are unzipped in their respective subdirs
Built-in function in linux, should work on any distro
apt-show-versions is a program that shows what packages in the system may be updated and several useful information. The -u option displays a list of upgradeable packages:
This will show the locations, in order of preference, that MySQL will look for a configuration file
Ever need to erase the contents of a file and start over from scratch? This easy command allows you to do so. Be warned! This will immediately erase all the contents of your file and start you over from scratch (i.e. your file will be at 0 bytes, like if you touch a file).
But who knows to delete the rest of the lines?
I want only "string".