Reissue a long command

In Unix, you can use the history command to view a list of the commands that can be reissued. At the shell prompt, enter:

history 

You will then see a list of previous commands that you have entered. For example, you may see something like the following:

1 trn
2 mailx -s "Here's the Usenet file" jjones@foo.com < ucs.news 
3 lynx
4 mv myfile.txt newfile.txt
5 trn
6 history 

To reissue a command in csh, tcsh, or bash, enter ! (the exclamation point) followed by the number of the command you would like to repeat. For example, if you would like to reissue command number 2, you would enter:

!2 

If you are using ksh, enter r followed by a space and the number of the command you would like to repeat. For example, if you would like to reissue command number 2, you would enter:

r 2 

Either of the above methods will work in zsh.

If you are using bash or tcsh, you may be able to scroll through the command history simply by using the up and down arrow keys at the shell prompt. Once you have found the command that you would like to reissue, press Enter to execute it.


kb/linux/reissuelongcommand.txt · Last modified: 2007/08/06 13:14 by akuelbs