36 ms·
OS X Command Line Utilities
- nemasu 12y agoThis is neat. I'll be getting a mac soon, and this is right up my ally.
- milla88 12y agoMy favorite command is 'say'. You can do all kinds of silly voices. Try this out: say hello -v Good
- milla88 12y agoFor anyone wondering, you can also do this: say -v '?' (This gives you a list of voices) say -v Good (This let's you type in a stream of text)
- microtherion 12y agoA newer trick (as of Mavericks) is that say can also highlight words while reading text: say --interactive=/green spending each day the color of the leaves
- SloopJon 12y agoIn Mavericks, selecting Customize from the System Voice dropdown of the Dictation & Speech preferences brings up a list of voices you can download as well. I think Alex was my default, but some of the others seem much better.
- marceldegraaf 12y agoIt knows how to sing "In The Hall Of The Mountain King" as well: say -v cellos "Dum dum dum dum dum dum dum he he he ho ho ho fa lah lah lah lah lah lah fa lah full hoo hoo hoo"
- minikomi 12y agoJust mucking around, came up with this: wc -l < /usr/share/dict/words | xargs -I {} jot -r {} 100000 | paste -d " " - /usr/share/dict/words | sort | awk '{print $2 "! "}' | say
- deleted 12y ago[deleted]
- pavel_lishin 12y agoIf you install coreutils (`brew install coreutils`), you can cut that down a bit: gshuf /usr/share/dict/words | head -n 10 | awk '{print $1 "! "}' | say
- zimpenfish 12y agoI used `say` to read out the cricket scores from a screenscraping bot whilst the TV (which was the radio at the time) was in use for games. Not quite TMS but it had a certain charm.
- pavel_lishin 12y agoWhenever I had to run something that would take awhile, I would append '; say "YOUR THING IS DONE"' to the end so I'd be aware of when it finished.
- allavia88 12y agoThere's been a few of these lists over the past few years, most recent one is https://news.ycombinator.com/item?id=7494100 https://news.ycombinator.com/item?id=7494100 It seems like a large portion of HN is less experienced re sysadmin, but is interested in it nonetheless. Perhaps there's room to make a 'codecademy for unix' type course? Curious to see what folks thing.
- mitchchn 12y agoIt does feel I'm retreading ground that's already been covered too many times, but my whole motivation for this blog was more or less what you're observing. There's a huge group of people on the fringes of hacker culture who are looking for a way in and don't know where to start. Definitely a fan of the idea of 'Nixacademy.
- huskyr 12y agoAwesome. I knew about `pbcopy`, but i never knew you could also pipe stuff into it. That saves a lot of time saving script outputs to temporary text files and copying!
- Touche 12y agoalias copyssh="cat ~/.ssh/id_rsa.pub | pbcopy"
- theOnliest 12y agoOr without the extraneous cat: "pbcopy < ~/.ssh/id_rsa.pub"
- Touche 12y agoAh yes, thanks, I always forget about <
- archagon 12y agoGreat list! Includes all the old favorites with clear explanations. This is only tangentially related, but I recently wrote a little Automator Service to gather any selected file and folder paths from Finder. I very often need to grab the path of something for programming-related stuff, and doing it from the command line or with the mini-icon drag-and-drop takes way too long. Maybe somebody here will find it useful! http://cl.ly/1a3s3g1u2Q2w http://cl.ly/1a3s3g1u2Q2w
- CGudapati 12y agoDefinitely useful. Thanks !
- mmaldacker 12y agono love for macport?
- riffraff 12y agoI'm a happy macports user, never had any issues with it especially after having set +no_x11 in the default variants :). The only bad thing about it that "port upgrade outdated" must be used carefully, but that is probably true of most port-like systems.
- archagon 12y agoMy understanding is that macports is a lot more finicky and hacky, especially when it comes to built-in dependencies. homebrew is specifically designed to avoid such problems.
- gradstudent 12y agoCan you be more specific? macports works wonderfully for me.
- twic 12y agoMy understanding is quite the opposite. There are a number of trivial differences between MacPorts and Homebrew - for example, MacPorts recipes are written in Tcl, Homebrew's are written in Ruby, MacPorts puts things in /opt/local, Homebrew puts things in /usr/local/Cellar, MacPorts gets its metadata with rsync, Homebrew uses Git. But there is, as far as i know, only one non-trivial difference: MacPorts links everything against versions of libraries that it has installed, whereas Homebrew links them against the ones supplied by Apple. The Homebrew maintainers think that linking against Apple's libraries is better, because you need to install less stuff. The MacPorts maintainers used to agree, several years ago, and used to do just that. Then, Apple released a software update which changed some libraries and broke everyone's MacPorts installations. So then they changed their mind. Now, they think that linking against their own, coherently managed, set of libraries is better, because Apple can't break stuff. To me, Homebrew just looks like an exercise in reproducing others' work without learning from their experiences. I don't see any advantages to it myself. Less fundamentally, there's also quite a difference in the number of packages. MacPorts's homepage indicates that they have 18530 ports. An ls|wc in Homebrew's repository indicates that they have 2802 formulae. That said, i suspect that 95% of what people actually need is in the collection that Homebrew has.
- _jsn 12y agomdfind / Spotlight can be a fairly powerful tool. Consider this query, which finds all Xcode projects I've tagged as "Active": ~$ mdfind tag:Active kind:xcode /Users/jn/Code/xyz/xyz.xcodeproj ... Queries like this also work in the Cmd-Space UI, or as a Saved Search. By default each term is joined with AND, but you can specify OR too.
- eschaton 12y agoWhat always surprises me is that so many don't know or use the directory stack commands, pushd and popd. I'll admit I was also ignorant of them until something like 2005, but once I learned of them I switched and never looked back. Now I can't see someone write or type "cd" without a little bit of a cringe.
- sigterm 12y agouhh... I have known pushd and popd for quite a long time, but never realized that pushd can be used in place of cd. So what I have been doing all the time is: pushd . cd some_dir
- pling 12y agoI've been using Unix machines and pushd since the mid 1990s and just learned this as well. All those wasted years... Some examples here: http://en.wikipedia.org/wiki/Pushd_and_popd http://en.wikipedia.org/wiki/Pushd_and_popd Edit: change to desktop Wikipedia URL.
- archagon 12y agoIt's nice to alias them to something shorter. Mine are set to "pd" and "qd".
- ggreer 12y agoMany people love them, but I never got the hang of pushd and popd. These days, I use a CDPATH and z[1]. I also use zsh, which supports handy little things such as cd - (cd to previous directory). If you haven't tried it, I highly recommend z. It's impossible to Google for, but it's oh-so-convenient. 1. https://github.com/rupa/z https://github.com/rupa/z
- bronson 12y ago'cd -' is implemented by the cd command using the OLDPWD environment variable. It works in all shells.
- nmc 12y ago/usr/local is the default location for user-installed stuff, but I personally like to have my package manager do its stuff in a separate directory. I like the way Fink [1] uses the /sw (software) directory. Does anyone have a valuable opinion on the comparison between Fink and Homebrew — or maybe MacPorts? [1] http://www.finkproject.org http://www.finkproject.org
- deleted 12y ago[deleted]
- rwg 12y ago/usr/local is a wasteland on OS X. Package installers love to dump stuff in there blindly. This leads to fun-to-debug problems where two different things are overwriting files in there and blowing up because of version mismatch problems. I ended up making a /rr tree ("rwg's root"), building things I care about from scratch, and using GNU stow to manage it.
- scott_karana 12y agoHomebrew actually uses /usr/local/Cellar for all its installations, and then makes symlinks in the relevant /usr/local/{bin,sbin} directories. Not sure if that's what you meant.
- nmc 12y agoThanks for the clarification. Still, a quick Google search seems to indicate that this does not solve all related problems (symlinking, overriding, etc.).
- quarterto 12y agoBrew does refuse to link anything that would collide, and it knows to not link e.g. gettext, as a lot of Mac programs rely on BSD gettext
- jperkin 12y agoI work on pkgsrc which is another alternative. Its main advantages are: * A large number of pre-built binary packages with an apt-get style command (pkgin) to install them. Over 10,000 packages are available for OSX in the most recent release (2014Q1). * It is cross-platform to over 20 different platforms. At Joyent we provide binary packages for SmartOS/illumos, OSX, and Linux, so you can use identical packaging tools across multiple platforms, rather than having to use different tools on each OS. It is the default package manager on SmartOS, with over 12,000 binary packages available for that platform. * As the 'src' in 'pkgsrc' implies, it's very easy to build from source too if you want to tweak build options or compiler flags. You can also install into any prefix you desire (we default to /usr/pkg), even as an unprivileged user to your home directory. Our binary packages are available from http://pkgsrc.joyent.com/installing.html http://pkgsrc.joyent.com/installing.html and we'd love to hear feedback on how to improve them or adding support for different platforms.
- pling 12y agoAnother one that I can't live without: ssh-add -k keyfile Integrates with keychain meaning you can have a passworded private key without having to play around with ssh-agent and shells and profiles. Put keychain access in the menu bar and you can lock the keychain on demand as well. Integration of ssh into the OSX workflow is absolutely awesome. That and some of the examples in that article really make it a killer platform for Unix bits.
- vladharbuz 12y agoThe screencapture options are wrong. "Select a window using your mouse, then capture its contents without the window’s drop shadow and copy the image to the clipboard: $ screencapture -c W" -c captures the cursor, W is not an option. The real command for this is: $ screencapture -C -o
- mitchchn 12y agoIt was a typo, but it was supposed to be the -W flag not -o. Fixed now.
- greggman 12y agoThese are awesome. I didn't know about many of them. One tiny thing though, at the bottom it says > Recall that OS X apps are not true executables, but actually special directories (bundles) with the extension .app. open is the only way to launch these programs from the command line. Actually, you can launch them in other ways. Example /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/Users/<username>/temp/delmechrome --no-first-run Will start a new instance of Chrome with it's own datastore in ~/temp/delmechrome. add some URL to the end to have it auto launch some webpage. Delete ~/temp/delmechrome to start over.
- _jsn 12y agoAlthough this technically works, in some cases it may lead to strange bits of misbehavior. (Depending on where you do it, the app may end up in the wrong audit session or mach namespace, and it may also be missing some environment variables that it was expecting). The open command does allow you to specify command-line arguments to pass to the application (via --args), which is generally a safer way to do things.
- TazeTSchnitzel 12y agoSome apps will break entirely.
- veidr 12y agoBut the open command doesn't allow you to pass the environment, and Apple seems hellbent on breaking every workaround they've implemented over the years (e.g. ~/.MacOSX/environment.plist). So, doing Foo.app/Contents/MacOS/Foo is often the only way to launch a GUI app while inheriting the full environment that you have on the command line. I often have to do this to launch various developer tools, and have them be able to inherent important environment variables, e.g. database credentials or secrets,
- micampe 12y ago> But the open command doesn't allow you to pass the environment Uh? I’ve been using open to pass NSZombieEnabled and other debugging stuff to apps all the time and it works. From man open(1): Opened applications inherit environment variables just as if you had launched the application directly through its full path. This behavior was also present in Tiger.
- RazerM 12y agoIt seems odd to have open /Applications/Safari.app/ as an example, when open -a safari does the same thing.
- kranner 12y agoExcept that the first one is supported by TAB-completion.
- cobbal 12y agoWith the right zsh plugin, either of them will tab complete properly. (I think "osx" from oh-my-zsh is the one that does it on mine) Edit: looks like this is actually built into zsh. Slightly surprised, but just goes to show I know almost nothing about the shell I use every day.
- kranner 12y agoYes but I use the default bash, as do probably most OS X users.
- ch4s3 12y agoCheck out Alfred[1] it supports tab completion. [1]http://www.alfredapp.com/ http://www.alfredapp.com/
- lastofus 12y agoIt's hard to beat cmd+space safari
- interpol_p 12y agoAgree, but it's actually more like: cmd+space sa <return> For most people. Because it seems to prioritise based on frequency of past selection.
- fphilipe 12y agoThe -a flag is also great to open a file in a specific app, e.g. `open -a Safari logo.svg` or `open -a Marked README.md`.
- chrismorgan 12y agoI don’t use a Mac, but have used espeak-via-ssh to deliver a message to my sister who was near my laptop, from the comfort of my bed… I could have (a) called out, or (b) gotten up, but where would the fun have been in that?
- barbs 12y agoI use multiple POSIX environments (OS X at work, Linux Mint and Xubuntu at home), and I find it handy to create common aliases for differently implemented commands to keep the environments consistent. For example, I set the letter 'o' as an alias for 'open' on OS X, and to "thunar" on Xubuntu and "nemo" on Linux Mint.
- lastofus 12y agoThe article doesn't mention the fun you can have with ssh + say. My co-workers and I used to ssh into the iMacs of non-technical users in our office and have a good laugh from a nearby room.
- mitchchn 12y agoIt does mention that. Read again :)
- ggreer 12y agoI didn't know about `screencapture`. That's a fun one. The Linux equivalent of `open` is `xdg-open`. I usually alias it to `op`, since `/bin/open` exists. Another bit of terminal-sugar for OS X users: alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend' And most Linux users: alias lock='gnome-screensaver-command -l' If you find yourself accidentally triggering hot corners, the lock command is your savior. I've sorta-documented this stuff over the years, but only for my own memory. https://gist.github.com/ggreer/3251885 https://gist.github.com/ggreer/3251885 contains some of my notes for what I do with a clean install of OS X. Some of the utility links are dated, but fixing the animation times really improves my quality of life.
- rimantas 12y agocmd+shift+eject
- X-Istence 12y agoCtrl + Shift + Eject or Ctrl + Shift + Power (on MacBook Pro's that don't have an eject key) Cmd + Shift + Eject doesn't do anything.
- AdamGibbins 12y agoThis sleeps/suspends rather than just locking. Equivalent to closing your MacBook.
- oneeyedpigeon 12y agoDoesn't change the fact that cmd+shift+eject doesn't actually do anything (unless it's on an older version of OSX)
- X-Istence 12y agoIf you have your Mac set to never sleep/are using Caffeine for instance, then it simply puts the display to sleep, the rest of the computer keeps on humming along. Not entirely equivalent to closing your MacBook.
- torrent-of-ions 12y agoAnother thing you can do to improve speed is learn the keybindings for readline. They are the same keybindings as emacs, and lots of other things use readline too like python shell, sqlite, etc. A very useful set of keys to have in your muscle memory. See the readline manual: http://tiswww.case.edu/php/chet/readline/rluserman.html#SEC3 http://tiswww.case.edu/php/chet/readline/rluserman.html#SEC3
- shawndumas 12y agoif your a vi/vim user in you're .inputrc set: set editing-mode vi set keymap vi-command see more settings @ https://github.com/shawndumas/dotfiles/blob/master/readline/.inputrc https://github.com/shawndumas/dotfiles/blob/master/readline/...
- cerberusss 12y agoThis won't work for some standard stuff that OS X ships with, for instance Python (when started as a command-line interpreter). That's because .inputrc is read by the GNU readline utilities, and Apple links with the BSD equivalent. To make this work for Python: Add a file called .editrc with the following content: bind -v Add a file called .pythonrc with the following lines: import rlcompleter import readline Add a line to your .bashrc which makes Python run .pythonrc when it starts interactively: export PYTHONSTARTUP="$HOME/.pythonrc" Now Python will understand your vi keystrokes :-)
- cstross 12y agoOne command I can't live without: textutil. Basically it's a command-line front end to Apple's TextKit file import/export library. Works with a bunch of rich text/word processor formats, including OpenDoc, RTF, HTML 5, and MS Word. Critically, the HTML it emits is vastly better than the bloated crap that comes out of Microsoft Word or LibreOffice when you save as HTML ... Install pandoc and multimarkdown as well and you've got the three pillars of a powerful, easy-to-use multiformat text processing system.
- mitchchn 12y agoPandoc and multimarkdown are the greatest. I've never found a way to fit textutil into that workflow, though. Is there anything it can do that pandoc can't by itself?
- cstross 12y agoTextutil handles a couple of apple-specific file formats (rtfd, webarchive) that do an embrace-and-extend on open(ish) standards. (Annoyingly it doesn't provide a way to get at the guts of Apple's own Pages files. Which sucks because the only tools for transcoding Pages are Pages itself, and icloud.com.)
- mitchchn 12y agoThanks! I played with this last night and wrote about it in my followup: http://www.mitchchn.me/2014/and-eight-hundred-more/ http://www.mitchchn.me/2014/and-eight-hundred-more/
- hibbelig 12y agoI want "remote pbcopy"! I'd like to be able to log in to any remote host (usually Linux in my case), then tack something onto the command line I'm typing to copy it into the pastebuffer. ssh somehost cd /some/dir grep -lr foo . | remote_pbcopy I guess something like this is possible with GNU Screen or with Tmux, and perhaps the Tmux/iTerm interaction helps, but I've never figured it out.
- pikachu_is_cool 12y agoOn your Mac: ssh -R 19999:localhost:22 remote_host On the remote host: command_that_prints_stuff | ssh localhost -p 19999 pbcopy ________ The first command routes the port 19999 on the remote host to port 22 on the computer you're using. ssh part on the second command connects to 19999 (and thus 22 on your computer) and runs the pbcopy command in the current shell (which is the pipe from command_that_prints_stuff)
- hibbelig 12y agoThat's cool. Thanks!
- rasur 12y agoYou could probably squash the 'ssh localhost -p 19999 pbcopy' into an alias too, to reduce the typing further. EDIT: oh wait.. remote host.. ok, maybe, maybe not. depends on your environments I guess.
- enneff 12y agoWhy not just ssh remote_host command_that_prints_stuff | pbcopy ?
- pikachu_is_cool 12y agoDepends on the situation, if you want to run a quick script then yours would be better. If you're spending a lot of time in remote_host then mine might make more sense.
- 12y ago
- deleted 12y ago[deleted]
- Monkeyget 12y agoThis was supposed to be few lines of remarks. It expanded quickly in relation with my enthusiasm for this topic. I've been investing some time in the command line on my Mac. I am moving from a dilettante going to the shell on a per-need basis to a more seasoned terminal native. It pays off handesomely! It's hard to convey how nice it to have to have a keyboard-based unified environment instead of a series of disjoined mouse-based GUI experiences. Here are some recommendations pertaining to mastering the command line on a Mac specifically: -You can make the terminal start instantaneously instead of it taking several seconds. Remove the .asl files in /private/var/log/asl/. Also remove the file /users/<username>/Library/Preferences/com.apple.terminal.plist - Install iterm2. It possesses many fancy features but honestly I hardly ever use them. The main reason to use it instead of the default Terminal application is that It just works©. -Make your terminal look gorgeous. It may sound superficial but it actually is important when you spend expanded period of time in the terminal. You go from this http://i.imgur.com/cx3zZL8.png http://i.imgur.com/cx3zZL8.png to this http://i.imgur.com/MQbx8yK.png http://i.imgur.com/MQbx8yK.png . You become eager to go to your terminal instead of reluctant. Pick a nice color scheme https://code.google.com/p/iterm2/wiki/ColorGallery https://code.google.com/p/iterm2/wiki/ColorGallery . Use a nice font (Monaco, Source Code Pro, Inconsolata are popular). Make it anti aliased. -Go fullscreen. Not so much for the real estate but for the mental switch. Fullscreen mode is a way to immerse yourself into your productive development world. No browser, no mail, no application notification. Only code. -Install Alfred. It's the command line for the GUI/Apple part of your system. Since I installed it I stopped using the dock and Spotlight. Press ⌘+space then type what you want and it comes up. In just a few keystrokes you can open an application, open gmail/twitter/imdb/..., make a webs search, find a file (by name, by text content), open a directory,... It's difficult to describe how empowering it is to being able to go from 'I want to check something out in the directory x which is somewhere deep deep in my dev folders' to having it displayed in 2 seconds flat. -Make a few symlinks from your home directory to the directories you use frequently. Instead of doing cd this/that/code/python/project/ you just do cd ~/project. -Learn the shell. I recommend the (free) book The Linux Command Line: http://linuxcommand.org/tlcl.php http://linuxcommand.org/tlcl.php . It guides you gently from simple directory navigation all the way up to shell scripting. -Use tmux. Essential if you want to spend some time in the terminal. You can split the window in multiple independent panes. Your screen will have multiple terminals displayed simultaneously that you can edit independently. For example I'll have the code in one side and on the other side a REPL or a browser. You can also have multiple windows each with its own set of panes and switch from on to the other. With the multiple windows I can switch from one aspect of a project to another instantly. E.g: one window for the front-end dev, a second one for the backend and another for misc file management/git/whatever. -Pick an editor and work towards mastery. I don't care if you choose vi or emacs. You'll be surprised how simple features can make a big change in how you type. You'll be even more surprised at how good it feels The terminal is here to stay. It's a skill that bears a lot of fruits and that deprecate slowly. The more you sow the more you reap.
- guard-of-terra 12y agoI wonder if it's possible to make OS X to say "As you request, Stan" in Lexx's voice. That alone might be sufficient reason to migrate from ubuntu.
- cerberusss 12y ago+1 for the reference!
- smw 12y agoPut this in your path somewhere, find files, links, directories instantly, with globbing. Makes mdfind actually useful. $ mdf "*invoice*.pdf" /Users/smw/Downloads/Invoice-0000006.pdf https://gist.github.com/smw/a21a9f675ed3358830da https://gist.github.com/smw/a21a9f675ed3358830da
- cormullion 12y agoIf you work with images a lot, look up sips. I use it a lot, for converting images, rescaling and resizing, etc.
- conradev 12y agoThe one utility I can't live without is caffeinate, which prevents a Mac from sleeping. It's super useful for keeping long running tasks running.
- pirateking 12y agoAfter years of living on the command line, OS X specifically, and learning its quirks and tricks, I am actually ready to move on. Right now I am more interested in creating simple visual interfaces on top of UNIX-y tools, for my own personal use cases. The main benefit of this is the ability to better experiment with and optimize my workflows for different properties as needed through different combinations of single responsibility interfaces and single responsibility programs. I am sensing that there is great promise in seeing much higher APMs (actions per minute) for many tasks, even compared to the all-powerful command line. Also, there are lots of interesting possibilities for better visual representations of data to improve comprehension and usability.
- twic 12y agoWhy do you think that having a visual interface will make it easier to experiment with your workflow? This is a genuine question - personally, i find command line interfaces to be far more hackable than graphical ones, so i would expect the opposite to be true, and hence i'm interested in your perspective.
- silverlake 12y agoNot the parent, but personally I can't remember the huge list of available Unix commands. Every time I want to do something outside my normal workflow, I end up in google. For me, "Google + man page + command line" is slower than a nice GUI optimized for specific tasks. The hard part is designing this mythical nice GUI.
- pirateking 12y agoThe command line is a textual interface, and both code and data can be represented as text at a low level. It would seem that this is a good thing for efficiency and usability, as it minimizes context switching between interface paradigms, and offers direct access to a low level representation of the system using a high bandwidth input device (a keyboard). I still think textual interfaces are a great thing for those reasons, but I don't believe they are the best thing in many cases. Yes, they are very capable and customizable, but have serious weaknesses with usability, especially when working with data of higher dimension. I don't really think of it as text versus graphics, but rather an issue of data being represented in its best form for doing some particular work with it, and having the best interfaces to those different forms and the work. The traditional one-domain/one-application GUI model is unsustainable for this purpose, and has the weakness of constant context shifting. Composable visual interfaces are an anti-application paradigm, and more focused on data flow. To avoid problems with pure visual programming environments, symbols would still be considered the best representation for certain work (like editing text and working with logic).
- wink 12y ago'open' is on of the things I long for most as a Linux user. There are several ways to achieve something that are all inferior or downright broken. Usually you don't have a huge problem, until you have. xdg-open for example could've solved this, if it was universally working. I wrote related rant once[0] when I tried to debug an issue of a misconfigured default browser. [0]: http://f5n.org/blog/2013/default-browser-linux/ http://f5n.org/blog/2013/default-browser-linux/
- reedlaw 12y agoxdg-open works for me with the GNOME-configured default application.
- JasonFruit 12y agoWhile xdg-open also works well for me with KDE's default applications, when I used to use Openbox or LXDE, it was much less successful. The breadth of the group of tools that respond correctly to KDE settings as opposed to the less-common environments has been one of the reasons I've been so happy to switch.
- ktf 12y agoAlso works great in XFCE, in my experience.
- reledi 12y agoThe fish shell [1] gives you an open command on Linux. Really it's just a function that calls cygstart, xdg-open, or mimedb. It's incredibly handy. 1: http://fishshell.com http://fishshell.com
- js2 12y agoTwo more for you: sips - https://developer.apple.com/library/Mac/documentation/Darwin/Reference/ManPages/man1/sips.1.html https://developer.apple.com/library/Mac/documentation/Darwin... osascript - https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/osascript.1.html https://developer.apple.com/library/mac/documentation/Darwin...
- ansimionescu 12y agoAdditions: * lunchy: wrapper over launchctl, written in Ruby – https://github.com/mperham/lunchy https://github.com/mperham/lunchy * brew cask: "«To install, drag this icon...» no more", as they say – https://github.com/caskroom/homebrew-cask https://github.com/caskroom/homebrew-cask * have fun with "say" – https://github.com/andreis/different https://github.com/andreis/different
- xraystyle 12y agoSpeaking of fun with "say", this was a hit around my office for a while: https://github.com/xraystyle/talking-computer https://github.com/xraystyle/talking-computer
- DCKing 12y agoCould you imagine Apple would have gone for BeOS or a custom developed kernel with no significant terminal-based userland when making OS X? It would probably still be used by many casual users or those doing graphical work, but I doubt it would be used by hackers at all.
- TazeTSchnitzel 12y agoI believe they considered Windows NT at one point. Can you imagine using NT's fake DOS terminal? Ugh.
- tvon 12y agoI suspect the GNU toolchain would have been ported over at some point.
- 0x0 12y agoDidn't BeOS ship with bash and everything?
- DCKing 12y agoWhoops. Yes it did. Haiku still does: http://www.haiku-os.org/docs/userguide/en/bash-scripting.html http://www.haiku-os.org/docs/userguide/en/bash-scripting.htm...
- jpb0104 12y agoHere is a very handy script that takes a screenshot, places it in Dropbox's public directory, shortens the public URL, then puts the short URL in your clipboard. Making for very quick screenshot sharing. It combines a few of these hints. https://gist.github.com/jpb0104/1051544 https://gist.github.com/jpb0104/1051544
- chrisBob 12y agoThe biggest change I have found for my terminal was adding this to my .bash_profile: export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced I thought that was one of the most amazing things when I used a linux system, but OS X is black and white by default.
- tvon 12y ago`ls -G` will show colors with BSD ls, much like `ls --color' with GNU ls.
- runjake 12y ago9. /usr/sbin/system_profiler 10. /System/Library/CoreServices/Applications/Wireless Diagnostics (with built-in wifi stumbler) 11. /System/Library/CoreServices/Screen Sharing.app (Built-in VNC client with hardware acceleration) 12. /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources (Command-line wifi configuration and monitoring tool) Combine with sed, awk, and cut, and these tools can provide useful monitoring.
- salgernon 12y agopbpaste and pbcopy can specify multiple clipboards; one very handy thing I do is "cmd-a" "cmd-c" (copy all) double click on a word I'm looking for, "cmd-e" to enter it into the find clipboard 'pbpaste | fgrep --color `pbpaste -pboard find`' I have that aliased as 'pbg'.
- archagon 12y agoAaaaand I just learned about Cmd-E and Cmd-J. Love all the little useful shortcuts OSX has. :)
- gotofritz 12y agoAlso worth mentioning is dotfiles (not specific to OS X). Basically various well known "power users" share their bash, homebrew, etc settings on github so that they can easily set up a new machine with minimum of fuss. There are a lot of neat trick in those boilerplate files. http://dotfiles.github.io/ http://dotfiles.github.io/
- fuzzywalrus 12y agoNotably the screen capture terminal command, while neat, is sold as "more flexible". I think the author is unaware of Command+shift+4 followed by tapping the spacebar. It'll give you the window capture. Otherwise good article.
- wilmoore 12y agoIf you have Cloudup installed, that command sequence will also upload the screenshot automatically. https://cloudup.com/about https://cloudup.com/about
- stretchwithme 12y agoThe hot keys for screen capture are more useful for daily use. You can paste what you've capture directly into most email clients. Or go to Preview where creating a new file uses what's on your clipboard if its an image.
- nicksergeant 12y agoWhy the hell would someone change the title from "Eight Terminal Utilities Every OS X Command Line User Should Know" to "OS X Command Line Utilities". The original title is clearly more accurate / useful / canonical. The overwritten title is ambiguous. This is indeed not a list of every OS X command line utility.
- Karunamon 12y agoHN has a blurb in the guidelines about "number (rest of the title)" articles being rewritten. Never understood it or the reason why, but there you go.
- dang 12y agoI changed it. The HN guidelines call for taking linkbait out of titles ("every user should know") and for not having arbitrary numbers in titles—which are also a form of linkbait. Taking those things out as well as the redundancies (terminal/command-line, utilities/users) yields something pretty close to "OS X Command Line Utilities". I don't see any ambiguity. The article is precisely about OS X Command Line Utilities; it doesn't matter how many there are in the list. Nor is it misleading. There's no implication of completeness.
- fmela 12y agoThe '-name' argument of mdfind makes it useful to find files with the query string in the name. E.g.: "$ mdfind -name resume".
- RexRollman 12y agoPersonally, I was surprised that there is not a command line interface to OS X's Notification system. Seems like it would be handy for long running batch jobs.
- pdx6 12y agoInstall this: https://github.com/alloy/terminal-notifier https://github.com/alloy/terminal-notifier Add this to your .bashrc: function notify { terminal-notifier -title "$1" -message "$2" }
- RexRollman 12y agoInterest. Thank you.
- shurcooL 12y agoIf you do Go development, you can do this to quickly get to root folder of any Go package: function gocd { cd `go list -f '{{.Dir}}' $1` } It uses the same syntax as go list to specify packages, so you can do, e.g.: ~ $ gocd .../markdownfmt markdownfmt $ pwd /Users/Dmitri/Dropbox/Work/2013/GoLand/src/github.com/shurcooL/markdownfmt markdownfmt $ _ So nice.
- hackeroni 12y agoThanks for sharing