How can I change the text after the @-sign in my terminal? [duplicate]
This question already has an answer here:
How can I make my terminal's command prompt shorter to increase line realestate?
7 answers
How can I change the text after the @-sign? I don't know what it means.
It says DESKTOP-HMEEP40
.
bash terminal bash-scripting
marked as duplicate by slhck, fixer1234, music2myear, bertieb, Rajesh S 16 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How can I make my terminal's command prompt shorter to increase line realestate?
7 answers
How can I change the text after the @-sign? I don't know what it means.
It says DESKTOP-HMEEP40
.
bash terminal bash-scripting
marked as duplicate by slhck, fixer1234, music2myear, bertieb, Rajesh S 16 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
DESKTOP-HMEEP40 is the computer name of terminal you're logged into. To change it, change your computer name. Can't tell which OS you're on from the picture alone.
– Patrick Jørgensen
Dec 16 at 22:30
@PatrickJørgensen - It would be better to changePS1
, as per Kamil Maciorowski's deleted answer.
– AFH
Dec 16 at 22:37
add a comment |
This question already has an answer here:
How can I make my terminal's command prompt shorter to increase line realestate?
7 answers
How can I change the text after the @-sign? I don't know what it means.
It says DESKTOP-HMEEP40
.
bash terminal bash-scripting
This question already has an answer here:
How can I make my terminal's command prompt shorter to increase line realestate?
7 answers
How can I change the text after the @-sign? I don't know what it means.
It says DESKTOP-HMEEP40
.
This question already has an answer here:
How can I make my terminal's command prompt shorter to increase line realestate?
7 answers
bash terminal bash-scripting
bash terminal bash-scripting
edited Dec 17 at 18:17
Saaru Lindestøkke
66521032
66521032
asked Dec 16 at 22:02
FlopkyPlayZ
91
91
marked as duplicate by slhck, fixer1234, music2myear, bertieb, Rajesh S 16 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by slhck, fixer1234, music2myear, bertieb, Rajesh S 16 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
DESKTOP-HMEEP40 is the computer name of terminal you're logged into. To change it, change your computer name. Can't tell which OS you're on from the picture alone.
– Patrick Jørgensen
Dec 16 at 22:30
@PatrickJørgensen - It would be better to changePS1
, as per Kamil Maciorowski's deleted answer.
– AFH
Dec 16 at 22:37
add a comment |
DESKTOP-HMEEP40 is the computer name of terminal you're logged into. To change it, change your computer name. Can't tell which OS you're on from the picture alone.
– Patrick Jørgensen
Dec 16 at 22:30
@PatrickJørgensen - It would be better to changePS1
, as per Kamil Maciorowski's deleted answer.
– AFH
Dec 16 at 22:37
DESKTOP-HMEEP40 is the computer name of terminal you're logged into. To change it, change your computer name. Can't tell which OS you're on from the picture alone.
– Patrick Jørgensen
Dec 16 at 22:30
DESKTOP-HMEEP40 is the computer name of terminal you're logged into. To change it, change your computer name. Can't tell which OS you're on from the picture alone.
– Patrick Jørgensen
Dec 16 at 22:30
@PatrickJørgensen - It would be better to change
PS1
, as per Kamil Maciorowski's deleted answer.– AFH
Dec 16 at 22:37
@PatrickJørgensen - It would be better to change
PS1
, as per Kamil Maciorowski's deleted answer.– AFH
Dec 16 at 22:37
add a comment |
2 Answers
2
active
oldest
votes
This DESKTOP-HMEEP40
string you ask about is probably the hostname retrieved by h
in $PS1
. Ways to change it differ between OS-es/distros. With systemd
you do it by invoking
hostnamectl set-hostname new_name_here
The whole root@…
string is defined by PS1
shell variable:
PS1
Each time an interactive shell is ready to read a command, the value of this variable shall be subjected to parameter expansion and written to standard error. […]
(source)
Run printf '%sn' "$PS1"
to see what the variable is in your case. It probably contains some special strings like u
, h
. The relevant fragment of Bash Reference Manual is here. You can change PS1
like (almost) any other variable:
PS1="whatever "
To make a permanent change define the variable in your .bashrc
file.
This search result may lead you to some interesting examples.
Thanks so much :D
– FlopkyPlayZ
Dec 17 at 17:49
Great answer to a somewhat weak question, but I'm wondering if this hasn't already been answered somewhere else here? We also have: superuser.com/questions/368218/… and superuser.com/questions/370170/…
– slhck
Dec 17 at 18:20
add a comment |
The PS1
/prompt
variable is what determines the format of shell prompt, and it's format and layout depends on the OS and shell being utilized. It's normally found in the shell's config file or the user's profile config.
Examples:
Shell Config:~/.bashrc
for bash,~/.cshrc
for csh/tcsh, etc.
User Profile:~/.profile
or/etc/profile
,profile.ps1
, etc.
Helpful links:
- How to: Change / Setup bash custom prompt (PS1)
- BASH Shell Change The Color of Shell Prompt on Linux or UNIX
The syntax of the PS1
/prompt
variable will vary with each OS:
BSD
w/o color
set prompt = "%N@%m:%~ %# "
w/ color:
set prompt = "[%{33[34m%}%N%{33[0m%}%{33[32m%}@%{33[0m%}%{33[34m%}%m%{33[0m%}] %{33[34m%}%~%{33[0m%}%{33[32m%}#%{33[0m%} "
OpenWrt:
w/o color
export PS1='u@OpenWrt w$ '
w/ color
export PS1='[[33[34m]u[33[0m][33[32m]@[33[0m][33[34m]OpenWrt[33[0m]] [33[34m]w[33[0m] [33[32m]$[33[0m] '
Ubuntu:
w/o color
PS1='[${debian_chroot:+($debian_chroot)}u@h]:w$ '
w/ color
PS1='[${debian_chroot:+($debian_chroot)}[33[38;5;039m]u[33[00m][33[38;5;154m]@[33[00m][33[38;5;039m]uvm[33[00m]] [33[38;5;039m]w[33[00m] [33[38;5;154m]$[33[00m]
Windows PowerShell:
w/o color
Function set-prompt {
"$ESC[35mPS $($executionContext.SessionState.Path.CurrentLocation)$('$' * ($nestedPromptLevel + 1)) $ESC[0m"
}
w/ color
Function set-prompt {
Param (
[Parameter(Position=0)]
[ValidateSet("Default","Test")]
$Action
)
switch ($Action) {
"Default" {
Function global:prompt {
if (test-path variable:/PSDebugContext) { '[DBG]: ' }
write-host " "
write-host ("$ESC[48;2;40;40;40m$ESC[38;2;170;210;0m$(Get-Location) $ESC[0m $ESC[0m")
if ( $host.UI.RawUI.WindowTitle -match "Administrator" ) {
$Host.UI.RawUI.ForegroundColor = 'Red'
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Red -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Red -NoNewLine
})
} else {
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Blue -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Blue -NoNewLine
})
}
return " "
}
}
}
}
set-prompt Default
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This DESKTOP-HMEEP40
string you ask about is probably the hostname retrieved by h
in $PS1
. Ways to change it differ between OS-es/distros. With systemd
you do it by invoking
hostnamectl set-hostname new_name_here
The whole root@…
string is defined by PS1
shell variable:
PS1
Each time an interactive shell is ready to read a command, the value of this variable shall be subjected to parameter expansion and written to standard error. […]
(source)
Run printf '%sn' "$PS1"
to see what the variable is in your case. It probably contains some special strings like u
, h
. The relevant fragment of Bash Reference Manual is here. You can change PS1
like (almost) any other variable:
PS1="whatever "
To make a permanent change define the variable in your .bashrc
file.
This search result may lead you to some interesting examples.
Thanks so much :D
– FlopkyPlayZ
Dec 17 at 17:49
Great answer to a somewhat weak question, but I'm wondering if this hasn't already been answered somewhere else here? We also have: superuser.com/questions/368218/… and superuser.com/questions/370170/…
– slhck
Dec 17 at 18:20
add a comment |
This DESKTOP-HMEEP40
string you ask about is probably the hostname retrieved by h
in $PS1
. Ways to change it differ between OS-es/distros. With systemd
you do it by invoking
hostnamectl set-hostname new_name_here
The whole root@…
string is defined by PS1
shell variable:
PS1
Each time an interactive shell is ready to read a command, the value of this variable shall be subjected to parameter expansion and written to standard error. […]
(source)
Run printf '%sn' "$PS1"
to see what the variable is in your case. It probably contains some special strings like u
, h
. The relevant fragment of Bash Reference Manual is here. You can change PS1
like (almost) any other variable:
PS1="whatever "
To make a permanent change define the variable in your .bashrc
file.
This search result may lead you to some interesting examples.
Thanks so much :D
– FlopkyPlayZ
Dec 17 at 17:49
Great answer to a somewhat weak question, but I'm wondering if this hasn't already been answered somewhere else here? We also have: superuser.com/questions/368218/… and superuser.com/questions/370170/…
– slhck
Dec 17 at 18:20
add a comment |
This DESKTOP-HMEEP40
string you ask about is probably the hostname retrieved by h
in $PS1
. Ways to change it differ between OS-es/distros. With systemd
you do it by invoking
hostnamectl set-hostname new_name_here
The whole root@…
string is defined by PS1
shell variable:
PS1
Each time an interactive shell is ready to read a command, the value of this variable shall be subjected to parameter expansion and written to standard error. […]
(source)
Run printf '%sn' "$PS1"
to see what the variable is in your case. It probably contains some special strings like u
, h
. The relevant fragment of Bash Reference Manual is here. You can change PS1
like (almost) any other variable:
PS1="whatever "
To make a permanent change define the variable in your .bashrc
file.
This search result may lead you to some interesting examples.
This DESKTOP-HMEEP40
string you ask about is probably the hostname retrieved by h
in $PS1
. Ways to change it differ between OS-es/distros. With systemd
you do it by invoking
hostnamectl set-hostname new_name_here
The whole root@…
string is defined by PS1
shell variable:
PS1
Each time an interactive shell is ready to read a command, the value of this variable shall be subjected to parameter expansion and written to standard error. […]
(source)
Run printf '%sn' "$PS1"
to see what the variable is in your case. It probably contains some special strings like u
, h
. The relevant fragment of Bash Reference Manual is here. You can change PS1
like (almost) any other variable:
PS1="whatever "
To make a permanent change define the variable in your .bashrc
file.
This search result may lead you to some interesting examples.
edited Dec 16 at 22:33
answered Dec 16 at 22:17
Kamil Maciorowski
24.4k155177
24.4k155177
Thanks so much :D
– FlopkyPlayZ
Dec 17 at 17:49
Great answer to a somewhat weak question, but I'm wondering if this hasn't already been answered somewhere else here? We also have: superuser.com/questions/368218/… and superuser.com/questions/370170/…
– slhck
Dec 17 at 18:20
add a comment |
Thanks so much :D
– FlopkyPlayZ
Dec 17 at 17:49
Great answer to a somewhat weak question, but I'm wondering if this hasn't already been answered somewhere else here? We also have: superuser.com/questions/368218/… and superuser.com/questions/370170/…
– slhck
Dec 17 at 18:20
Thanks so much :D
– FlopkyPlayZ
Dec 17 at 17:49
Thanks so much :D
– FlopkyPlayZ
Dec 17 at 17:49
Great answer to a somewhat weak question, but I'm wondering if this hasn't already been answered somewhere else here? We also have: superuser.com/questions/368218/… and superuser.com/questions/370170/…
– slhck
Dec 17 at 18:20
Great answer to a somewhat weak question, but I'm wondering if this hasn't already been answered somewhere else here? We also have: superuser.com/questions/368218/… and superuser.com/questions/370170/…
– slhck
Dec 17 at 18:20
add a comment |
The PS1
/prompt
variable is what determines the format of shell prompt, and it's format and layout depends on the OS and shell being utilized. It's normally found in the shell's config file or the user's profile config.
Examples:
Shell Config:~/.bashrc
for bash,~/.cshrc
for csh/tcsh, etc.
User Profile:~/.profile
or/etc/profile
,profile.ps1
, etc.
Helpful links:
- How to: Change / Setup bash custom prompt (PS1)
- BASH Shell Change The Color of Shell Prompt on Linux or UNIX
The syntax of the PS1
/prompt
variable will vary with each OS:
BSD
w/o color
set prompt = "%N@%m:%~ %# "
w/ color:
set prompt = "[%{33[34m%}%N%{33[0m%}%{33[32m%}@%{33[0m%}%{33[34m%}%m%{33[0m%}] %{33[34m%}%~%{33[0m%}%{33[32m%}#%{33[0m%} "
OpenWrt:
w/o color
export PS1='u@OpenWrt w$ '
w/ color
export PS1='[[33[34m]u[33[0m][33[32m]@[33[0m][33[34m]OpenWrt[33[0m]] [33[34m]w[33[0m] [33[32m]$[33[0m] '
Ubuntu:
w/o color
PS1='[${debian_chroot:+($debian_chroot)}u@h]:w$ '
w/ color
PS1='[${debian_chroot:+($debian_chroot)}[33[38;5;039m]u[33[00m][33[38;5;154m]@[33[00m][33[38;5;039m]uvm[33[00m]] [33[38;5;039m]w[33[00m] [33[38;5;154m]$[33[00m]
Windows PowerShell:
w/o color
Function set-prompt {
"$ESC[35mPS $($executionContext.SessionState.Path.CurrentLocation)$('$' * ($nestedPromptLevel + 1)) $ESC[0m"
}
w/ color
Function set-prompt {
Param (
[Parameter(Position=0)]
[ValidateSet("Default","Test")]
$Action
)
switch ($Action) {
"Default" {
Function global:prompt {
if (test-path variable:/PSDebugContext) { '[DBG]: ' }
write-host " "
write-host ("$ESC[48;2;40;40;40m$ESC[38;2;170;210;0m$(Get-Location) $ESC[0m $ESC[0m")
if ( $host.UI.RawUI.WindowTitle -match "Administrator" ) {
$Host.UI.RawUI.ForegroundColor = 'Red'
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Red -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Red -NoNewLine
})
} else {
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Blue -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Blue -NoNewLine
})
}
return " "
}
}
}
}
set-prompt Default
add a comment |
The PS1
/prompt
variable is what determines the format of shell prompt, and it's format and layout depends on the OS and shell being utilized. It's normally found in the shell's config file or the user's profile config.
Examples:
Shell Config:~/.bashrc
for bash,~/.cshrc
for csh/tcsh, etc.
User Profile:~/.profile
or/etc/profile
,profile.ps1
, etc.
Helpful links:
- How to: Change / Setup bash custom prompt (PS1)
- BASH Shell Change The Color of Shell Prompt on Linux or UNIX
The syntax of the PS1
/prompt
variable will vary with each OS:
BSD
w/o color
set prompt = "%N@%m:%~ %# "
w/ color:
set prompt = "[%{33[34m%}%N%{33[0m%}%{33[32m%}@%{33[0m%}%{33[34m%}%m%{33[0m%}] %{33[34m%}%~%{33[0m%}%{33[32m%}#%{33[0m%} "
OpenWrt:
w/o color
export PS1='u@OpenWrt w$ '
w/ color
export PS1='[[33[34m]u[33[0m][33[32m]@[33[0m][33[34m]OpenWrt[33[0m]] [33[34m]w[33[0m] [33[32m]$[33[0m] '
Ubuntu:
w/o color
PS1='[${debian_chroot:+($debian_chroot)}u@h]:w$ '
w/ color
PS1='[${debian_chroot:+($debian_chroot)}[33[38;5;039m]u[33[00m][33[38;5;154m]@[33[00m][33[38;5;039m]uvm[33[00m]] [33[38;5;039m]w[33[00m] [33[38;5;154m]$[33[00m]
Windows PowerShell:
w/o color
Function set-prompt {
"$ESC[35mPS $($executionContext.SessionState.Path.CurrentLocation)$('$' * ($nestedPromptLevel + 1)) $ESC[0m"
}
w/ color
Function set-prompt {
Param (
[Parameter(Position=0)]
[ValidateSet("Default","Test")]
$Action
)
switch ($Action) {
"Default" {
Function global:prompt {
if (test-path variable:/PSDebugContext) { '[DBG]: ' }
write-host " "
write-host ("$ESC[48;2;40;40;40m$ESC[38;2;170;210;0m$(Get-Location) $ESC[0m $ESC[0m")
if ( $host.UI.RawUI.WindowTitle -match "Administrator" ) {
$Host.UI.RawUI.ForegroundColor = 'Red'
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Red -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Red -NoNewLine
})
} else {
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Blue -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Blue -NoNewLine
})
}
return " "
}
}
}
}
set-prompt Default
add a comment |
The PS1
/prompt
variable is what determines the format of shell prompt, and it's format and layout depends on the OS and shell being utilized. It's normally found in the shell's config file or the user's profile config.
Examples:
Shell Config:~/.bashrc
for bash,~/.cshrc
for csh/tcsh, etc.
User Profile:~/.profile
or/etc/profile
,profile.ps1
, etc.
Helpful links:
- How to: Change / Setup bash custom prompt (PS1)
- BASH Shell Change The Color of Shell Prompt on Linux or UNIX
The syntax of the PS1
/prompt
variable will vary with each OS:
BSD
w/o color
set prompt = "%N@%m:%~ %# "
w/ color:
set prompt = "[%{33[34m%}%N%{33[0m%}%{33[32m%}@%{33[0m%}%{33[34m%}%m%{33[0m%}] %{33[34m%}%~%{33[0m%}%{33[32m%}#%{33[0m%} "
OpenWrt:
w/o color
export PS1='u@OpenWrt w$ '
w/ color
export PS1='[[33[34m]u[33[0m][33[32m]@[33[0m][33[34m]OpenWrt[33[0m]] [33[34m]w[33[0m] [33[32m]$[33[0m] '
Ubuntu:
w/o color
PS1='[${debian_chroot:+($debian_chroot)}u@h]:w$ '
w/ color
PS1='[${debian_chroot:+($debian_chroot)}[33[38;5;039m]u[33[00m][33[38;5;154m]@[33[00m][33[38;5;039m]uvm[33[00m]] [33[38;5;039m]w[33[00m] [33[38;5;154m]$[33[00m]
Windows PowerShell:
w/o color
Function set-prompt {
"$ESC[35mPS $($executionContext.SessionState.Path.CurrentLocation)$('$' * ($nestedPromptLevel + 1)) $ESC[0m"
}
w/ color
Function set-prompt {
Param (
[Parameter(Position=0)]
[ValidateSet("Default","Test")]
$Action
)
switch ($Action) {
"Default" {
Function global:prompt {
if (test-path variable:/PSDebugContext) { '[DBG]: ' }
write-host " "
write-host ("$ESC[48;2;40;40;40m$ESC[38;2;170;210;0m$(Get-Location) $ESC[0m $ESC[0m")
if ( $host.UI.RawUI.WindowTitle -match "Administrator" ) {
$Host.UI.RawUI.ForegroundColor = 'Red'
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Red -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Red -NoNewLine
})
} else {
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Blue -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Blue -NoNewLine
})
}
return " "
}
}
}
}
set-prompt Default
The PS1
/prompt
variable is what determines the format of shell prompt, and it's format and layout depends on the OS and shell being utilized. It's normally found in the shell's config file or the user's profile config.
Examples:
Shell Config:~/.bashrc
for bash,~/.cshrc
for csh/tcsh, etc.
User Profile:~/.profile
or/etc/profile
,profile.ps1
, etc.
Helpful links:
- How to: Change / Setup bash custom prompt (PS1)
- BASH Shell Change The Color of Shell Prompt on Linux or UNIX
The syntax of the PS1
/prompt
variable will vary with each OS:
BSD
w/o color
set prompt = "%N@%m:%~ %# "
w/ color:
set prompt = "[%{33[34m%}%N%{33[0m%}%{33[32m%}@%{33[0m%}%{33[34m%}%m%{33[0m%}] %{33[34m%}%~%{33[0m%}%{33[32m%}#%{33[0m%} "
OpenWrt:
w/o color
export PS1='u@OpenWrt w$ '
w/ color
export PS1='[[33[34m]u[33[0m][33[32m]@[33[0m][33[34m]OpenWrt[33[0m]] [33[34m]w[33[0m] [33[32m]$[33[0m] '
Ubuntu:
w/o color
PS1='[${debian_chroot:+($debian_chroot)}u@h]:w$ '
w/ color
PS1='[${debian_chroot:+($debian_chroot)}[33[38;5;039m]u[33[00m][33[38;5;154m]@[33[00m][33[38;5;039m]uvm[33[00m]] [33[38;5;039m]w[33[00m] [33[38;5;154m]$[33[00m]
Windows PowerShell:
w/o color
Function set-prompt {
"$ESC[35mPS $($executionContext.SessionState.Path.CurrentLocation)$('$' * ($nestedPromptLevel + 1)) $ESC[0m"
}
w/ color
Function set-prompt {
Param (
[Parameter(Position=0)]
[ValidateSet("Default","Test")]
$Action
)
switch ($Action) {
"Default" {
Function global:prompt {
if (test-path variable:/PSDebugContext) { '[DBG]: ' }
write-host " "
write-host ("$ESC[48;2;40;40;40m$ESC[38;2;170;210;0m$(Get-Location) $ESC[0m $ESC[0m")
if ( $host.UI.RawUI.WindowTitle -match "Administrator" ) {
$Host.UI.RawUI.ForegroundColor = 'Red'
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Red -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Red -NoNewLine
})
} else {
$(if ($nestedpromptlevel -ge 1) {
write-host ('PS $$ ') -ForegroundColor Blue -NoNewLine
} else {
write-host ('PS $ ') -ForegroundColor Blue -NoNewLine
})
}
return " "
}
}
}
}
set-prompt Default
answered Dec 16 at 23:26
JW0914
55449
55449
add a comment |
add a comment |
DESKTOP-HMEEP40 is the computer name of terminal you're logged into. To change it, change your computer name. Can't tell which OS you're on from the picture alone.
– Patrick Jørgensen
Dec 16 at 22:30
@PatrickJørgensen - It would be better to change
PS1
, as per Kamil Maciorowski's deleted answer.– AFH
Dec 16 at 22:37