The meaning and modification of strings in Ubuntu terminal before and after

Source: Internet
Author: User

The user name is the representative of the @ front string in the Ubuntu terminal.

The host name is represented after the @.

If the string is longer before and after it can be shortened by modification, this can be very clear on one line when compiling the program.

1. If the host name is longer. You can use sudu hostname xxx (XXX) in the terminal to indicate the name you want to display, that is, the new host name.

Then enter the password for the sudo user name

source. BASHRC

Exit exits the current terminal.

Ctrl+alt+t open a new terminal. You will find that the long hostname at the back of your @ has become the xxx that you just followed in sudo hostname.

2. If the user name is longer.

A. Just want the user name on the terminal to appear relatively short.

sudo vi ~/.BASHRC

At the end of the. bashrc file, add such a sentence

Export ps1= ' \[email protected]\h \w:\$ '

Here \u represents your username, you can change him to any string you want.
\h is your computer name, \w is the current full path, \w is the current folder
But don't mess around with this ... Delete this line of code and you can restore it.

B. Want to make the user name shorter.

Method: Create a new User: sudo adduser yy (yy means your new username)

Enter the password for your root user.

Then enter the password for your new user xxx

After the full name, room number, telephone, etc. do not need to fill in.

So you create a new user, directly with this user can be.

C Delete the original user

sudo userdel zzz (zzz means your original username) If your user is logged in, you need to exit. Otherwise it cannot be erased.

The meaning and modification of strings in Ubuntu terminal before and after

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.