Stupid Terminal Tricks
June 29th, 2007
When working with a mac or linux there are definitely some useful command line shortcuts worth knowing. Trying to shed a little light on the terminal without overwhelming your average GUI user! Start using the terminal today.
Useful stuff when you are using the terminal
If you ssh into a box regularly you may get tired of typing in the url or IP address so just create a file name in your home directory with the url name ie:
touch somewhere.somesite.url.com
then when you want to use it just start typing ssh som{tab} and it auto completes.
up arrow
I suppose you know that the up arrow will get your previous command, if not then then that is another useful command. However you can also hit ctrl-a to go to the beginning of a line.
ctrl-a
So if you are like me and forget to sudo a command then just press up then hit ctrl-a.
simlinks
Simlinks are your friend, especially if you build websites. This means that you don't actually have to worry about where you put some web root. Just create simlinks in your home dir wherever you need to navigate often. For example I created a simlink off of my root for /home to point to my user directory. This wont work on most flavors of nix since it uses a "/home/username" format but, for mac users it is nice.
ln -s /path/to/the/real/directory /virtual/directory
vi/vim is your friend
You may hate vi/vim but, it is really useful if you ssh into a box. here are some quick hints for using vim (edit a file type vi filename)
searching:
/thesearchstring
inserting text:
Arrow to your line, hit "i" (lowercase) start typing
appending text:
Navigate to the character that you want to insert after and hit "a" lowercase.
deleteing text
Navigate to the character you want to delete hit "x"
deleting a line
Navigate to the line and hit "dd"
save and exit
shift-zz
Sorry, comments are closed for this article.