Modify the command line path length in linux.
The default path prompt is the complete path, so that a line is too long and may occupy the full width! As shown below:
jack@ubuntu:~/trunk-new/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3.10.17/net/netfilter/commercials$
It basically occupies 80% of the terminal width. If you can change it to show only the name of the last folder!
Modification method:
Vim ~ /. Bashrc
Search PS1
56 if [ "$color_prompt" = yes ]; then 57 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ ' 58 else 59 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ ' 60 fi
Find the preceding text. Note that the value of the environment variable in PS1 is the current user, \ h is the host name, \ w is the complete path, and \ W is the simple path, change w to W!
If or else takes effect, you can try it all. Mine is else.
Run the command after modification
$ source ~/.bashrc
You can apply it! Result
jack@ubuntu:commercials$
Is it concise...
How to change the default path of the cd command in linux
Cd ~ Is to jump to the main directory.
So what you need to do is modify the main directory
Usermod-d/home/username
In linux, how does one set the default path of a command?
Set the environment variable PATH and add the current PATH "."
Export PATH = $ PATH:. You can write this statement to the user profile file, which takes effect automatically upon each Logon:
Vi ~ /. Bash_profile