http://osxdaily.com/2008/06/29/5-useful-mac-os-x-command-line-tips-you-should-know/
Like many other power users, I’m addicted to the Mac OS X command line, any reason at all for me to launch the terminal I take as an opportunity to learn more about the powerful backend of our favorite operating system.
Here I have gathered 5 useful commands that will make your life easier when you’re working in the command line interface of OS X, so launch the Terminal and try them out on your Mac! If you have any others that you think should be added to this list, feel free to post them in the comments, and be sure to check out 10 OS X Command line utilities you might not know about for more.
1: Delete an entire line of commands/text
Don’t repeatedly hit the delete key, all you need to do to clear your prompt is hit Control-U and your current prompt will be clean.
2: Create a nested directory structure immediately
If you need to create the directory structure /annoyingly/long/and/outrageous/directory/path/ , instead of typing mkdir annoyingly, cd annoyingly, mk long , etc etc, simply type the following:
mkdir -p /annoyingly/long/and/outrageous/directory/path/
And your nested directory structure will be created in full immediately!
3: Clear the entire Terminal screen
If you have a screen full of nonsense, clearing the Terminal screen is very easy, you can either type:
clear
Or you can just hit the command keystroke Control-Land you’ll have a clean slate to work with.
4: Run a process in the background
If you want to set a process to run in the background, simply put a & after it, the command will execute but you’ll still be in the same shell, allowing you to continue as usual.
For example:
./crazyscript.sh &
Would run that script in the background, and return you right back to your shell.
5: Run the last executed command
Need to re-run the last executed command? ! is the way to go, here are two ways to use it:
First, just typing:
!!
will run whatever the last command that was executed, typing
!l
will run the last command starting with the letter l, and so forth. Very useful, isn’t it?
No comments:
Post a Comment