Shortcut to run previous shell command as superuser

Old Procedure

  1. Most of the time when we execute a permission required command but we forget to add sudo at the start of the command then terminal throws the error permission denied
  2. So what we will do enter up arrow (navigation key) and enter home or continuously press left arrow key to go to the initial position of the previously executed command
  3. In command at the start position we will start type sudo 
  4. Instead of that we have an alternative to avoid navigating towards start of your command

New Procedure

  1. Now we are going to see how to execute the permission denied command alternative and fast way
  2. In your terminal type sudo !!
  3. In terminal, you will see previously failed command is executing with superuser permission

    Leave a comment

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