|
Several command-line features assist you with entering commands. For instance, wildcards are available, the same wildcards that you can use with Windows. The asterisk (*) can be substituted for a string of characters and a question mark (?) can be substituted for a single character. Thus, the following command lists all filenames that include var and end with a single character: ls *var? xvar1 Study_varA File and directory names are completed for you when you press the Tab key. As soon as you have typed enough of the name so that it refers to only one file, press the Tab and the remainder of the filename is filled in on the command line. The shell stores a history of the commands you enter. You can see it by typing history, which lists the commands, adding a line number at the start of each line. You can repeat commands using commands that begin with an exclamation point:
You can also repeat a command using the up-arrow key. Each time you press <up arrow>, the previous command displays. Continue to press <up arrow> until you reach the command you want to repeat. You can edit the previous command and reenter it using ^old^new. The following command will replace string1 with string2 in the first command that just executed: srot test.txt ^ro^or As shown, you accidentally typed srot, when you meant to type sort. The second line tells the shell to re-enter the command, changing ro to or. |
|