![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Repeat last entered command ? | vilius | Shell Programming and Scripting | 5 | 09-25-2007 03:15 AM |
| previous,next command in unix | arulkumar | UNIX for Dummies Questions & Answers | 4 | 09-11-2007 04:34 AM |
| Previous Command | vskr72 | UNIX for Dummies Questions & Answers | 2 | 04-20-2007 08:03 AM |
| Seeing previous command | JackieChan | UNIX for Dummies Questions & Answers | 4 | 06-02-2006 06:35 AM |
| Repeat a command in a shell | scotty | UNIX for Dummies Questions & Answers | 2 | 10-29-2002 11:42 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Repeat previous unix command
Hi all,
Is there a way to bring back the previous unix command without retyping? I tried the "arror up" key, and it seems not working (sun solaris). What is the correct way? Thanks! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Depends what shell you are using...
e.g. for Solaris if you use /usr/bin/ksh: # set -o vi (if not done yet as EDITOR=... in .profile...) then its Esc+ k (backward...) j (Forward) This works because you have a history file set... |
|
#3
|
|||
|
|||
|
If its executing the last command XXX again,
Then just type: r XXX (with ksh...) |
|
#4
|
|||
|
|||
|
In tcsh (and bash?) you can use
!! to execute the previous command again, !-n to execute again the nth to last command !foo to execute again the last command beginning with the string foo !?foo to execute again the last command containing the string foo Append Code:
:p |
|
#5
|
|||
|
|||
|
Repeat previous unix command
Thanks for your reply. I am using ksh.
In linux, if my last command is for example "ls -ltr |tail", I just hit the "arrow up " key to bring it (ls -ltr |tail) back on the command line and then verify it. This gives me the opportunity to display the command before executing it. The command 'r' that vbe suggests is good, but it is executed before I even have the opportunity to dsplay it. I need a command (or key stroke) in order to display and then repeat the execution without retyping the command. Any idea? Thanks! |
|||
| Google The UNIX and Linux Forums |