Announcement

Collapse
No announcement yet.

user name in terminal

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    user name in terminal

    Kubuntu 14.04, old win vista laptop, dual boot with win10 pro.
    When I open the terminal, my username is so long it takes up the whole line unless I go full screen.

    clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:~$

    How can i change this, and how can I change the "clay1245dx to just clay?
    Thanks

    #2
    As root, edit /etc/hostname and /etc/hosts
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/etc$ hostname
      clay1245dx-HP-Pavilion-dv7-Notebook-PC
      clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/etc$ edit hostname
      Warning: unknown mime-type for "hostname" -- using "application/octet-stream"
      Error: no write permission for file "hostname"
      clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/etc$

      clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/etc$ cd /
      clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/$ edit hostname
      Warning: unknown mime-type for "hostname" -- using "application/octet-stream"
      Error: no write permission for file "hostname"
      clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/$
      Last edited by Clayman1000x; Nov 06, 2016, 10:23 AM.

      Comment


        #4
        Originally posted by Clayman1000x View Post
        clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/etc$ hostname
        clay1245dx-HP-Pavilion-dv7-Notebook-PC
        clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/etc$ edit hostname
        Warning: unknown mime-type for "hostname" -- using "application/octet-stream"
        Error: no write permission for file "hostname"
        clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/etc$

        clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/etc$ cd /
        clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/$ edit hostname
        Warning: unknown mime-type for "hostname" -- using "application/octet-stream"
        Error: no write permission for file "hostname"
        clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:/$
        Code:
        kdesudo kate /etc/hostname
        and edit it like you will .

        this will only change this part
        Code:
        vinny@[COLOR=#ff0000]vinny-Bonobo-Extreme[/COLOR]:~$
        for the first part ,,,,look to hear http://askubuntu.com/questions/34074...ge-my-username

        VINNY
        i7 4core HT 8MB L3 2.9GHz
        16GB RAM
        Nvidia GTX 860M 4GB RAM 1152 cuda cores

        Comment


          #5
          kdesudo kate /etc/hostname
          This did not change anything but what appears in Kate itself.
          Click image for larger version

Name:	Kubuntu 14.12 k11copy.jpg
Views:	1
Size:	81.8 KB
ID:	643386

          I did kdesudo kate /etc/hostname and kdesudo kate /etc/hosts
          now I get:
          clay1245dx@clay:~$
          in terminal, dolphin still says "clay1245dx",
          what could I be doing wrong?
          Last edited by Clayman1000x; Nov 06, 2016, 12:07 PM.

          Comment


            #6
            Originally posted by Clayman1000x View Post
            kdesudo kate /etc/hostname
            This did not change anything but what appears in Kate itself.
            [ATTACH=CONFIG]6795[/ATTACH]

            I did kdesudo kate /etc/hostname and kdesudo kate /etc/hosts
            now I get:
            clay1245dx@clay:~$
            in terminal, dolphin still says "clay1245dx",
            what could I be doing wrong?
            clay1245dx is your user name ,,,,,,,,see the link I gave you for that one .

            VINNY
            i7 4core HT 8MB L3 2.9GHz
            16GB RAM
            Nvidia GTX 860M 4GB RAM 1152 cuda cores

            Comment


              #7
              Where I am at now in Kate, terminal and Dolphin,
              I used that link, with the exception of the group part, didn't have anything going with a group. I used the part starting at:

              To put it all together:
              1. At the start screen press Ctrl+Alt+F1.
              2. Log in using your username and password.
              3. Set a password for the "root" account.
                sudo passwd root
              4. Log out.
                exit
              5. Log in using the "root" account and the password you have previously set.
              6. Change the username and the home folder to the new name that you want.
                usermod -l <newname> -d /home/<newname> -m <oldname>
              7. Change the group name to the new name that you want.
                groupmod -n <newgroup> <oldgroup>
              8. Lock the "root" account.
                passwd -l root
              9. If you were using ecryptfs (encrypted home directory). Mount your encrypted directory using ecryptfs-recover-private and edit <mountpoint>/.ecryptfs/Private.mnt to reflect your new home directory.
              10. Log out.
                exit
              11. Press Ctrl+Alt+F7.

              And now you can log in using your new username.

              Click image for larger version

Name:	Kubuntu 14.12 k12copy.jpg
Views:	1
Size:	74.5 KB
ID:	643387
              I was able to login with the new username, but all it did was make a new account, changed fonts and some other stuff. I was able to get back to this now.
              Last edited by Clayman1000x; Nov 06, 2016, 01:24 PM.

              Comment


                #8
                Read VINNY's link again, more carefully.
                "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                – John F. Kennedy, February 26, 1962.

                Comment


                  #9
                  The other posters have given you tips on changing your user name and host name, because your bash prompt is set to display those.

                  Another approach to this is to change your prompt. In your home directory there is a "hidden*" file called .bashrc that sets the variable PS1. You can edit it with
                  Code:
                  kate .bashrc
                  and change what PS1 is set to. Unfortunately by default in Debian it's set to this awful mess:
                  Code:
                  PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
                  (The strings starting with [\033[ are applying ANSI colours. The chroot stuff only applies in a "chroot", which few would use and then rarely.)

                  The bit that gets your user name is \u and the hostname is \h.

                  If you change the code that sets PS1 to, say
                  Code:
                  if [ "$color_prompt" = yes ]; then
                      PS1='\[\033[01;33m\]clay@hp:\w!\[\033[m\] '
                  else
                      PS1='clay@hp:\w\$ '
                   fi
                  you'll get "clay@hp:~! " in yellow, good for a black background.

                  More simply, you could put PS1='> ' at the end of .bashrc for a really bare bones prompt.

                  * "hidden" because the name starts with a dot.
                  Regards, John Little

                  Comment


                    #10
                    Found the lines you are referring to, just don't know what to do from here.

                    Code:
                    if [ "$color_prompt" = yes ]; then
                        PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
                    else
                        PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
                    fi
                    unset color_prompt force_color_prompt
                    
                    
                    # If this is an xterm set the title to user@host:dir
                    case "$TERM" in
                    xterm*|rxvt*)
                        PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
                        ;;
                    *)
                        ;;
                    esac

                    Comment


                      #11
                      Clayman, what do you see at the prompt now?

                      What do you wish to see?

                      Comment


                        #12
                        Originally posted by gtrip View Post
                        Clayman, what do you see at the prompt now?

                        What do you wish to see?
                        Look at the pic in post #7, the terminal username is shortened a lot, "clay45dx@clay:~$ " , which is really what I was trying to accomplish.
                        Kate says just "clay" now, which is fine, dolphin still has clay1245dx.

                        I am trying to learn more with the terminal and that long ass username that was there was driving me batty,
                        I also changed the background in the terminal to a lighter color with dark fonts, easier to see.

                        from this : clay1245dx@clay1245dx-HP-Pavilion-dv7-Notebook-PC:~$
                        to this : clay45dx@clay:~$


                        now to this today: clay@clay
                        Last edited by Clayman1000x; Nov 11, 2016, 10:56 AM.

                        Comment


                          #13
                          Originally posted by Clayman1000x View Post
                          Found the lines you are referring to, just don't know what to do from here.

                          Code:
                          if [ "$color_prompt" = yes ]; then
                              PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
                          else
                              PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
                          fi
                          unset color_prompt force_color_prompt
                          
                          
                          # If this is an xterm set the title to user@host:dir
                          case "$TERM" in
                          xterm*|rxvt*)
                              PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
                              ;;
                          *)
                              ;;
                          esac
                          IMO the default debian prompt is suitable for sys admins working with lots of computers or with various installs. A typical Kubuntu user knows her or his user name and knows what computer she or he is using, because it's right in front of or beside her or him; so being told this at every prompt is pointless.

                          Accordingly, I suggest that you delete the characters \u@\h in the three places you see them.

                          I also would put \! in their place to get a command history number. Together with a couple of aliases (could also go in .bashrc):
                          Code:
                           
                          alias r='fc -s'
                          alias h='history $LINES'
                          you can type r 123 to repeat command 123. Type h to get a page of your most recent commands.

                          Regards, John Little
                          Regards, John Little

                          Comment


                            #14
                            Originally posted by GreyGeek View Post
                            Read VINNY's link again, more carefully.
                            I've tried that several times, everytime I logout and drop to a terminal, "ctrl alt f1" I have to log in, can't do anything else, gonna try making a temp administrator to log into and try again.
                            Ok, got everything working correctly now except: now dropbox won't sync,
                            but so far everything else looks good. Gotta work on groups too though, still says "clay1245dx".
                            Last edited by Clayman1000x; Nov 11, 2016, 10:55 AM.

                            Comment


                              #15
                              Originally posted by Clayman1000x View Post
                              I've tried that several times, everytime I logout and drop to a terminal, "ctrl alt f1" I have to log in, can't do anything else, gonna try making a temp administrator to log into and try again.
                              Ctrl+alt+f1 takes you to a terminal, so does using the other Fn from 2 to 6. Ctrl+alt+f7 takes you back to your graphical interface. You do not have to logout and then log back in.

                              You were given two options: 1) change the name of your account, or 2) change the prompt.

                              In post #13 jlittle described exactly what to do to modify the prompt, how to modify the script and then add it to the bottom of ~./bashrc (in your home account). Changing the account name is more difficult. It all goes back to the install sequence when you are asked for your name and a password. When you enter "John Q Jones" the install program puts "john" as the account name. If you were to enter "abcdefgjijklmnopq r stuvwxyz" as your name your account name would be "abcdefgjijklmnopq'.
                              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                              – John F. Kennedy, February 26, 1962.

                              Comment

                              Working...
                              X