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:
Will split the std input lines into files grouped by the 5th column content.
If your locale has Monday as the first day of the week, like mine in the UK, change the two $7 into $6
This was done in csh.
This is a little trickier than finding the last Sunday, because you know the last Sunday is in the first position of the last line. The trick is to use the NF less than or equal to 7 so it picks up all the lines then grep out any empty lines.
Simpler and without all of the coloring gimmicks. This just returns a list of branches with the most recent first. This should be useful for cleaning your remotes.
small update for this command to work with linux kernels 3.x
Like the original version except it does not include the parent apache process or the grep process and adds "sudo" so it can be run by user.
Prints top 5 twitter topics. Not very well written at all but none of the others worked.
Improvement on Coderjoe's Solution. Gets rid of grep and cut (and implements them in awk) and specifies some different mplayer options that speed things up a bit.
This will save parsing time for operations on very big files.
Convert readable date/time with `date` command
Not figured by me, but a colleague of mine.
See the total amount of data on an AIX machine.
It remove the square bracket and convert UNIX time to human readable time for all line of a stream (or file).
Kill all process that concide whit PATTERN
You can use only awk
This command does a basic find with size. It also improves the printout given (more clearer then default)
Adjusting the ./ will alter the path.
Adjusting the "-size +100000k" will specify the size to search for.
This command displays the CPU idle + used time using stats from /proc/stat.
This will extract the differing CSS entries of two files. I've left the initial character (plus or space) in output to show the real differing line, remove the initial character to get a working CSS file. The output CSS file is usable by either adding it in a below the to original.css, or by only using the output but adding @import url("original.css"); in the beginning.
This is very useful for converting Wordpress theme copies into real Wordpress child themes.
Could exclude common lines within entries too, I guess, but that might not be worth the complexity.
Tested in bash on AIX & Linux, used for WAS versions 6.0 & up. Sorts by node name.
Useful when you have vertically-stacked instances of WAS/Portal. Cuts out all the classpath/optional parameter clutter that makes a simple "ps -ef | grep java" so difficult to sort through.
To distinguish normal users from system users. Specify an UID, to list all all users with UID bigger than that in /etc/passwd.
Save some CPU, and some PIDs. :)
This will list the files in a directory, then zip each one with the original filename individually.
video1.wmv -> video1.zip
video2.wmv -> video2.zip
This was for zipping up large amounts of video files for upload on a Windows machine.
This command uses awk(1) to print all lines between two known line numbers in a file. Useful for seeing output in a log file, where the line numbers are known. The above command will print all lines between, and including, lines 3 and 6.