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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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:
Uses find, plutil and xpath.
Note: Some applications don't have proper information. system_profiler might be better to use.
It's a bit slow query.
Due to command length limit, I removed -name "*.app" and CFBundleName.
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.
The closer to zero the better.Credit to TheSeb on macrumors: http://forums.macrumors.com/showthread.php?t=1289884
MAC OSX doesn't come with an updatedb command by default, this will emulate the updatedb thats on a typical Linux OS.
Simply add it to your ~/.bash_profile
MAC OSX doesn't come with a locate command, This will do the same thing as the locate command on a typical Linux OS.
Simply add it to your ~/.bash_profile
List all disks and all of their partitions on OS X. http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/diskutil.8.html
Group membership in OS X is a mish-mash of standards that end up meaning there's almost a half-dozen of ways to belong to a group, what with group inheritance and automatic assignment. This means there's no easy command to find out all groups a user belongs to. The only sensible way then is to list all users and then query each user for membership.
NOTE: This is a function. Once input you can execute it by calling with a groupname.
. a Ruby SSH helper script
. reads a JSON config file to read host, FQDN, user, port, tunnel options
. changes OSX Terminal profiles based on host 'type'
USAGE:
put 'ash' ruby script in your PATH
modify and copy ashrc-dist to ~/.ashrc
configure OSX Terminal profiles, such as "webserver", "development", etc
run "ash myhostname" and away you go!
v.2 will re-attach to a 'screen' named in your ~/.ashrc
adjusting the field "f1" will give you additional information such as
f1 = 98%
f2 = discharging
f3 = 2:02 remaining
Hide-and-Seek is one of the greatest games in the parent's arsenal. Your kid runs off and hides for several minutes, while waiting for you to find him/her. This gives you time to catch a breath and check your email without feeling like a loser. If you'd also like to take advantage of the counting time--claiming that thinking space as your own--use this command on your OSX terminal to maximize downtime. Also, if your kid is like mine, you can get away with "for i in {1..100};" :)
Expand a URL, aka do a head request, and get the URL. Copy this value to clipboard.
otherwise you get this error message:
svn: Can't move '.svn/tmp/entries' to '.svn/entries': Operation not permitted
This uses ssh to transfer the contents of one Mac's clipboard to another's. This only works with plain text, sadly. Trying to transfer images will just clear out the remote machine's clipboard, and rich text will be converted to plain text. Using the "Remote Login" must be enabled on the remote machine (via System Preferences' Sharing panel) for this to work.
Instead of having someone else read you the Digg headlines, Have OSX do it. Requires Curl+Sed+Say. This could probably be easily modified to use espeak for Linux.
Change the file location in the second half of the string to the exact file location of your chosen picture.
Enables widgets to be placed onto the desktop. Click and hold the widget and press F12 to drag it onto the desktop. Repeat the process again to drag a widget back onto the dashboard. You may need to log off or restart for it to take effect.
I often use this command to learn pronunciation of unfamiliar words.
This must be run the first time while logged into your Mac desktop, as it will graphically prompt for access permissions. Subsequent uses will not prompt, assuming you select "Always allow".
I often run some command that takes a while to finish. By putting the say command afterward, I get an audio notification.
Please note that this command (say) only works on Mac OS X and not Linux.