Reverts the changes that were made in a particular revision, in the local working copy. You must commit the local copy to the repository to make it permanent. This is very useful for undoing a change. You can revert multiple changes by specifying numbers wider apart; Just remember to put the highest number first. Show Sample Output
Removes the given string from all files under the given path - in this case the path given is "." This demonstrates the characters that must be escaped for the grep and sed commands to do their work correctly. Very handy for fixing hacked html files.
this is great if you loose you ssh connection (with out a screen session) or are working on a laptop with a bad battery, or just a power outage. Modifications: you may not need the -print; the mtime is last modified time in days
Really, you deserve whatever happens if you have a whitespace character in a file name, but this has a small safety net. The truly paranoid will use '-i'.
In these command i use lynx to get the top trend topic of Mexico, if you replace Mexico with other country, you will get the #1 Trending topic
The glob pattern * expands to all files, no need for the 'ls' command. The quotes around "$i" make sure filenames with spaces in them are handled correctly. mplayer determines if it is a media file and plays it, or gives errors and the loop asks if this file has to be removed. Show Sample Output
using awk missed the last char thanks @Josay Show Sample Output
Open all files which have some string go directly to the first line where that string is and run command on it.
Other examples:
Run vim only once with multiple files (and just go to string in the first one):
grep -rl string_to_find public_html/css/ | xargs vim +/string_to_find
Run vim for each file, go to string in every one and run command (to delete line):
grep -rl string_to_find public_html/css/ | xargs -I '{}' vim +/string_to_find {} -c ":delete"
This command will scan the subnet and exlude duplicates
Find the length of the longest line of code in your files. Show Sample Output
More direct like this Show Sample Output
Where is my Apache public_html ?!
Rip audio tracks from CD to wav files in current dir
Often times you run a command in the terminal and you don't realize it's going to take forever. You can open a new terminal, but you lose the local history of the suspended one. You can stop the running command using , but that may produce undesirable side-effects. suspends the job, and (assuming you have no other jobs running in the background) %1 resumes it. Appending & tells it to run in the background. You now have a job running concurrently with your terminal. Note this will still print any output to the same terminal you're working on. Tested on zsh and bash. Show Sample Output
Will check if the given module is installed in the @INC. It will print the path and return 0 if found, or 1 otherwise. Based on script from SharpyWarpy in http://www.linuxquestions.org/questions/linux-general-1/how-to-list-all-installed-perl-modules-216603/ Show Sample Output
If you don't have telnet, you can use the bash built-in tcp pipes.
Use the lshw command to display information about your video card. Give more ouput when run as root. Show Sample Output
Email if you disk is over 90% - www.fir3net.com
Print out contents of file with line numbers. This version will print a number for every line, and separates the numbering from the line with a tab. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.
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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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: