Linux: permission denied

github logo ・1 min read

If you run the command less /etc/shadow you'll get /etc/shadow: Permission denied so you have to run it with sudo command, but if you assign a alias like this alias please='sudo $(history -p !!)' and just run please after you get permission denied that it should work :)

twitter logo DISCUSS (3)
markdown guide

I always love to see what creative alias names people come up with.

Reminds me a bit of SUDO, a neat little bit of code for Bash that automatically runs commands with sudo when you type the command name in all caps (so you can get your computer to ignore permission errors by shouting at it).


$(history -p !!) runs the last command you run. For example if you run less /etc/shadow, then sudo $(history -p !!) would be sudo less /etc/shadow

Classic DEV Post from Jun 4 '19

What's one resource most devs don't know that you use regularly?

Arber Avdullahu profile image
Golang developer, good at mathematics
Join dev.to

Guaranteed to make you a better developer or your money back