graphics\overbutt.gifUsing command line completion and command history

You can complete commands or filenames using TAB. Command completion helps when you forget the name of a command, and saves keystrokes when you have long filenames. For example, to see the contents of a file called longfile, in your working directory, you can type the command and the first few letters of the filename, then press TAB. Bourne Again shell tries to complete the command line for you.

Mabel:~$ more lon<TAB>

The computer beeps if you do not provide bash with enough information to complete the command line. For example, you might have more than one file beginning with the letters lon. If you press TAB a second time, bash fills in as much information as possible and then waits for input. You can type more characters and then press TAB a second time or you can press TAB again to display a list of possible completions for the filename.

The shell keeps a history of commands you enter at the command line. You can reuse or change a previously entered command using the arrow keys. These commands are stored in a history file that initializes each time you log in to your user account.

To use command completion

1. At the command line, type,

<command> <file characters>

2. Press TAB. Press ENTER if bash displays the completion you want to use.

graphics\nicon.gifNotes

To use a command using command history

1. At the command line, press UP ARROW to find a previous command.

2. Press ENTER when the command line displays the command you want to use.

To change a previously used command

1. At the command line, press UP ARROW to find the command to change.

2. Press one of the following keys to locate the command characters you want to change:

3. Type the appropriate changes.

4. Press ENTER when you finish changing the command to execute it.

graphics\nicon.gifNote