我在实践的过程中参考过的文章:
Ubuntu终端里面显示路径名称太长怎么修改?
ubuntu16系统显示路径太长怎么办,bashrc文件来帮你
-
去~/.bashrc文件里面改两个小w为大W
先用cp命令备份一下这个文件
echigh@huangchenggong:/mnt/e/work/project/WQ half sys module/build_11.1.0.64_output_k3d/output/examples/iot_qt_capture_app$ cp ~/.bashrc ~/.bashrc-bak
然后用vi编辑器打开它
echigh@huangchenggong:/mnt/e/work/project/WQ half sys module/build_11.1.0.64_output_k3d/output/examples/iot_qt_capture_app$ vim ~/.bashrc
打开文件后找到下面的位置:
if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ 'else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ 'fi
然后把那两个小w改成大W后写入并退出:
2.source一下这个文件使刚才的更改生效,注意中间那个echigh是我的文件夹名,这个要换成自己的(或者用~路径指代/home/echigh)
echigh@huangchenggong:/mnt/e/work/project/WQ half sys module/build_11.1.0.64_output_k3d/output/examples/iot_qt_capture_app$ source /home/echigh/.bashrcechigh@huangchenggong:iot_qt_capture_app$
3.现在不显示长路径了,若想看自己当前在哪个位置,可以用pwd命令可以查看当前路径
echigh@huangchenggong:iot_qt_capture_app$ pwd/mnt/e/work/project/WQ half sys module/build_11.1.0.64_output_k3d/output/examples/iot_qt_capture_app