Processing
 

ZSH Agnoster Theme showing machine name

13/02/2015 02:15#1

Drew

Member

Joined at: 12 months ago

Post: 79

Thank: 0

Thanked: 0

I have a development server hosted on Digital Ocean, using Ubuntu 14.04. I switched my shell to ZSH and decided to go with the Agnoster theme. In order to get user@hostname to stop showing, I set the DEFAULT_USER in my .zshrc file.

For some reason on the ubuntu server, that's not working. The hostname still shows, and will not go away. I'm doing the exact same thing on my Mac OSX, and it works fine.

Here are some screenshots:

ZSH Agnoster Theme showing machine name

ZSH Agnoster Theme showing machine name

Anyone know what's going on? I even tried DEFAULT_USER="$USER@$HOST" with no luck.

If I go back to the default, Robby Russell theme, it works just fine.

ZSH Agnoster Theme showing machine name

13/02/2015 04:13Top#2

hchbaw

Member

Joined at: 8 months ago

Post: 2

Thank: 0

Thanked: 0

It is the feature according to this; when we are sshing, the hostname will be shown.

Overriding the function prompt_context or build_prompt on Agnoster theme will rescue. Putting below snippets at the very end of the ~/.zshrc for example.

# redefine prompt_context for hiding user@hostname prompt_context () { } 
04/05/2015 14:26Top#3

Joined at: 8 months ago

Post: 1

Thank: 0

Thanked: 0

I'm using agnoster theme too.

Edit agnoster.zsh-theme and find $user@%m and delete @%m.

Image sample:

28/02/2015 14:19Top#4

Joined at: 8 months ago

Post: 1

Thank: 0

Thanked: 0

You can set DEFAULT_USER="[user name]" in your .zshrc file and it will stop showing the user@hostname in your terminal.

In order to get the [user name], type id -un in your terminal and it will output the [user name] value.

10/07/2016 19:54Top#5

hqt

Member

Joined at: 8 months ago

Post: 1

Thank: 0

Thanked: 0

Here is my version from first two answers. They explain very clearly. I will merge again.

  1. step 1. one your .zshrc file by vim .zshrc

  2. step 2. go to end of your file.

  3. Paste this code:

careful indent again your code

prompt_context() {   if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then     prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"   fi } 

Reference link: agnoster theme code

Hope this help :)

Similar articles

Non-interactive method for dpkg-reconfigure tzdata

5 years ago - Reply: 3 - Views: 143

monit is not able to read mongod.lock

2 years ago - Reply: 3 - Views: 141

Ubuntu: hadoop command not found

2 years ago - Reply: 4 - Views: 244

C# Mono Console.ReadLine quitting

4 years ago - Reply: 1 - Views: 87

linking jsoncpp on Ubuntu

2 years ago - Reply: 1 - Views: 6

Build artifacts over ssh jenkins - PHP

3 years ago - Reply: 1 - Views: 38

Can't load Metasploit after installation

3 years ago - Reply: 5 - Views: 222

Selenium FirefoxDriver in Headless get error

2 years ago - Reply: 1 - Views: 97

Unable to start MongoDB. ERROR: addr already in use

2 years ago - Reply: 2 - Views: 120

ZSH Agnoster Theme showing machine name

2 years ago - Reply: 4 - Views: 250

Unable to start firefox browser with jenkins user

2 years ago - Reply: 2 - Views: 113

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re