How To Change The Sudo Prompt In Linux

Ok maybe I’m a bit bored today. While digging in Google, I came across this cool and useless hack. There is an option to change the sudo prompt to something cool or funny. As you may already know, whenever we use a sudo command, it will display “[sudo] password for …” statement, right? Yes! You can, however, change this statement to something different if you want. This is what this brief guide talks about.

Change The Sudo Prompt In Linux

Have a look at the following command.

sudo pacman -Syyu

Sample output:

[sudo] password for sk:
[...]

As you see above, the default output starts with – “[sudo] password for sk”. Well, It’s boring to see this each time. I want something cool and funny. Here is how you can change the sudo password prompt as you please.

I am too lazy to type this sentence every time. Is there anyway to display this automatically when I am ‘sudo’ing? Of course, yes! Here is where “alias” comes in help. Just add an alias to your .bashrc or .alias file like below.

2 Responses

NEVER EVER run ‘vi /etc/sudoers’ !
Always use visudo since it will do a sanity check on the new config file before activating it when you save the changed file, and it will allow you to correct your mistakes if there are any. If sudo encounters a broken config file it will simply stop working!