z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Using file name completion

z/OS UNIX System Services User's Guide
SA23-2279-00

Tip: File name completion requires the use of the TAB key. This key must be mapped correctly for the feature to work. Most connections through telnet and rlogin will transmit the TAB information correctly. If you are connected in any other manner, this feature may not work correctly.

The tcsh shell provides a time saving feature for completing file names. Rather than having to type out the entire string to access a file or execute a program, you can type just the first letter or letters and let the shell help you with the rest.

For example, if you have a file called phonebook, and you want to list the contents of this file on the screen with the more command, you can do so by typing the command, the first letter or letters of the file, and then pressing the TAB key. For example, if you type:
more ph
and then press the TAB key, the shell will provide you with:
more phonebook

you can then press ENTER and execute the command.

If you have more than one file name that matches the letter or letters you have typed, the shell will alert you with a beep. For example, if you have three files, called list1, list2, and list3, and you type:

more li

and press TAB, the beep will sound, and the shell will complete the file name as far as it can:

more list

you must then type 1, 2, or 3 and press ENTER.

If you are unsure of how many files there are, or which one you want, you can type <CRTL-D> when the shell beeps, and you will be provided with matching names. For example:
> more list           
list1   list2  list3 
> more list           

Underneath the matching names the command prompt is displayed again. Now you can enter the number that you wish and then press ENTER.

If there are no matches for the letter or letters you have typed, the shell will beep, but when you press <CRTL-D>, nothing will be displayed.

You can also use file name completion to aid in changing between directories with long paths. If you keep files in the directory stuff/data/graphics, it is easier to use file name completion to access the directory than to type the entire path by hand. For example, if you are in your home directory, and stuff is a subdirectory containing data/graphics, and you want to change into that directory, you can do the following:
cd s     [TAB]
cd stuff/.
cd stuff/d   [TAB]
cd stuff/data
cd stuff/data/g   [TAB]
cd stuff/data/graphics
then press ENTER, and the directory change command will execute.

You can find more information about file name completion in z/OS UNIX System Services Command Reference.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014