The long part is the computer name, also known as your host name: liam-Lenovo-Legion-Y7000
The easiest way would be to change your computer name to something like liam so that the prompt would appear like this:
liam@liam:~$
See this duplicate answer for how to change your computer name using the hostnamectl
command.
In your case and to change your host name to liam, you could use the following command:
sudo hostnamectl set-hostname liam
Here is another duplicate question for how to change your device-name.
Alternatively, the following is a more complicated method that removes the computer name from your prompt.
Without changing the actual computer name, you can remove the computer name from the prompt by editing your ~/.bashrc
file.
Before we begin, make a backup of this file:
cp ~/.bashrc ~/.bashrcbackup
Run the following command to use nano to edit the file:
nano ~/.bashrc
1. Press CTRL+W to search and then type PS1
and then press ENTER.
The line should look like this:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Edit the line to remove @\h\[\033[00m\]
up to the :
but do not remove the :
so the edited line should look like this:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u:\[\033[01;34m\]\w\[\033[00m\]\$ '
2. Press CTRL+W and then press ENTER.
This line should look like this:
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
Edit the line to remove @\h
so the edited line should look like this:
PS1='${debian_chroot:+($debian_chroot)}\u:\w\$ '
3. Press CTRL+W and then press ENTER.
This line should look like this:
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
Edit the line to remove @\h
so the edited line should look like this:
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u: \w\a\]$PS1"
When you are done editing the file, press CTRL+o to save the changes and then press CTRL+x to exit nano.
Finally, run the following command to apply the changes:
source ~/.bashrc
Your prompt should now appear as the following:
liam:~$