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:
grep ERROR *.log
-bash: /bin/grep: Argument list too long
echo *.log | xargs grep ERROR /dev/null
Note that the file at the given path will have the contents of the (still) deleted file, but it is a new file with a new node number; in other words, this restores the data, but it does not actually "undelete" the old file.
I posted a function declaration encapsulating this functionality to http://www.reddit.com/r/programming/comments/7yx6f/how_to_undelete_any_open_deleted_file_in_linux/c07sqwe (please excuse the crap formatting).
This is a nice way to kill processes.. the example here is for firefox!!! substitute firefox for whatever the process name is...
This is fast and efficient because rm is only run once.
These days, most software distributed in tar files will just contain a directory at the top level, but some tar files don't have this and can leave you with a mess of files in the current folder if you blindly execute
tar zxvf something.tar.gz
This command can help you clean up after such a mistake. However, note that this has the potential to do bad things if someone has been *really* nasty with filenames.
This is a 'killall' command equivalent where it is not available.
Prior to executing it, set the environment variable USERNAME to the username, whose processes you want to kill or replace the username with the $USERNAME on the command above.
Side effect: If any processes from other users, are running with a parameter of $USERNAME, they will be killed as well (assuming you are running this as root user)
[-9] in square brackets at the end of the command is optional and strongly suggested to be your last resort. I do not like to use it as the killed process leaves a lot of mess behind.
finds all forms instanciated into a symfony project, pruning svn files.
Get simple description on each file from /bin dir, in list form, usefull for newbies.
tar options may change ;)
c to compress into a tar file, z for gzip (j for bzip) man tar
-print0 and -0t are usefull for names with spaces, \, etc.
this will find text in the directory you specify and give you line where it appears.
For quick validation of folder's file-contents (structure not taken into account) - I use it mostly to check if two folders' contents are the same.
Very useful set of commands to know when your file system was created.
Great for finding which jar some pesky class is hiding in!
This command is useful when you want to know what process is responsible for a certain GUI application and what command you need to issue to launch it in terminal.
Find all files that contain string XXX in them, change the string from XXX to YYY, make a backup copy of the file and save a list of files changed in /tmp/fileschanged.