Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Display full path in the terminal prompt

Chandhan S JSep 8 2023 — edited Sep 8 2023

I want my prompt in the Linux terminal to display the full path instead of the current directory. I tried to modify the /etc/bashrc file as per the suggestions available in Linux forums still not getting the desired output. This change I want to happen for all the users and not only for root or oracle users.

Default
[root@ol7-19p ~]# cd /home/oracle/Downloads/
[root@ol7-19p Downloads]# pwd
/home/oracle/Downloads

Desired
[root@ol7-19p /root]# cd /home/oracle/Downloads/
[root@ol7-19p /home/oracle/Downloads]# cd /home/oracle/Downloads/

Before
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'~
~PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'

After
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD}"'
PROMPT_COMMAND='printf "\033k%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD}"'

This post has been answered by Chandhan S J on Sep 17 2023
Jump to Answer
Comments
Post Details
Added on Sep 8 2023
3 comments
701 views