Results 1 to 7 of 7
I was reading the man page cd and found this option confusing or rather I did even get anything of wat it meant....
- 05-18-2009 #1
cd -L ????
I was reading the man page cd and found this option confusing or rather I did even get anything of wat it meant.
Only if I could understand the man pages
Registered Linux user #492640
OS: RHEL4,5 ,RH 9,Ubuntu
- 05-18-2009 #2Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
-L means that symlinks will not be resolved *before* changing the directory. That in turn mean that if you cd into a symlink to a directory your prompt will show the path you cd'd into. On the contrary, if you use -P instead, the prompt will tell you the real location, and not the symlink one.
This has some implications. If you use "cd -L .." when cd'ed into a symlink to a directory it will take you to the directory where the symlink lives. If you use -P in this same case it will take you to the parent directory of the dir where the link resolves. Maybe an example here could help:
Code:┌─(17:28:26)-(i92guboj@jesgue)-(~/discos) └─[19]-SHLVL: 4-> $ cd conceptronicA1 ┌─(17:28:29)-(i92guboj@jesgue)-(~/discos/conceptronicA1) └─[20]-SHLVL: 4-> $ cd -P .. ┌─(17:28:34)-(i92guboj@jesgue)-(/mnt) └─[21]-SHLVL: 4-> $ cd ┌─(17:29:47)-(i92guboj@jesgue)-(~) └─[22]-SHLVL: 4-> $ cd discos/ ┌─(17:29:48)-(i92guboj@jesgue)-(~/discos) └─[23]-SHLVL: 4-> $ cd -P conceptronicA1 ┌─(17:29:53)-(i92guboj@jesgue)-(/mnt/conceptronicA1) └─[24]-SHLVL: 4-> $
- 05-18-2009 #3
thanks for replying
Hey thanks for replying. Your prompt looks awesome though it confused me in the beginning. I understood some part of the code but could you please use the -L option as it would make things much easier to understand.
Only if I could understand the man pages
Registered Linux user #492640
OS: RHEL4,5 ,RH 9,Ubuntu
- 05-18-2009 #4Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
-L is the default behavior, that's why I didn't use it. If you don't use -P then you can assume that you are using -L.
- 05-18-2009 #5
and can u please tell me how to set my prompt like the one you have set. Have you changed the value of PS1???
Only if I could understand the man pages
Registered Linux user #492640
OS: RHEL4,5 ,RH 9,Ubuntu
- 05-18-2009 #6Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
Yes. Put this into your ~/.bashrc and ~/.bash_profile files:
Code:# Colors RED="\[\033[1;31m\]" GREEN="\[\033[1;32m\]" YELLOW="\[\033[1;33m\]" BLUE="\[\033[1;34m\]" PINK="\[\033[1;35m\]" CYAN="\[\033[1;36m\]" WHITE="\[\033[1;37m\]" NC="\[\033[0m\]" top="\[\033)0\016\]\[\]lq\[\017\033(B\]" bottom="\[\033)0\016\]\[\]mq\[\017\033(B\]" # Prompt if [[ "$TERM" = "linux" ]] ; then # we are on the system console : no fancy characters allowed if [[ ${EUID} == 0 ]] then # we are root PS1="-${RED}(${CYAN}\t${RED})${NC}-${RED}(\u@\H)${NC}-${RED}(${BLUE}\w${RED})${NC}\n+${pink}[\#]${NC}-> # " else # we are not root PS1="-${RED}(${CYAN}\t${RED})${NC}-${RED}(${GREEN}\u@\H${RED})${NC}-${RED}(${BLUE}\w${RED})${NC}\n+${pink}[\#]${NC}-> $ " fi else # not on the system console, fancy chars allowed if [[ ${EUID} == 0 ]] then # we are root PS1="${top}${RED}(${CYAN}\t${RED})${NC}-${RED}(\u@\H)${NC}-${RED}(${BLUE}\w${RED})${NC}\n${bottom}${pink}[\#]${NC}-> # " else # we are not root PS1="${top}${RED}(${CYAN}\t${RED})${NC}-${RED}(${GREEN}\u@\H${RED})${NC}-${RED}(${BLUE}\w${RED})${NC}\n${bottom}${pink}[\#]${NC}-SHLVL: $SHLVL-> $ " fi fi
- 05-18-2009 #7
thanks!!!!



thanksOnly if I could understand the man pages
Registered Linux user #492640
OS: RHEL4,5 ,RH 9,Ubuntu


Reply With Quote