Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How can I change my root prompt?

    Scheduled Pinned Locked Moved General pfSense Questions
    6 Posts 2 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Sopalajo de Arrierez
      last edited by

      This is my desired prompt (I would like colors too, but, as long as sh should be the shell for root, I have read it is hard to achieve):

      PS1="`whoami`@`hostname | sed 's/\..*//'`~ $PWD>"
      

      How can I change the default prompt for root user to this one?
      I logint into my pfSense machine via SSH remote connections. I don't know if the change should be the same for physical access.

      1 Reply Last reply Reply Quote 0
      • NogBadTheBadN
        NogBadTheBad
        last edited by

        You could try editing ~/.tcsh

        [2.4.3-RELEASE][admin@pfsense.xxxx.net]/root: ls -alg .tcshrc 
        -rw-r--r--  1 root  wheel  2418 Jun 25 19:55 .tcshrc
        [2.4.3-RELEASE][admin@pfsense.xxxx.net]/root: grep prompt .tcshrc 
        set prompt="[%B`cat /etc/version`%b][%B%n%b%{\033[0;1;31m%}@%{\033[0;0;0m%}%B%M%b]%/%{\033[0;1;31m%}:%{\033[0;0;0m%} "
        [2.4.3-RELEASE][admin@pfsense.xxxx.net]/root: 
        

        Andy

        1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

        S 1 Reply Last reply Reply Quote 0
        • S
          Sopalajo de Arrierez @NogBadTheBad
          last edited by

          @nogbadthebad

          Not working:

          \[\033[00;32m\]\u@Balanceador\[\033[00m\]:\[\033[01;34m\]/root\[\033[00m\]$ whoami
          root
          \[\033[00;32m\]\u@Balanceador\[\033[00m\]:\[\033[01;34m\]/root\[\033[00m\]$ echo $SHELL
          /bin/sh
          \[\033[00;32m\]\u@Balanceador\[\033[00m\]:\[\033[01;34m\]/root\[\033[00m\]$ pwd
          /root
          \[\033[00;32m\]\u@Balanceador\[\033[00m\]:\[\033[01;34m\]/root\[\033[00m\]$ grep PS1 .tcshrc
          export PS1="`whoami`@`hostname | sed 's/\..*//'`~ $PWD>"
          \[\033[00;32m\]\u@Balanceador\[\033[00m\]:\[\033[01;34m\]/root\[\033[00m\]$ grep prompt .tcshrc
          set prompt="`whoami`@`hostname | sed 's/\..*//'`~ $PWD>"
          

          Of course, I tried reloging in.

          1 Reply Last reply Reply Quote 0
          • NogBadTheBadN
            NogBadTheBad
            last edited by

            tcsh != sh

            You'll need to look at the tcsh man pages.

            Andy

            1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

            S 1 Reply Last reply Reply Quote 0
            • S
              Sopalajo de Arrierez @NogBadTheBad
              last edited by

              @nogbadthebad
              Obviously, tcsh is not sh . I never said I was using tcsh.

              Neither does the .shrc file seems to solve the problem:

              $ grep PS1 .shrc
              PS1="`whoami`@`hostname | sed 's/\..*//'` ~$PWD > "
              
              $ grep VISUAL .shrc
              VISUAL=nano
              
              $ echo $PS1
              \[\033[00;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$
              
              $ echo $VISUAL
              [nothing]
              

              It seems the .shrc file is ignored too.

              1 Reply Last reply Reply Quote 0
              • NogBadTheBadN
                NogBadTheBad
                last edited by

                @nogbadthebad said in How can I change my root prompt?:

                0;1;31m

                The default shell is tcsh that's why i stated tcsh != sh, I didn't spot the bit where you mentioned echo $SHELL

                Andy

                1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.