In a single command how do you run the previous command in
the command prompt.

Answers were Sorted based on User's Feedback



In a single command how do you run the previous command in the command prompt...

Answer / kalaivani

type "r". It will execute the last executed command

Is This Answer Correct ?    7 Yes 2 No

In a single command how do you run the previous command in the command prompt...

Answer / asit

esp + p enter
upper arrow enter

Is This Answer Correct ?    7 Yes 4 No

In a single command how do you run the previous command in the command prompt...

Answer / anjan raha

!!

It will display previous executed command

Is This Answer Correct ?    4 Yes 1 No

In a single command how do you run the previous command in the command prompt...

Answer / namrata

Using Dot(.)It will execute the last executed command.

Is This Answer Correct ?    3 Yes 1 No

In a single command how do you run the previous command in the command prompt...

Answer / 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

More Shell Script Interview Questions

I want to create a directory such that anyone in the group can create a file and access any person's file in it but none should be able to delete a file other than the one created by himself.

0 Answers  


What are the additional egrep symbols?

2 Answers  


What are the two files of crontab command?

0 Answers  


How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?"

12 Answers   Cap Gemini,


How do you create a shortcut in linux?

0 Answers  






HOW TO CREATE 10 USERS IN UNIX(HP-UX) USING SHELL SHELL SCRIPT?

3 Answers   Patni,


What is scripting used for?

0 Answers  


Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.

0 Answers  


What does echo $0 do?

0 Answers  


How to add some content in any file at some desired location without using VI or some other editor in UNIX

2 Answers  


How do I open the shell in cmd?

0 Answers  


What is @echo off?

0 Answers  


Categories