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:
On the Mac, the 'ls' function can sort based on month/day/time, but seems to lack ability to filter on the Year field (#9 among the long listed fields). The sorted list continuously increases the 'START' year for the most recently accessed set of files. The final month printed will be the highest month that appeared in that START year. The command does its magic on the current directory, and suitably discards all entries that are themselves directories. If you expect files dating prior to 2002, change the START year accordingly.
This version also attaches to new processes forked by the parent apache process. That way you can trace all current and *future* apache processes.
On wired connections set 'eth0' instead of 'wlan0'
Replace \-dev with whatever you wanna search for
completely remove those packages that leave files in debian / ubuntu marked with rc and not removed completely with traditional tools
It'll print the file names preserving the spaces in their names and adding new line after every new filename.
I wrote this to quickly find out how many files in any directory is owned by a particular user. This can be extended using pipe and grep to do much more.
Also removes translator comments. You can remove the header by omitting --keep-header, but if your msgids contain non-ASCII characters you will need the header to specify a suitable charset.
This command will take the files in a directory, rename them, and then number them from 1...N.
Black belt stuff.
Hell of a time saver.
I run this via crontab every one minute on my machine occasionally to see if a process is eating up my system's resources.
This functionality seems to be missing from commands like dpkg. Ideally, I want to duplicate the behavior of rpm --verify, but it seems difficult to do this in one relatively short command pipeline.
Executing pfiles will return a list of all descriptors utilized by the process
We are interested in the S_IFREG entries since they are pointing usually to files
In the line, there is the inode number of the file which we use in order to find the filename.
The only bad thing is that in order not to search from / you have to suspect where could possibly be the file.
Improvements more than welcome.
lsof was not available in my case
# find assumes email files start with a number 1-9
# sed joins the lines starting with " " to the previous line
# gawk print the received and from lines
# sort according to the second field (received+from)
# uniq print the duplicated filename
# a message is viewed as duplicate if it is received at the same time as another message, and from the same person.
The command was intended to be run under cron. If run in a terminal, mutt can be used:
mutt -e "push otD~=xq" -f $folder
This relies on a public API from http://longurl.org. So, this has the weakness that if the service disappears, the function will break. However, it has the advantage that the shortened URL service will not be tracking your IP address and other metrics, but instead will track longurl.org. Thus, you can remain anonymous from the shortened URL services (although not anonymous from longurl.org). It does no sanity checking that you have provided an argument. If you do not provide one, "message" is displayed to STDOUT.