How to see in the terminal that you have sudo privileges? (so knowing I have these privileges, I can just type sudo -k
) It would be better to not add too much information into the terminal also, just some kind of simple and small alert!
REMAINING TIME IS IMPOSSIBLE, right?
Also, how to see how much time I still have with those privileges on that specific terminal? (so I can just let it end instead of typing sudo -k
). I think that remaining time could show up each time I press Enter key.
EDIT: I researched more and found that /var/lib/sudo/$USER/$nPts
(where $nPts is current terminal pts as of ps -p $$
) has its timestamp updated everytime a sudo command is issued, and it is only accessible if you use a sudo command, so the remaining time will always be the configured one...
PS.: Alternatively to that, I tried alias sudo='sudo -k'
but I dislike having to type the password for every command... And also, this alias sudos='sudo -k'
(or alias ssudo='sudo -k'
, good if you typed a long line, just press Home and type 's') works if you only want to issue one command by typing sudos
. But I still miss to know when I have normal sudo privileges to know I need to act...