Commands tagged osx (61)

  • speaks out last twitter update using 'say'


    -1
    curl "http://api.twitter.com/1/statuses/user_timeline.xml?count=1&screen_name=barackobama" | egrep -w "<text>(.*)</text>" | sed -E "s/<\/?text>//g" | say
    beerdeaap · 2012-02-27 18:46:33 3
  • http://github.com/c3w/ash . 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 Show Sample Output


    -1
    ash prod<tab>
    c3w · 2012-05-12 19:51:02 8
  • 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. Show Sample Output


    -1
    members () { dscl . -list /Users | while read user; do printf "$user "; dsmemberutil checkmembership -U "$user" -G "$*"; done | grep "is a member" | cut -d " " -f 1; };
    eduo · 2012-05-20 11:34:33 7

  • -1
    diskutil list
    grahamperrin · 2012-10-06 21:18:27 6
  • 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. Show Sample Output


    -1
    find /Applications -type d -maxdepth 1 -exec sh -c 'echo "{}"; (plutil -convert xml1 -o - "{}/Contents/Info.plist" | xpath /dev/stdin "concat(\"v\", /plist/dict/string[preceding-sibling::key[1]=\"CFBundleShortVersionString\"]/node())" 2>/dev/null)' \;
    darkfader · 2013-03-29 14:01:23 4

  • -2
    hdid somefile.dmg
    rnoyfb · 2010-01-15 12:00:48 5
  • 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.


    -2
    long_command; say I am all done
    haivu · 2010-01-27 19:03:01 12
  • 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.


    -2
    IFS=`echo -en "\n\b"`; for i in $(curl http://feeds.digg.com/digg/container/technology/popular.rss | grep '<title>' | sed -e 's#<[^>]*>##g' | tail -n10); do echo $i; echo $i | sed 's/^/Did you hear about /g' | say; sleep 30; done
    echosedawk · 2010-06-07 22:16:19 4

  • -3
    sudo pmset -a hibernatemode 1
    therod · 2009-04-28 19:53:57 5
  • This command will open up the two files in FileMerge on OS X. You can also compare two directories. opendiff directory1 directory2 NOTE: FileMerge is a part of the OS X Developer Tools, available on the install disc.


    -3
    opendiff <file1> <file2>
    claytron · 2009-06-16 03:22:52 7
  • 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};" :)


    -3
    txt="";for i in {1..20};do txt=$txt"$i. ";done;say $txt" Ready or not, here I come"
    antic · 2011-12-11 05:51:22 21
  •  < 1 2 3

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

Colorized grep in less
Get your colorized grep output in less(1). This involves two things: forcing grep to output colors even though it's not going to a terminal and telling less to handle those properly.

Batch convert PNG to JPEG
Convert all PNG images in directory to JPEG using ImageMagick, and delete the old PNG images.

a function to find the fastest DNS server
http://public-dns.info gives a list of online dns servers. you need to change the country in url (br in this url) with your country code. this command need some time to ping all IP in list.

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"

Purge configuration files of removed packages on debian based systems
Purge all configuration files of removed packages

Sniff ONLY POP3 authentication by intercepting the USER command
dsniff is general purpose password sniffer, it handles *lots* of different protocols, but it also handles tcp-style expressions for limiting analyzed traffic - so I can limit it to work on pop3 only.

Download files linked in a RSS feed
The difference between the original version provided and this one is that this one works rather than outputting a wget error

Compare a remote dir with a local dir
You can compare directories on two different remote hosts as well: $ diff -y

Execute multiple commands from history
Assuming that 219,229 and 221 are entries in history, I recall them in a single line for execute multiple commands 219 ifdown wlan0 ... 221 ifup wlan0 ... 229 iwconfig wlan0 mode Managed so the result is execution of # ifdown wlan0 ; iwconfig wlan0 mode Managed ; ifup wlan0

list files recursively by size


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: