Commands tagged Linux (266)

What's this?

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.

Share Your Commands


Check These Out

How to get an absolute value
Whenever we are only interested in difference between two numbers and not the positive/negative values we can use this in script.

Remove specific versions of old kernels (Ubuntu/Debian)
If, for example, you want to remove all kernels and headers but the last three versions, you can't use one of that magic all-in-one "remove old stuff" commands. With this simple but elegant command you can remove a range of versions, or a list of versions with e.g. {14,16,20}.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Pass TAB as field separator to sort, join, cut, etc.
Use this BASH trick to create a variable containing the TAB character and pass it as the argument to sort, join, cut and other commands which don't understand the \t notation. $ sort -t $'\t' ... $ join -t $'\t' ... $ cut -d $'\t' ...

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). $ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

Combine all .mpeg files in current directory into one big one.
Good old cat & output redirection. Using this method you can combine all kinds of things - even mpeg files. My video camera makes a series of .mpeg files that are broken into 4gb chunks. Using this command I can easily join them together. Even better, combined with the cp command the files can be copied and joined in one step.

Notify me when users log in
Notifyme is a program that listen in background for users login, and report on login and logout. Users can be specified from a list or in a ~/notify.rc file. -C options force to display messages on the center of the screen.See man notifyme for more details. Part of notifyme package, tested on Debian.

print indepth hardware info
wanna know something about your hardware? how about EVERYTHING?? then this should do ya well

Fulltext search in multiple OCR'd pdfs

Print summary of referers with X amount of occurances
This prints a summary of your referers from your logs as long as they occurred a certain number of times (in this case 500). The grep command excludes the terms, I add this in to remove results Im not interested in.


Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: