In a single command how do you run the previous command in
the command prompt.
Answer Posted / joker
!! will execute the last command
!-1 will execute the 2nd command from last
Few other tricks:
-----------------
If you are not sure you can see what is the command rather than executing by
!!:p
!-2:p
and later just do !!
If you want to run the last command with little modification use substitution
!!:s/old/new
example:
>vim test
>!!:s/test/abcd/:p
vim abcd
Thanks,
Joker
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the syntax of while loop in shell scripting?
How do I start a shell script?
What is sudo command?
What is shell prompt?
What is batch file programming?
how will you find the total disk space used by a specific user?
How to use arguments in a script?
Explain about login shell?
What are zombie processes?
What is scripting autism?
What command needs to be used to take the backup?
Explain about stdin, stdout and stderr?
Given a file find the count of lines containing the word "abc".
How can you find out how long the system has been running?
I want to connect to a remote server and execute some commands, how can I achieve this?