Results 1 to 6 of 6

Thread: Customizing terminal

  1. #1

    Question Customizing terminal

    I would like to customize a terminal's detail that I don't know the name, so it's being hard to Google it. My terminal currently has the following layout:

    Code:
    user@hostname:current_dir>
    Example:

    Code:
    renatov@dellnote:/usr/bin>
    I don't really like this layout (or whatever name this 'thing' has). I would like to change it to something else, for example:

    Code:
    user <current_dir> $
    Could someone help me, please? If someone told me what is the name of this 'thing' I'm trying to customize, I would be able to Google it

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,882
    Blog Entries
    15

    Default Re: Customizing terminal

    On Thu 13 Feb 2014 04:46:01 AM CST, renatov wrote:


    I would like to customize a terminal's detail that I don't know the
    name, so it's being hard to Google it. My terminal currently has the
    following layout:


    Code:
    --------------------
    user@hostname:current_dir>
    --------------------


    Example:


    Code:
    --------------------
    renatov@dellnote:/usr/bin>
    --------------------


    I don't really like this layout (or whatever name this 'thing' has). I
    would like to change it to something else, for example:


    Code:
    --------------------
    user <current_dir> $
    --------------------


    Could someone help me, please? If someone told me what is the name of
    this 'thing' I'm trying to customize, I would be able to Google it


    Hi
    That is called PS1 and an alternative PS2, so to change it to the
    above, it would be;
    Code:
    export PS1="$USER `pwd` $"
    This command can be added to your ~/.basrc file or which ever shell
    you using. Look at man bash then /PS1 <enter> to search and find the
    other options.

    --
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.2 Kernel 3.11.10-7-desktop
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


  3. #3
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,733
    Blog Entries
    20

    Default Re: Customizing terminal

    What you see in the terminal is based on
    user
    hostname
    Leap 15.1_KDE
    My Articles Was I any help? If yes: Click the star below

  4. #4

    Default Re: Customizing terminal

    I used a bashrc generator to customize a very good looking $PS1. I added the following code to both my user's ~/.bashrc and root's ~/.bashrc so they have different $PS1 variables:

    Code:
    # Custom PS1if [ $(id -u) -eq 0 ];
    then # root
        export PS1="\[\e[01;31m\]\u\[\e[0m\]\[\e[01;37m\]:\[\e[0m\]\[\e[00;37m\] \w \[\e[0m\]\[\e[01;31m\]#\[\e[0m\]\[\e[00;37m\] \[\e[0m\]" 
    else # normal user
        export PS1="\[\e[01;31m\]\u\[\e[0m\]\[\e[00;37m\] [\w] \[\e[0m\]\[\e[01;34m\]\$\[\e[0m\]\[\e[00;37m\] \[\e[0m\]"
    fi
    Thanks for the help!

  5. #5
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Customizing terminal

    On 2014-02-13 05:46, renatov wrote:
    > I don't really like this layout (or whatever name this 'thing' has). I
    > would like to change it to something else, for example:


    Notice that the default setting, which is not that simple, contains the
    machine name because people can ssh from one machine to another, and it
    is useful to know what machine you are at.

    You should not remove the machine name unless you are never going to
    work with networked machines.

    --
    Cheers / Saludos,

    Carlos E. R.

    (from 13.1 x86_64 "Bottle" (Minas Tirith))

  6. #6
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,882
    Blog Entries
    15

    Default Re: Customizing terminal

    On Thu 13 Feb 2014 08:46:01 AM CST, renatov wrote:


    I used a 'bashrc generator' (http://bashrcgenerator.com/) to customize a
    very good looking $PS1, but now root has the same $PS1 as my user, so it
    doesn't appear a "#" when I login as root with su. How do I customize it
    to providing different $PS1 variables to root and other users?

    I tryed this code in my ~/.bashrc but it didn't work:
    Hi
    Using that implies that you would not use su - (which should be used
    when switching to root). In openSUSE there are some configuration
    tweaks to make it color red. Only set you user profile, then set up the
    root one in that account .bashrc.

    If system wide then you need to look at /etc/bash.bashrc (make a backup
    copy before making changes!).

    --
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.2 Kernel 3.11.10-7-desktop
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •