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:
This command might not be useful for most of us, I just wanted to share it to show power of command line.
Download simple text version of novel David Copperfield from Poject Gutenberg and then generate a single column of words after which occurences of each word is counted by sort | uniq -c combination.
This command removes numbers and single characters from count. I'm sure you can write a shorter version.
Ok so it's rellay useless line and I sorry for that, furthermore that's nothing optimized at all...
At the beginning I didn't managed by using netstat -p to print out which process was handling that open port 4444, I realize at the end I was not root and security restrictions applied ;p
It's nevertheless a (good ?) way to see how ps(tree) works, as it acts exactly the same way by reading in /proc
So for a specific port, this line returns the calling command line of every thread that handle the associated socket
This will, for an application that has already been removed but had its configuration left behind, purge that configuration from the system. To test it out first, you can remove the last -y, and it will show you what it will purge without actually doing it. I mean it never hurts to check first, "just in case." ;)
Purge all configuration files of removed packages
Useful for removes a package and its depends, for example to remove the gnome desktop environment, also configuration files will be removed, you should be carefully and sure that you want to do this.
Displays only the VGA adapter/chipset being used for the graphics. In this case, it gave me the "M22" and "Mobility Radeon x300" that I needed to research a graphics issue I was having.
Written for linux, the real example is how to produce ascii text graphs based on a numeric value (anything where uniq -c is useful is a good candidate).
Highlights the search pattern in red.
Basically an improvement on an earlier ethtool command line.
Give the Speed and Link status of eth# 0-3. This is sort of what mii-tool does, but eth-tool is better, yet lacks device discovery.
connects to all the screen instances running.
This command puts all the flags of the USE variable actually used by the packages you emerged to the file "use", and those which are unused but available to the file "notuse"
If you're like me and want to keep all your music rated, and you use xmms2, you might like this command.
I takes 10 random songs from your xmms2 library that don't have any rating, and adds them to your current playlist. You can then rate them in another xmms2 client that supports rating (I like kuechenstation).
I'm pretty sure there's a better way to do the grep ... | sed ... part, probably with awk, but I don't know awk, so I'd welcome any suggestions.
Greps located files for an expression.
Example greps all LaTeX files for 'foo':
locate *.tex | xargs grep foo
To avoid searching thousands of files with grep it could be usefull to test first how much files are returned by locate:
locate -c *.tex
When you fill a formular with Firefox, you see things you entered in previous formulars with same field names. This command list everything Firefox has registered. Using a "delete from", you can remove anoying Google queries, for example ;-)
This is useful for remove all packages that are part of a common suite.
This is a simple command, but extremely useful. It's a quick way to search the file names in the current directory for a substring. Normally people use "ls *term*" but that requires the stars and is not case insensitive. Color (for both ls and grep) is an added bonus.
Lists the local files that are not present in the remote repository (lines beginning with ?)
and add them.
Declare this function in your Shell, then use it like this:
> jumpTo foo
The script will search for the 'foo' pattern in your current xmms2 playlist (artist or songname), and play the first occurence of it !
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.