How do I know my username? I've installed Ubuntu, but I don't know my username, only my password. I can't access my laptop and it can't be opened.
-
6The login screen shows possible accounts and you only have to click (or even not have to click since you were presumably the last to log in) and type your password.– Gilles 'SO- stop being evil'Aug 17, 2013 at 11:22
-
2@Jayharte - did any of these answers work for you? If so, please accept one as the answer. Thank you.– TassDec 3, 2013 at 14:37
9 Answers
Open a Terminal and type whoami
This will work on every Unix/Linux System.
-
11
-
1
-
7@rajlego If run from recovery mode,
whoami
would just outputroot
. However, in recovery mode,ls /home
could be used to view the names of the system's normally configured human users. If there's just one such user, this output is their username; and even if there are more, it should make it pretty easy to figure out the username. Sep 6, 2014 at 4:45 -
1Agree with @Boris. As he mentioned in the answer, he could not login, how could he launch
whoami
? It's strange to have this answer got many vote-ups. Dec 15, 2015 at 14:16 -
3@TungTran - Upvotes are from googlers (like me) who came here looking for the answer to the question in the title. Some of us just need a reminder of the command that prints out the current username. But, reading the actual question, this answer is pretty useless to the asker.– gilly3Sep 22, 2016 at 21:24
Open a Terminal and type:
echo $USER
This will print the value of USER
environment variable to the console.
-
4To the original asker, this is as useless as the
whoami
command, but in all honesty, this is perfect for those "run ablah username_here
" commands whereusername_here
part can be replaced with$USER
and the whole command made more universal. Thanks.– nurchiSep 26, 2016 at 18:42 -
2@Ali Dehghani, $USER is an environment variable that can be changed to anything. whoami actually checks which is the currently logged in user Apr 24, 2018 at 6:55
Most simple way to find out your username is probably to press ctr+alt+t - this opens terminal and than you will see something like:
user_name@machine_name:~$
And that answers your question.
-
So is user_name is the user name and machine_name is the group? Jul 25, 2016 at 20:58
-
-
this is not always correct, as what the terminal shows is configurable Oct 23, 2018 at 15:28
-
2If you can configure your terminal, you probably know the
whoami
command.– JendasNov 9, 2018 at 14:30
If you installed ubuntu, then you filled in your username, does this help jog our memory?
E.g. here where yann
is the user name
You should boot up your Ubuntu in recovery mode. Follow the steps below:
Switch on your computer. Wait until the BIOS has finished loading, or has almost finished. (During this time you will probably see a logo of your computer manufacturer.) Quickly press and hold the Shift key, which will bring up the GNU GRUB menu. (If you see the Ubuntu logo, you've missed the point where you can enter the GRUB menu.) **
Select the line which starts with "Advanced options". *
Select the line ending with "(recovery mode)", probably the second line, something like:
Ubuntu GNU/Linux, with Linux 3.8.0-26-generic (recovery mode)
Press Return and your machine will begin the boot process.
After a few moments, your workstation should display a menu with a number of options. One of the options (you may need to scroll down to the bottom of the list) will be "Drop to root shell prompt". Press Return with this option highlighted.
Eventually, you could use this command to list all usernames:
cut -d: -f1 /etc/passwd
I suppose you will be able to recognize your username in the list.
-
-
-
This will work if the user hasn't set their root password ever. However, if someone has set it already, they can always just use a live usb or any other OS to look at the home directory(hopefully unencrypted.) Dec 2, 2015 at 5:22
-
Yes, if he remembers his root password, it's even easier. Anyway, as he said, he's installed the Ubuntu and doesn't know his username. I suppose he didn't set root password. Dec 2, 2015 at 7:03
-
Also, with single user mode, even though you set a root password, you will be able to skip it. Dec 2, 2015 at 7:04
Normally when you start your computer, you don't have to know your username to log on, because it appears automatically in a list. And if it's the only user account, it's the only name listed. It should look like this:
If there is more than one user account, click on the name you want to use. For just one user, all you have to do is type in your password.
If your login screen does not look like that, or logging in does not work, or the problem is that booting fails before you get to the login screen, please let us know, and provide as many details as possible.
-
I suppose he has a problem displaying the username on the login page. If he could see the login screen, he would recognize the username. Then if so, we wouldn't ask. Dec 15, 2015 at 14:18
-
1
From recovery mode, run the following command to list all human like users:
awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd
Use this solution if you didn't encrypt your home directory.
Do you still have the installation media(LiveCD/USB) from which you installed Ubuntu? Boot from it and select Try Ubuntu.
Go to Files and then, you will see you already installed Ubuntu partition. Click on it, it will mount.
Go to
/home
. Here you will see a list of all users on the system that you have created.
To jog your memory, however, what is your name? Did you enter the same name while installing Ubuntu? Do you recall the name that was displayed on the login prompt where you entered your password? Ubuntu by default sets the username as your first name in lowercase.
Example; name= John Doe, automatically set username= john
I tried many possible usernames and I figured it out from the username_machinename and typed just the first word which is the username. Example: Alice_Inspiron_35_3045 So the username is "Alice".
-
1Hi Fatema! Welcome to Askubuntu You are right that in many cases this will be true. However, this is not the case if you have changed the hostname during the install, or if you have changed this post-installation - as this is a changeable value and is not consistent May 18, 2020 at 9:37