veducate header

How to run the last command as Sudo in Linux

A quick post as I always forget this command, learn how to run the last command again as sudo, to elevate and bypass permissions denied error.

## First command fails with permissions issue

dean@veducate # mv openshift-install /usr/local/bin/openshift-install
mv: cannot move 'openshift-install' to '/usr/local/bin/openshift-install': Permission denied

## Using the command "sudo !!" will run the last command with sudo, the full command will be outputed

dean@veducate # sudo !!
sudo mv openshift-install /usr/local/bin/openshift-install

## The terminal will return, including any necessary information as part of the command execution.

dean@veducate #



Dean Lewis

One thought on “How to run the last command as Sudo in Linux

  1. Thank you for this article. It was very useful as I was searching for it from past few time and it helped me a lot. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.