0% found this document useful (0 votes)
40 views2 pages

Linux Logging in and Logging Out CC

The document explains how to log in, switch to superuser mode using the 'su' command, and log out of a Linux system. It details the process of becoming a superuser, managing shell levels, and the commands for logging out. Additionally, it describes the proper methods for shutting down a Linux system using the 'shutdown' command with various options.

Uploaded by

paritriddhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views2 pages

Linux Logging in and Logging Out CC

The document explains how to log in, switch to superuser mode using the 'su' command, and log out of a Linux system. It details the process of becoming a superuser, managing shell levels, and the commands for logging out. Additionally, it describes the proper methods for shutting down a Linux system using the 'shutdown' command with various options.

Uploaded by

paritriddhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Linux Logging in, Logging Out, and Shutting down

Logging in

Once you started Linux system, you will see a login prompt on your monitor as below:.

When we installed Linux ,we have set a root password. We also created a user with a password.
Therefore to log in, we want to type the name of a user or "root" for the login name and enter
the appropriate password.

To become a "super user".( su/ sudo command)

If you logged in as a normal user and know the root password and want to use administration
commands, you may use the command "su" to become a "super user". Some systems also
support the "sudo" command.

Linux Shell levels and the su command

The command, "su" will allow a normal user to enter a new shell level as the root user or as
another user if they know the root user's or that user's password respectively.

To become the root user, type "su" then you will be prompted for the root password.

To become another user, type "su username".

You must enter either that user's password to become that user.

Every time you use the su command you enter a new shell level which means you have invoked
a new running copy of the shell program, such as bash.

You can see this change by typing the command "env" and looking at the value of the
environment variable "SHLVL". This value increments when you use the su command and
decrements when you use the "exit" command to exit that shell environment.

You can also see the shell level value by typing "printenv SHLVL".

Logging out

Use the command "logout" to exit a given session.

If you have logged in, then typed "su" to become a superuser or another user, you may need to
type "exit" until your SHLVL environment value is 1.

Then you can type "logout" to exit your session. The "exit" command will take you back to
previous shell levels.

Shutting Linux Down

The system is intended to be shutdown by the system administrator using the shutdown
command in one of the forms shown below. Many systems are set up to capture the
<CTRL><ALT><DEL> keystroke combination to issue the shutdown command through the init
program. This will work on most systems if the root user is logged in. Examples of using the
shutdown command are shown below.

shutdown -h now //shutdown and halt the system immediately


shutdown -r +10 "Rebooting in 10 minutes" //reboot the system in 10 minutes
shutdown -r 13:00 //shut the system down and do a reboot at 1:00 in the
afternoon

The first command will shutdown and halt the system immediately. The second
will reboot the system in 10 minutes and send the message to all users. The third
command will shut the system down and do a reboot at 1:00 in the afternoon.

You might also like