Accessing Linux From Command Line Interface

For the command line interface, you are initially given a login prompt. The system is now running and waiting for a user to log in and use it. You can enter your username and password to use the system. The login prompt is preceded by the hostname you gave your system. When you finish using Linux, you first log out. Linux then displays exactly the same login prompt, waiting for you or another user to log in again. This is the equivalent of the Login window provided by the GDM. You can then log in to another account.

Logging In and Out with the Command Line

Once you log in to an account, you can enter and execute commands. Logging in to your Linux account involves two steps: entering your username and then entering your password. Type in the username for your user account. If you make a mistake, you can erase characters with the BACKSPACE key.

When you type in your password, it does not appear on the screen. This is to protect your password from being seen by others. If you enter either the username or the password incorrectly, the system will respond with the error message “Login incorrect” and will ask for your username again, starting the login process over. You can then reenter your username and password.

Once you enter your username and password correctly, you are logged in to the system. Your command line prompt is displayed, waiting for you to enter a command. Notice the command line prompt is a dollar sign ($), not a number sign (#). The $ is the prompt for regular users, whereas the # is the prompt solely for the root user. In this version of Linux, your prompt is preceded by the hostname and the directory you are in. Both are bounded by a set of brackets.

To end your session, issue the logout or exit command. This returns you to the login prompt, and Linux waits for another user to log in.

Shutting Down Linux from the Command Line

If you want to turn off your computer, you must first shut down Linux. Not shutting down Linux may require Linux to perform a lengthy systems check when it starts up again. You shut down your system in either of two ways. First log in to an account and then enter the halt command. This command will log you out and shut down the system.

Alternatively, you can use the shutdown command with the -h option. Or, with the -r option, the system shuts down and then reboots. In the next example, the system is shut down after five minutes. To shut down the system immediately, you can use +0 or the word now.

You can also force your system to reboot at the login prompt by holding down the CTRL and ALT keys and then pressing the DEL key (CTRL-ALT-DEL). Your system will go through the standard shutdown procedure and then reboot your computer.

Linux Tags: command, login, shell, shutdown

Post a Comment