How do I copy a previous command in Linux?

How do I copy a previous command in Linux?
Answer
Following are the 4 different ways to repeat the last executed command.
  1. Use the up arrow to view the previous command and press enter to execute it.
  2. Type !! and press enter from the command line.
  3. Type !- 1 and press enter from the command line.
  4. Press Control+P will display the previous command, press enter to execute it.
 

Tìm kiếm

Back
Top