Remove User and Hostname in Terminal Prompt MAC

June 08, 2019 | 11 comments
For Linux and Mac the default Terminal or ITerm2 terminal the default prompt shows the hostname, current directory etc.
As shown in the above image it is in the format of [username@hostname CURRENTDIR]$

Terminals shows the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command. These prompt strings can be customized by inserting a number of backslash-escaped special characters some of them are as follows:
 
\d : the date in “Weekday Month Date” format (e.g., “Tue May 26”)

\h : the hostname up to the first ‘.’

\H : the hostname

\n : newline

\r : carriage return

\t : the current time in 24-hour HH:MM:SS format

\V : the release of bash, version + patch level (e.g., 2.00.0)

\w : the current working directory, with $HOME abbreviated with a tilde

\W : the basename of the current working directory, with $HOME abbreviated with a tilde

\! : the history number of this command

\# : the command number of this command

\\ : a backslash
Good thing is that it is configurable.  To change it temporarily do the following in the terminal

$PS1="\W"$
Now the Terminal shows something like follows.






To change the behaviour we need to update the .bash or .bash_profile file as per the bash configuration.


And then save the changes and do source ~/.bashrc
Now open a new Terminal and it should reflect the changes.






11 comments :

  1. Replies
    1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.

      Spring Training in Chennai

      The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Thanks for your nice post, i am interested to learn online freelancing, but firstly i have to learn computer , could you suggest me please which computer training center best.


    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery








    ReplyDelete
  3. Thanks for your nice post, i am interested to learn online freelancing, but firstly i have to learn computer , could you suggest me please which computer training center best.







    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery

    ReplyDelete
  4. Keep up the good work; I read few posts on this website, including I consider that your blog is fascinating and has sets of the fantastic piece of information. Thanks for your valuable efforts. traffic secrets

    ReplyDelete

Please leave your message queries or suggetions.