Mac OS X Terminal Tips


1. Go to beginning of the current line

Ctrl + A

2. Go to the end of the current line

Ctrl + E

3. Copy the current path

$ pwd | pbcopy

4. Clear the screen [same as clear]

Ctrl + L

5. Display all the environment variables

$ env

6. Deleting from current position to the end of the line

Ctrl + K

7. Deleting from current position to the beginning of the line

Ctrl + U

8. Deleting the first word before current position

Ctrl + W

9. Move the cursor a letter back from the current position

Ctrl + B

10. Move the cursor a letter forward from the current position

Ctrl + F

11. Open current location in Finder window

$ open .

12. Open a file with unknown extension with the default editor

$ open -t file.ext

13. Watch a particular file to see who's opening it

sudo opensnoop -f PathToTheFile

14. Text-to-speech

say "HI"

15. Runs the last command again
!!

16. Hold option and click a position in the current line to move your cursor to that position.

17. List all possible commands
Hit and hold ESC