commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
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.