Terminal -- OSX Command Line Tips

For discussion of topics specific to MythTV on OSX
Post Reply
User avatar
pvr4me
Senior
Posts: 763
Joined: Fri Feb 07, 2014 7:25 pm
Location: near Toronto, Canada
Contact:
Canada

Terminal -- OSX Command Line Tips

Post by pvr4me »

Have a look at the linked article if you have some familiarity with the command line but want to take it to the next level:

http://furbo.org/2014/09/03/the-terminal/

The article is long and detailed (probably too much for one sitting) but has lots of useful stuff. For example:
Shell Tricks

Once you get your shell setup, it's time to learn some of its most useful tricks.

History

The shell remembers everything you type. With a few simple characters, you can avoid retyping. The first two are !! which repeats the last command entered. I'm ashamed to admit that I do this every time I edit my /etc/hosts file:

Code: Select all

$ vi /etc/hosts
"Oh crap, it's read only."

:q

Code: Select all

$ sudo !!
If you just want to reuse the last item in the command, which is typically a file name, then you can use !$:
Craig
Formerly the MacPorts guy.
Post Reply