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:
This command lists all the directories in SEARCHPATH by size, displaying their size in a human readable format.
Files saved on a windows machine use different ascii characters for lines turns. When viewing such files in VI the will most often have a ^M(control-VM) character at the end of each line. This command will remove all occurrences of that character
Emacs backs up previous versions by default.
use it to stagger cronjob or to get a random number
increase the range by replacing 100 with your own max value
just replace the number 5 with the variable you want , and the xpenguins software with the one you want
Nothing special about hashing here, only the use of cut, I think, could result at fewer keystrokes.
executed on SLES 11.2
Run this in your music folder, or give the path directly after "find".
The sed pattern filters away the basename.
The same as the other user, but smarter, using -d and -f
Command to create a dummy file (full of nulls). Useful for testing e.g. file transfers when no file is at hand.
bs = blocksize, count = filesize in kilobytes
unrar e ... extracts all files into current directory, without archived subdirectories order. unrar x is more accurate command.
Depending on your installation, when you run ps you will only get the first 40 or so characters displayed. In order to view the entire string, use /usr/ucb/ps on Solaris.
Of course, this command must be executed at a GRID User Interface
lhcb - name of your VO, substitute it with the one you are interested it.
This obtains a list of open connections that a user is connected to if he/she is using a SSH tunnel
Use find's built-in "exec" option to avoid having to do any weirdness with quoting.
this command is used to locate all pom.xml files, access the dir and do a mvn clean, but I do recommend you to disable network interfaces to not download dependencies packages to be faster.
xargs deals badly with special characters (such as space, ' and "). To see the problem try this:
touch 'not important_file'
ls not* | xargs rm
Parallel https://savannah.nongnu.org/projects/parallel/ does not have this problem.
of course, replace the "-" after / by the character you wish. a dot must by protected by a backslash, as it is a regexp. it's the same result as the command proposed. but if there is more than a dash in the name, only the part before the first dash is kept... so that's not an "extension renaming" command.
This will print out the third column of every line in FILE. Useful for many files in /proc or *csv data.
no need that useless cat.