Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

  1. Home
  2. UNIX(Linux)Beginner - Login, root User, and Shutdown

Login, root User, and Shutdown - Images: Japanese

Hey there, everyone!

So, CentOS installation is done — from this article on, let's actually start operating the system.

When you boot CentOS, you should see a screen that looks something like this.

CentOS login screen in CUI mode

This is the login screen. Type "root" and press Enter.

Typing root at the CentOS login prompt

Next, enter the root password you set during installation.

One thing to note here: in UNIX-based OSes, when you type a password, the characters you type do not appear on screen — not even asterisks. If you're not used to it, that can feel like

"Wait, is this actually registering my input...?" — but it is. Keep typing with confidence.

Password entry screen — no characters are displayed while typing

If the password is correct, you'll be logged in and the system is ready to use.

CentOS logged in successfully — command prompt visible

Before we jump into doing things, let's take a moment to cover the 'prompt' and the concept of user accounts in UNIX-based OSes.

After logging into CentOS, the screen shows something like this.

[root@localhost ~]#

That '[root@localhost ~]#' part is called the 'prompt'. Put simply, a visible prompt means "the system is waiting for your input — go ahead and type a command."

In CentOS's default state, the prompt displays information in this format.

[username@hostname current-directory]# or $

The exact format varies depending on the OS and can be customized, but this general pattern is common. Once you get comfortable with UNIX, you'll read it at a glance without thinking about it — no need to memorize it specifically right now.

There's one part of the prompt worth paying attention to: the '#' symbol.

In most UNIX-based OSes, a '#' in the prompt means you're logged in as 'root' (the superuser).

'root' is the administrator with full privileges — the most powerful user account on the system. The username is always "root" unless you configure it otherwise, so root is present on virtually every UNIX-based system.

Conversely, non-admin users see $ in the prompt, like this.

[ksakurama@localhost ~]$

Users without administrator privileges are called general users.

This is a subtle difference in design philosophy: Windows and macOS don't make a very visible distinction between admin and non-admin accounts because they're designed primarily for single-user personal computing. CentOS, on the other hand, is built around the idea of multiple users sharing a system, so it makes the distinction visually clear with '#' vs '$'.

Also, since UNIX is designed to run as a server — meaning it's actively providing some commercial service — the things a general user can do are kept quite limited.

For example, by default, only root can shut down the system.

That might seem odd for something as routine as turning off a PC, but servers in commercial use are often kept running 24/7 until they need hardware replacement. If any random user could shut the system down, that would be a security problem.

So as you start working with UNIX-based OSes, it's worth keeping a loose awareness of "am I currently logged in as root or not."

You'll frequently need to install software or change system settings — and a lot of those operations require root privileges. Losing track of which user you're operating as is a common source of confusion for beginners.

Alright, now that we're logged in as root, let's try shutting the system down.

To shut down, type shutdown -h now and press Enter. Watch the spelling.

[root@localhost ~]# shutdown -h now

Wait a moment and CentOS should power off.

Typing a command and watching the system respond is a different experience from clicking a button in a GUI. The author remembers having that kind of moment as a kid and being genuinely excited by it. That feeling — curiosity about how a system works — tends to be a good sign in someone who's going to do well with this stuff.

In the shutdown -h now command shown above, replacing -h with -r will reboot the system instead of shutting it down.

[root@localhost ~]# shutdown -r now

To log out without powering down, type logout or exit.

[root@localhost ~]# logout
[root@localhost ~]# exit

Pressing 'Ctrl + D' (hold Ctrl and press D) also logs you out.

Technically, 'exit' and Ctrl+D end the current shell session — but at the top-level prompt, that's equivalent to logging out. We'll cover shells in a later article.

One note for macOS users running CUI environments inside VirtualBox: the Ctrl key is not the same as the Command key. It's the physical Ctrl key — on a JIS keyboard it's on the left side near the middle, on a US keyboard it's in the bottom-left corner.

That might seem obvious, but when the author used to walk new developers through this, "Ctrl+D doesn't work" complaints turned out to be Command+D presses almost 100% of the time — so worth mentioning just in case.

shutdown -h now for powering off can also be written as poweroff, and shutdown -r now for rebooting can be written as reboot.

The internal behavior differs slightly, but the end result is the same. Use whichever is easier to remember.

The author tends to use poweroff and reboot — they're more memorable that way.

[root@localhost ~]# poweroff
[root@localhost ~]# reboot

The shutdown commands covered here — 'shutdown -h now' and its variants — also work in macOS's Terminal.

You won't need them often, but if the GUI side of macOS ever freezes and you can't shut the machine down normally, opening Terminal and typing 'shutdown -h now' can force a power-off. Worth keeping in the back of your mind.

Now let's talk about powering the system back on — which is pretty straightforward.

If CentOS is installed on a physical PC, just press the power button and wait for the login screen to appear.

If you're using a virtualization tool like VirtualBox, double-click the OS entry in the sidebar to start it up.

VirtualBox main window — double-click a VM to start it

Alright, that wraps up root login, power on, and power off.

One last note: when using macOS's Terminal, there's no separate login screen. You're automatically logged in as the current macOS user. The concepts around the prompt and the '#' symbol for root still apply in macOS, though — that's consistent across UNIX-based systems.

In the next article, we'll introduce some basic commands and start actually interacting with the system. See you there!

This article was written by Sakurama.

Author's beloved small mammal

桜舞 春人 Sakurama Haruto

A Tokyo-based programmer who has been creating various content since the ISDN era, with a bit of concern about his hair. A true long sleeper who generally feels unwell without at least 10 hours of sleep. His dream is to live a life where he can sleep as much as he wants. Loves games, sports, and music. Please share some hair with him.

If you find any errors or copyright issues, please .