Summary of the modification method of ubuntu's terminal command prompt is too long

 

Ubuntu's terminal command prompt is too long, the main reasons are:

1: The computer name is too long;

2: Multiple layers are displayed directly;

 

Handling of computer names that are too long:

For example: the following computer name prompt is too long:

ningcaichen-virtual-machine is the computer name:

ningcaichen@ningcaichen-virtual-machine:/mytmp$ sudo vim /etc/hostname

change into:

ningcaichen@ningcaichen-virtual-machine:/mytmp$ sudo vim /etc/hosts 

change into:

reboot

The result is just fine:

 

Processing for displaying multi-level directories:

Shaped like:

You can leave it unmodified, it can be seen at a glance, or it can be modified to display only the last directory (in this case, you need to see all the paths, so you have to pwd):

Like CentOS just show the last directory:

Modify this file:

(make a copy before editing)

vim .bashrc

(Enter in command line mode: set number) Enter to display the line number:

Change the previous \w to \W

Re-execute the just-modified initialization command document (which is the command), and there is no need to restart.

source ~/.bashrc

result:

As you can see, only one directory is displayed in the back.

So: if you want to see all of them at this time, just pwd it.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324456087&siteId=291194637