How do I shutdown another computer using Ubuntu terminal?

ubuntu server

It is quite simple to restart, logout and reboot your computer in Linux’s operating system. Primarily to interact or to communicate with the operating system, commands are input into the terminal to get jobs done. 

But with time they have changed and improved the way of communicating with the OS so that it becomes easy for newbies to use Linux smoothly. The terminal will help you to get your things done and it could any of the things I mentioned above like rebooting, logging off from your account and shutting down your system.

Linux is an open-source unix-like operating system for computers, mobiles, servers mainframes, and other embedded devices. It happens to be one of the most widely supported operating systems accross the globe.

Once you get used to the terminal you will want to stick to the terminal and there are a few who always leave their terminal session open. Here, I am going to show you how to reboot, shutdown and log off PC from a terminal with the help of command-line in Ubuntu and Linux Mint.

The commands are available on any Linux systems like Ubuntu, Debian, fedora, and centos and there is no need to install extra packages.

# 1 How to Shutdown Linux Ubuntu & Mint using the command line in Terminal

Before we start with commands, make sure yo have saved important stuff because the things we will do here can end the session immediately without notice, so it’s definitely a good idea to back up things, so -if by chance you turn off your computer nothing gets lost. Here we will show you how to shut down your computer using the command line in the terminal.

  • At first, head to computer >Accessories > Terminal Emulator
  • When the terminal window appears in front of you, you have put the right command to shut down your computer.

       sudo  shutdown  -h now  

The H options actually mean Halt which is to stop. The second element “Now” show time parameter and it means that the system will shut down right away.

If you want to shut down your computer later but wish to put the command now, then you have to mention the time by adding “ + “ sign and then the specified time after which you want it to shut down.

Suppose you want to shut it down after 20 minutes then the command should be :

Type in   sudo  shutdown + 20

This is the command line you have to put in the terminal to proceed. They will ask for passwords as you are the administrator. And when you put the passwords, your computer will automatically initiate the shutdown procedure.

# 2 Now we will show you How to reboot Ubuntu and Mint using commands in Terminal

The reboot command can be used to reboot or shutdown Linux. Using the terminal for Rebooting your system is very simple.

Here is how to do that: 

  • At first, head to computer >Accessories > Terminal Emulator
  • When the terminal window appears in front of you, you have put the right command to shut down your computer.

Just type in: #  reboot  

The above-given command will help you to reboot your Linux OS. It will seamlessly restart your machine. 

To power off your system type    #  reboot – p

Here the parameter “p” stands for power off. It will smoothly shut down your p.c

You can also Reboot Linux forcibly and here is how to do that :

Just type in: #  reboot -f

This command will help you to reboot your system forcefully and is quite similar to pressing the power button of the CPU. There is no shutdown, the system will reset instantly.

Let’s roll on how to Logg-off your user account in Linux

# 3  How to Log-off your account form Terminal using command lines in Ubuntu and Mint?

These command lines in the terminal would help you to log you out of the current desktop session and you can also try the manual one if you want.

Here is how to do it :

  • At first, head to computer >Accessories > Terminal Emulator
  • When the terminal window appears in front of you, you have put the right command to shut down your computer.

Now to logout from your current session please type the specified code in the terminal 

  gnome – session- save  – – logout

  Or

  gnome – session- save  – -force – logout

The first code will help you to normally log out your session in your system.

The second line of code will not be necessary if the first code works out for you and if not, then you can go for the second one. It will forcefully log out of your current session from your system.

I completely believe that this process will definitely work out for you if you are doing it right and still if it causes any trouble then just use  “Ctrl + d” to log out from the recent session.

Ctrl + D basically takes you out of the terminal directly.

Coming to a conclusion 

Today in this article we have discussed on How to reboot, shutdown, log off PC from Terminal by command-line in Ubuntu and Linux Mint step by step.

If you are new to this, then you have to be very attentive and precise while commanding into the terminal and if you are in this realm for a few years now, then you know how simple it is to get your job done just by putting simple commands in the Terminal.