commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Encrypt any text to MD5 , replace text with the string you want to convert to MD5
after kernel build with make deb-pkg, I like to install the 4 newest packages that exist in the directory. Beware: might be fewer for you....
Tail is much faster than sed, awk because it doesn't check for regular expressions.
Maybe very limited in its applicability but could be of use at times.
like #9295, but awkish instead of perlish
say only processes a complete file, at eof, so following a file isn't possible. Quick and dirty perl oneliner to feed each line from the tail -f to say. Yes, expensive to lauch a new process each line.
This little ditty was prompted by a discussion on how horrible it is to use VoiceOver on ncurses programs such as irssi.
Silly approach, but easy to remember...
Changes are displayed when they are written to the file
Sort by time and Reverse to get Ascending order, then display a marker next to the a file, negate directory and select only 1 result
Not perfect but working (at least on the project i wrote it ;) )
Specify what you want search in var search, then it grep the folder and show one result at a time.
Press enter and then it will show the next result.
It can work bad on result in the firsts lines, and it can be improved to allow to come back.
But in my case (a large project, i was checking if a value wasn't used withouth is corresponding const and the value is "1000" so there was a lot of result ...) it was perfect ;)
Replace the head -1 with head -n that is the n-th item you want to go to.
Replace the head with tail, go to the last dir you listed.
You also can change the parameters of ls.
Count and Find all IP connected to my host through TCP connection.
The same with colors
It willl popup a message for each new entry in /var/log/messages
found on the notify-send howto page on ubuntuforums.org.
Posted here only because it is one of the favourites of mine.
Find the USERid of a SUDOed user who has either left their terminal logged in or for scripting purposes to track who ran what commands.
This only applys to users that do sudo su - USERNAME. not sudo su USERNAME
Sudo su without the dash allows use of (echo $SUDO_USER)
Using tail to follow and standard perl to count and print the lps when lines are written to the logfile.
You can actually do the same thing with a combination of head and tail. For example, in a file of four lines, if you just want the middle two lines:
head -n3 sample.txt | tail -n2
Line 1 --\
Line 2 } These three lines are selected by head -n3,
Line 3 --/ this feeds the following filtered list to tail:
Line 2 \___ These two lines are filtered by tail -n2,
Line 3 / This results in:
being printed to screen (or wherever you redirect it).
Uses history to get the last n+1 commands (since this command will appear as the most recent), then strips out the line number and this command using sed, and appends the commands to a file.