Ubuntu shell command line to shorten the path

Linux systems, command line operation process, there is always because the path is too long, resulting in information display is not so intuitive, so it is necessary to shorten the length of the path.

Shorten the path, which means that only displays the current path name , long path means that display superior path name . As follows:

@ Ubuntu YQ: ~ / Desktop / Subversion / Subversion-1.12.0 $ the sudo Nano ~ / ~ # represents the user path .bashrc
# Edit file

IF [ "$ color_prompt" = Yes]; the then PS1 = '$ {debian_chroot: + ($ debian_chroot)} \ [\ 033 [01; 32M \] \ U @ \ H \ [\ 033 [00m \] : \ [\ 033 [01; 34m \] \ w \ [\ 033 [00m \] \ $ ' # the \ w into \ W capital letter W is the else PS1 =' $ {debian_chroot: + ($ debian_chroot)} \ @ U \ H: \ W \ $ ' # \ W is Fi
# Save and exit
YQ @ Ubuntu: ~ / Desktop / Subversion / Subversion-1.12.0 $ Source ~ / .bashrc # make the file take effect YQ @ Ubuntu: Subversion-1.12.0 $ pwd # displays the full path
/ home / yq / Desktop / subversion / subversion-1.12.0 # full name

Guess you like

Origin www.cnblogs.com/yqmcu/p/11201720.html