books on zlib official

Change prompt in Ranger

In previous post I wrote about file manager Ranger. In Ranger there is keyboard shortcut Shift + S to execute shell (Bash in my case). You can modify /etc/ranger/config/rc.conf (or your local ~/.config/ranger/rc.conf) and add this line:

map S shell bash --rcfile <(cat ~/.bashrc; echo 'PS1="(ranger) $PS1"')

Then you get your prompt prefixed by (ranger) and always know you are in shell of Ranger.