Somtime one wants to kill process not by name of executable, but by a parameter name. In such cases killall is not suitable method.
Get the IP of a hostname.
This command would be useful when it is desirable to list only the directories. 'egrep' chooses only the lines that begin with 'd'. Show Sample Output
diff is designed to compare two files. You can also compare directories. In this form, bash uses 'process substitution' in place of a file as an input to diff. Each input to diff can be filtered as you choose. I use find and egrep to select the files to compare.
Quick and kludgy rss parser for the recent tracks rss feed from last.fm. Extracts artist and track link. Show Sample Output
Please install aria2c before you try the above command. On ubuntu the command to install aria2c would be:
sudo aptitude install aria2
you can also use cut instead of awk. less powerful but probably faster. ;)
adjusting the field "f1" will give you additional information such as f1 = 98% f2 = discharging f3 = 2:02 remaining Show Sample Output
If your customer deletes a file that is still in use by a process, that space does not get freed up (will not show up in df) until that process either closes the file on its own, or is killed.
Get the svn info, grep for the "URL" of the repository, pull out the tag/branch/trunk, and then just show the helpful/meaningful bit. Show Sample Output
Run this as root, it will be helpful to quickly get information about the loaded kernel modules. Show Sample Output
Comcast is an ISP in the United States that has started hijacking DNS requests as a "service" for its customers. For example, in Firefox, one used to be able to do a quick "I'm Feeling Lucky" Google search by typing a single word into the URL field, assuming the word is not an existing domain when surrounded by www.*.com. Comcast customers never receive the correct NX (non-existent domain) error from DNS. Instead, they are shown a page full of advertising. There is a way to "opt out" from their service, but that requires having the account password and the MAC address of your modem handy. For me, it was easier just to set static DNS servers. But the problem is, which ones to choose? That's what this command answers. It'll show you the three _non-hijacked_ Comcast DNS servers that are the shortest distance away. Perhaps you don't have Comcast (lucky you!), but hopefully this command can serve as an example of using netselect to find the fastest server from a list. Note that, although this example doesn't show it, netselect will actually perform the uniq and DNS resolution for you. Requires: netselect, curl, sort, uniq, grep Show Sample Output
Get a list of all the unique hostnames from the apache configuration files. Handy to see what sites are running on a server. A slightly shorter version.
since the most url shorteners respond with a header containing the Location: ... this works with most common shorteners Show Sample Output
Does not print any line that either: - is empty - contains only spaces or tabs - starts with # - starts with spaces/tabs followed by a #
Uses the formatting of a man page to show an outline of its headers and sub-headers. Show Sample Output
Copy this function to command line, press 'Enter' 'f'' 'Enter' to execute (sentence on the left written only for newbies). Hint 'e|x|v|1..9' in front of displayed last modified file name means: "Press 'e' for edit,'x' for execute,'v' for view or a digit-key '1..9' to touch one file from the recent files list to be last modified" and suggested (hidden files are listed too, else remove 'a' from 'ls -tarp' statement if not intended).
If you find this function useful you can then rename it if needed and append or include into your ~/.bashrc config script. With the command
. ~/.bashrc
the function then can be made immediately available.
In the body of the function modifications can be made, i.e. replaced joe editor command or added new option into case statement, for example 'o) exo-open $h;;' command for opening file with default application - or something else (here could not be added since the function would exceed 255 chars).
To cancel execution of function started is no need to press Ctrl-C - if the mind changed and want to leave simple Enter-press is enough. Once defined, this function can with
typeset -f f
command be displayed in easy readable form
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: