Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Type Faster in Terminal UNIX
Terminal is a great app to get around your filesystem but it gets to be a pain in the hands to type those long pathnames. Here's some quick tips on typing paths or filenames in terminal.

1. If you want to get to your home directory quickly, just type ~ and hit return. You will be at the root level of you're home directory. Note if you are su'd as root you'll go to root home dir.

2. When type paths or file names, start typing the path and hit tab. Your Terminal (shell) will complete the word for you. If nothing appears to happen, hit tab again and shell will give you all the words in that path that have the partial of what you typed.Start typing again till you are past the uniqueness of the word and hit tab to finish typing the word for you. A little practice and you can navigate the CLI faster than point and clicking.

See the rest of this article for some additional examples and comments.

Examples: Note that the "%" is a prompt; you do NOT have to type it in!
% cd /et (hit tab and next line is the results)
% cd /etc/

% ls /et (tab) ho (tab)
You'll get a listing of files and directories that begin with ho. If this case your'e shell will look like this:

hostconfig hostconfig.old hosts hosts.equiv hosts.lpd

% ls /etc/ho
This is handy if you want to know whats in a directory or run a program w/o having to cd into the directory.

This will also save you time by checking if you have a directory or file typed correctly. Remember all files and dirs are case-sensitive in *nix. If after hitting tab a couple times and nothing appears, you're file or path is mispelled.

Sources: These are common *nix hints. They can be found out by playing with a shell program or reading any of the zillion *nix books out there.
  • Currently 3.00 / 5
  You rated: 2 / 5 (3 votes cast)

Type Faster in Terminal | 5 comments | Create New Account
Click here to return to the 'Type Faster in Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Going home...
Authored by: tapella on May 12, '01 02:34:41AM

You can also change to your home directory by using the 'cd' command with no arguments. Just 'cd'. To go to a different user's home directory you can use the tilde (~) and their username, for example:
cd ~tapella

...would bring you to user tapella's home directory. This is usually useful for copying something from someone else's directory, as in "yourfriend: just grab from my bin directory". You:
cp ~yourfriend/bin/ ~/bin
(This copies the file into your own bin directory and keeps its name as

[ Reply to This | # ]
Authored by: marcelv on May 12, '01 08:22:06AM

These are in fact aliases. You can create them yourself too.

When you type 'alias' in the terminal you get to see the aliases that are already defined.

When you want to create them yourself you can create a file in ~/Library/init/tcsh/aliases.mine
When it don't excists, you can create the directories and file.

When you do a search for "aliases" on this site you can find an article about it, with more info.


[ Reply to This | # ]
oter quick navigation tricks
Authored by: swessels on May 13, '01 09:37:54AM

An old UNIX trick works too. Just type enough of the target directory or file name and then an * and it will match it for you.

For example:
cd ~
cd Do*
will navigate you to the Documents directory.

[ Reply to This | # ]
Authored by: Anonymous on May 22, '01 04:25:31PM

Interestingly, OS X's unix file names are not case sensitive (unlike most unix's - because of the HFS+ file system). However, "autocomplete" from the command line *is* case sensitive. So, if you have a directory named "FoO", "cd foo" will work, but "cd "f (tab)" will not find FoO. "cd F (tab)" will work. atleast this is the case for bash, not sure about tcsh.

Also in bash, typing esc-period will substitute the last command argument given, which is very useful, and esc-R will search for a pattern in the history list. esc-esc is the same as tab.

There are lots of other shortcuts. BTW, you can download bash 2.0.5 precompiled for OSX here:

[ Reply to This | # ]
Type Faster in Terminal
Authored by: fdiv_bug on Jun 05, '04 09:53:41PM

You can disable the case-sensitivity of bash's tab completion by adding the following to a file called .inputrc in your home directory (~/.inputrc):

set completion-ignore-case on

The next time you open a new Terminal window you'll have tab completion that cares not about case.

[ Reply to This | # ]