Is my username the root?

Hi, I am new to Linux and just installed Fedora 36 workstation.
I hear that I should see “root” but what I see instead in my command is [myname@fedora ~]$.
Is this “myname” supposed to be the root of the system?
Thanks so much in advance.

That is your home directory. It is where you start and where you will likely need to be most of the time.

The root of the system is at / and you can switch there with the command cd /

That being said, is there something you are trying to accomplish that we can help you with?

The “root” userid/role is often referred to as the “superuser”, a role that has the special privileges not needed for normal day-to-day activities and thus is to be used with caution. You seldom need to use the “root” userid role, instead using the “sudo” command to temporarily gain access to that privilege level.
But I hope that “myname” isn’t literally what you see … when you installed Fedora and said your name was James Lee, it should have created a userid for you of “jlee” or such. And then when you log in as “jlee”, you have normal user privileges and a home directory of your own.
So perhaps this “I hear that I should see ‘root’” is a misunderstanding.
Make sense?

Thanks so much for replying. That’s good enough for now for me!

I am just following some beginner command line tutorials I found online… I don’t have specific task to accomplish at the moment haha…

2 Likes

Oh that was just an example. My username is james. Thanks so much for explanation. It makes perfect sense.

d9b9f840171e6dc19ee492e279cff25b118b73fd.png

Hey, just one more question. So here I am trying to get to “grub2” folder. I am not going to alter anything there I just wanted to move around in directories and see if I can get an access by using sudo.

I entered password properly as required, but it does not take me to the “grub2” directory and I am wondering what I am missing…

Your sudo command actually did go to the grub2 directory. The problem is that it is designed to run only one command and then exit. When it exited, it left you back in the directory that you started in. If you wanted to keep running as root after the cd command finishes so that you can run other commands without having to prefix “sudo”, you would have to use the -i flag instead (i.e. sudo -i). It means “interactive”. It will also change the last character of your command prompt to # so that you know that you are in “super-user” mode. It is dangerous though because it will let you do things that may break your system without warning. If you just want to see what is under /boot. A better command might be sudo tree /boot. But you might need to install the tree command first. I don’t think it is installed by default.

2 Likes

It actually did take you to the grub2 directory. However, since your user is not allowed access to that directory without ‘root’ or ‘superuser’ privileges, when the command ended your user was not left in that directory.

If you want to see the content of a restricted access directory such as /boot/grub2 then the command sudo ls /boot/grub2 will display the content without needing to cd to that directory.

2 Likes

Thanks so much everyone for help!

1 Like

Just to clarify, the fact that the user didn’t have privileges is unrelated in this case. The reason it didn’t work is as @glb shared above. It ran the command, switched to the directory and then exited so it had no practical effect. The result would have been the same using sudo to switch to a directory where the user did have rights to access.

3 Likes

Thank you for clarifying.

2 Likes

Helpful to know may be this:
The key combination CTRL+C creates a new command line/prompt in both root or user modes.
With Ctrl+D you can leave the root mode at any time.

Tip: try to expand the command line automatically with the tab key ↹. It helps to press it 2x in between.

1 Like

The username is what you set it to during the install of Fedora. Remember?

In your terminal, which displays the current username, you can switch to user root.

Right. I just learned that I can switch users by su command. Thanks!

1 Like

And just to prove that your account is not the root account (it is possible to do that), you can show your numeric user id with:

id

And then you can show the root with:

sudo id

Your numeric is likely to be 1000 and the root should be 0. It will show as “uid” in the output.