This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

You can use open for everything: URLs, images, documents. I use it everyday.
–
oltJul 6 '10 at 14:48

5

As an extension to that: open -a Mail filetosend.ext Creates a new Email with the file attached.
–
SkadeJul 6 '10 at 16:11

1

@Nick Bedford: It's very useful. For example, I use the command line to scp a bunch of files down from the server. Then, I use "open ." to open the current folder up in the finder, where I can easily right-click on a file and say "open in excel".
–
khedronJul 12 '10 at 18:44

1

@Nick Bedford: If you have the folder open in Terminal, open . opens it Finder. It's useful if you want to do something graphical.
–
ShreevatsaRJul 26 '10 at 4:40

In Terminal's Help menu, you can search for man pages. (The first time you do this, it can take a few seconds to index the man page files, so wait a bit for results to appear, but subsequent searches are fast.) It will show man page results in the Help menu search results. Selecting one opens a window displaying the formatted page.

As of Mac OS X Lion 10.7, there are a number of enhancements to man page support:

It now searches all the files in MANPATH (prior to Lion it only searched a fixed set of directories, so, for example, it didn't find any X11 man pages). It doesn't run in a shell, however, so if you want to customize MANPATH you may need to customize man.conf (x-man-page://1/man), or set it in your global environment.

There are commands in the Help menu for opening man pages (Open man Page for Selection) and performing an apropos search (Search in man Pages for Selection). There are corresponding commands in the contextual menu, and there are Services you can enable to perform these lookups from other applications (System Preferences > Keyboard > Keyboard Shortcuts > Services > Open man Page in Terminal / Search man Pages in Terminal).

If there is no selected text, Open man Page for Selection will automatically look at the text to the left of the cursor. This means you can enter a command name, then use this command to open the man page before entering command arguments. It'll skip over whitespace. It also understands man page references "open(2)" and URLs "x-man-page://2/open". (If you explicitly select text, it also understands "2 open" and "open 2".)

Man page windows use the "Man Page" settings profile. You can customize this to alter the appearance of man pages displayed using these commands. It also remembers the position of man page windows separately from other windows, so you can have man pages appear in the same place on screen each time, independent of where you place other terminal windows.

⌘+ double-click will open man page references "open(2)", enabling you to navigate references from one man page to another. (⌘+ double-click will also open any recognized URL, or even some patterns like email addresses—creates a new mail message—and domain names—opens in Safari.)

As of Mac OS X Lion 10.7, Terminal will open a new window if you drag a folder (or a text pathname) onto the application icon. If you drag to the tab bar of an existing window, it will create a new tab in that window.

You can also do this from the command line or a shell script:

open -a Terminal /some/path/

This is the command-line equivalent of dragging a folder onto the Terminal application icon and will open a new terminal window at "/some/path".

Terminal also now supports Services for opening a terminal at a selected folder (e.g., in Finder) or a text pathname using the contextual menu. You can enable them in

System Preferences > Keyboard > Keyboard Shortcuts > Services

Look for New Terminal at Folder and New Terminal Tab at Folder. You can even assign command keys to them if you like.

Finally, if you drag a folder or pathname onto an existing tab (i.e., the tab in the tab bar) and the foreground process is the shell, it will execute a "cd" command in one step. As in previous versions, dragging a folder onto the terminal display will insert the pathname to the folder.

If you’re like me, you have multiple Terminal.app tabs open at the same time.

Now, if you open three tabs at the same point in time, then enter some commands in each of them, then close them all, the Bash shell that Terminal.app uses only remembers the command history for the last tab that you close. So, the command history from the other two tabs gets lost.

If you don’t want to lose your command history in any tab, add this to your ~/.bash_profile (or any other file that gets sourced when a new Terminal tab is opened):

# Append to the Bash history file, rather than overwriting it
shopt -s histappend

For example, instead of entering cd FooBarBazBax, you can enter cd FooB followed by Tab. Tab completion will work as long as the part of the path or filename you entered isn’t ambiguous.

However, if you were to type cd foob followed by Tab, the completion wouldn’t work, as the folder name starts with an uppercase F. Luckily, you can make tab completion even more useful by making it ignore the filename case.

Add this to your ~/.inputrc file (create the file if you don’t have it already):

# Make Tab autocomplete regardless of filename case
set completion-ignore-case on

This way, cd foob followed by Tab would complete it into cd FooBarBazBax, provided there’s a folder with that name in the current working directory.

A relevant command for Terminal.app on Mac OS X is to launch Software Update from the CLI:

sudo softwareupdate -i -a

The bonus is you do not get any nagging from having to click on windows. I run this as part of a update script that is run every week approximately (so that I do not miss the feedback as it may happen when doing this automatically).

and it will make inactive memory as free again. Mac OS X keeps apps in memory for a while after you close them, so they will open fast if you open them again. Purge will remove them from memory and give your free memory back.

This is not OSX specific (man says it's from 4.0BSD), but I love it anyways:

sudo shutdown -h +45

In the above example, shutdown shuts down your computer in 45 minutes from now (as one might suspect).

It's great for when you want to spend "just a little bit of time" on your computer before going to bed / doing the dishes / going jogging / whatever. But when you also know deep down that it's not going to be "just a little bit of time"...

Quick Look is one of OS X's best features. You just have to press Spacebar in a selected file, and you'll see a preview of that file without having to open up an app. It's great, but you can't select any text when you're in the preview. You can add that feature with a Terminal command: