Linux Logoff and Shutdown - Linux Commands (2024)

If you're ready to cash in your console and call it a day, use the logout command. Enteringlogout

at the command prompt exits your current user account and returns you to the log-in prompt. (The exit command does the samething as logout.) To log out from multiple consoles, use alt-Fn to switch between consoles and then log out from each one.But note that even if you log out from all of your active consoles, Linux is still running.

If you were to power off your machine at this point, a voice from your computer would drone, "You have chosen unwisely!" Thefloor would shake, and your PC would glow white hot while your hard disk melted into a pool of molten silicon. Just kidding . . .sometimes the floor doesn't shake, but powering off a running Linux system without using the shutdown command will mostcertainly cause Bad Things to happen to your hard disk. So if you really want to exit Linux, be sure that you're logged in as the rootuser and enter the command

You'll see some messages indicating that various subsystems are being shut down, and then the computer will be reset. When yousee a message indicating that shutdown is complete, it's safe to turn off your PC.

Tip: Pressing ctrl-alt-delete will also safely shut down your Red Hat Linux system. Just remember to power off as soon as you see your PC's normal bootup screen. Note that some other Linux distributions will do a hard reset (which may cause filesystemdamage) instead of gracefully shutting down, so don't use ctrl-alt-delete on non-Red Hat systems unless you know it's safe.

Comments - most recent first
(Please feel free to answer questions posted by others!)

Sanjeev (21 Dec 2012, 09:50)

Hi, in my linux machine i don't have sound card and which shutdown i getmessage "Saving mixer settings alsactl: save_state: 1501: No soundcardsfound ... [FAILED]", how to get rid of this message?

selvam (20 Nov 2012, 11:10)

this site very usefull

steve (14 Nov 2012, 22:48)

Sometimes when I use shutdown -h now, my system reboots rather than staysshutdown. What causes this to happen?

Gabriel A. Cánepa (01 Aug 2012, 19:56)

@Edward Tari, GNU/Linux is the FULL operating system/kernel set (forsimplicity, let's just say it's the full operating system), while LinuxMint is a linux distro - or Linux flavor if you wish. Linux Mint is basedin Ubuntu (another Linux distro) which in turn is based in Debian (yetanother distro). Linux Mint is a good choice to start for a newbie,specially if they're coming from Windows.

Gabriel A. Cánepa (01 Aug 2012, 19:53)

@papabaks, make sure you are logged in as the root user before you issuethe 'shutdown -h now' (without quotes, of course ;)) command. There arecertain commands in GNU/Linux that can only be executed as the root user -and shutdown is one of them.

yagyavrat arya (01 Apr 2012, 16:28)

init 0

papabaks (12 Mar 2012, 04:46)

i tried using the "shutdown -h now" command on my redhat but its telling me"command not recognize" are mine missing something? pls...

Nikky (05 Mar 2012, 02:29)

Hello Bob(my new teacher),

I must say u r man of ur word..tutorials typed by u r really simple tounderstand & work upon. Further, some commands , i would like furnish herefor shutdown & reboot that i know:

Shutdown: init 0
poweroff
Restart: init 6
reboot

to forcefully shutdown/restart:

reboot -f
poweroff -f

Bhob Rankesh (01 Mar 2012, 12:37)

What is difference in startup and shutdown computer?

Edward Tari (18 Feb 2012, 19:09)

What is the different's between GNU/Linux and Linux Mint?

Nazzareno (03 Jan 2012, 10:49)

In an redhat5, once shutdown the system with as root:

shutdown -h now

now, when I restart the system and connected as root then I have lost alldisplay tabs, i.e.: "Applications", "Places" and "System", so basically Icannot use any display commands anymore through root user. On the contrary,if I swift on another user, for example oracle, then I can see and workfine all display commands. How can I fix this behavior and work fine againwith root user as?

santhoshkumar (17 Dec 2011, 03:43)

i need to shutdown my redhat linux in command method
but i would like to start automatically after sum some time what type ofcommand we used for that

pranab (16 Dec 2011, 09:38)

thanks

Vithu (29 Nov 2011, 00:53)

Thank you very very helpful....

theregkid (28 Oct 2011, 14:27)

.... i will never shutdown again... - cowers in fear-

amit (27 Sep 2011, 06:45)

thanks

Santhosh (02 Sep 2011, 10:18)

init 0 (to shutdown)
init 6 or reboot (to reboot)

in Redhot linux...

duvvuri (02 Jul 2011, 10:31)

there are other commands for turning off:-
(a) init
(b) poweroff

harmilap rahul (31 Mar 2011, 06:04)

this command are very useful now in my college

rahul singh (31 Mar 2011, 06:03)

this command are very useful...

constant_c (30 Mar 2011, 06:32)

If you want to shut down and then turn off the power, you can type

shutdown -P now

this shuts down the pc normally and after it turns off the power as well

zubair (21 Mar 2011, 04:35)

plz gv me a brief discription of grep command

Hakan (02 Mar 2011, 09:36)

As a newbie, I've been using the command "poweroff" version and now Iwonder if this is a non-standart command?

amy (20 Jan 2011, 15:05)

No doubt this is a very good site to know about linus. i have problem toconfigure tomcat6. could you please add on tomcat6 details

Raj Narayan Verma (14 Dec 2010, 10:46)

Its very useful thanks

ravi (29 Nov 2010, 02:38)

disktop remote

AMAL (07 Nov 2010, 11:19)

thanku>>>>> very much

Jasbir Singh (11 Oct 2010, 06:38)

very goood site... thanks

dineshbabu (02 Sep 2010, 00:52)

thanks

jahirhuusain (16 Jul 2010, 04:46)

its very usefull,,, thanx to every one

vimal (08 Jun 2010, 22:49)

Please Notify me about new comments with explanations.


Linux Logoff and Shutdown - Linux Commands (1)I welcome your comments. However... I am puzzled by many people who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn all you can, ask questions if you like. But don't ask me to send what you already have. :-)

NO SPAM! If you post garbage, it will be deleted, and you will be banned.

Linux Logoff and Shutdown - Linux Commands (2024)

FAQs

Linux Logoff and Shutdown - Linux Commands? ›

How do I shut down my Linux system via the terminal? Use `sudo shutdown now` to shut down immediately or `sudo shutdown +10` to schedule a shutdown in 10 minutes.

How to shutdown Linux with command? ›

To shutdown the Linux system open a terminal application. Then type “ sudo shutdown -h now ” to shutdown the box. Then wait for some time and the Linux server will poweroff.

What is the logout command in Linux? ›

The logout command terminates all processes either with the same controlling terminal as the present process or with all processes which have this terminal open. Processes that are not children of the present process are terminated upon access to the terminal. The present process is also terminated.

How do you shut down a process in Linux? ›

Once the process you wish to terminate is located, you can use the killall, pkill, kill, xkill, or top commands to end it. You can use the SIGHUP, SIGKILL, or SIGTERM termination signals to initiate the Linux kill process. Use the sudo command to ensure you have the proper permissions for terminating a process.

What command is used to log out of a system? ›

Sign Out from Command Prompt

Enter the command “shutdown /l” and hit enter. Windows will sign out instantly and go back to the lock screen.

What is the shutdown key for Linux? ›

Linux operating systems can easily be stopped, shut down, and restarted using the shutdown command and its various options. Linux shutdown commands are entered in the Linux terminal that is launched by using the keyboard shortcut [Ctrl] + [Alt] + [T].

How do you reboot or shutdown Linux? ›

To reboot or shut down a Linux machine, we'll often use the systemctl (system control) command. Some commands require system administrator privileges. The root user has such privileges. So we can reboot a machine by simply typing systemctl reboot .

How do you log out of screen in Linux? ›

To exit a screen session, you can type exit or hit Ctrl+A and then D.

How do I stop a log in Linux? ›

We can use the nologin command to prevent a user from logging in. It prints a message and exits with a non-zero status code to indicate failure. We can change a user's login shell with the usermod command's -s flag.

How do I log off a user? ›

Here's how. Open the Task Manager and click on More Details. Click on the User tab. Right-click on the user and click on Sign off.

How do you shutdown a Linux program? ›

To force quit a program in a Linux terminal, you can use the "kill" command. The "kill" command sends a signal to a process, which can be used to terminate it.

How to disable shutdown in Linux? ›

The easiest way to disable shutdown and reboot commands using the /etc/sudoers file, here you can specify a user (ucartz) or group (developers) which are not allowed to execute these commands. Add these lines to Command Aliases section. Now try to execute shutdown and reboot commands as a normal user (ucartz).

How do I stop a job in Linux? ›

We use the kill command to terminate running jobs. To terminate a specific job using kill, we provide the job ID as an argument to the command. Furthermore, the % symbol is prepended to indicate that what follows is the job ID to be killed.

How do I log out on Linux? ›

Type the command 'exit' , without the quotes, and you'll be back at you original shell prompt. In Linux you can also type ctrl-d to exit.

How to shutdown command in Linux? ›

Commands to gracefully shutdown Linux
  1. Shut down gracefully after X number of minutes. $ shutdown -P +30 (P stands for Power Off) This will shut the machine down after 30 minutes.
  2. To shut down at a specific hour run; $ shutdown -P 3:00. ...
  3. To cancel a pending/scheduled shutdown just do; $ shutdown -c.

How to run shutdown command? ›

To shut down your Windows 10 PC using Command Prompt, open a Command Prompt Window, then type "shutdown /s" into the window and hit enter. Your PC will shut down in less than one minute. To restart your PC, run "shutdown /r" instead.

What is the poweroff command? ›

The poweroff command sends an ACPI signal to the hardware. This instructs the system to power down completely. Conversely, the reboot command instructs the system to restart. This involves the system shutting down and then booting up again.

What is shutdown H now in Linux? ›

The command shutdown -h now is used to initiate an immediate system shutdown on a Linux system. Here's what each part of the command means: shutdown: This is the command used to schedule system shutdowns or restarts. -h: This option specifies that the system should be halted (powered off) after shutting down.

Top Articles
Latest Posts
Article information

Author: Chrissy Homenick

Last Updated:

Views: 6267

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Chrissy Homenick

Birthday: 2001-10-22

Address: 611 Kuhn Oval, Feltonbury, NY 02783-3818

Phone: +96619177651654

Job: Mining Representative

Hobby: amateur radio, Sculling, Knife making, Gardening, Watching movies, Gunsmithing, Video gaming

Introduction: My name is Chrissy Homenick, I am a tender, funny, determined, tender, glorious, fancy, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.