Ubuntu is a widely used operating system because of its versatile features and security. Most of the professional programmers like to work on it but we don’t like to waste our time when it comes to performing basic functions of the computer through GUI. In this article, we will write an alias to Shutdown a computer using just a single word.
alias shut='echo | sudo -S shutdown now'
In this command, we need to put our password and it will pass it to sudo command while running so you don’t need to put it manually each and every time. As we need root privileges to shutdown our system so we are using sudo, ‘now’ after shutdown command shows we don’t want to wait or set any particular time at which we’d want our system to turn off. We can set particular time as well, Also if we use ‘shutdown -h’, It will shut down exactly after 1 minute.
Alias command is being used to tell our system that whenever we put command ‘shut‘, We’d like it to run this lengthy code.
As alias are not permanent and often session-oriented so we need to put it in .bashrc file to make this alias permanent. To open the .bashrc file in vim, We’ve to use this command ‘vim ~/.bashrc’
Once we are into our bashrc, We need to put this whole alias into the bunch of aliases present in it and to save and quit the .bashrc we need to use :wq command. This command is now bash oriented and will work for every session.
Whenever we will use shut on our terminal, It will shut down our system immediately!
- Making your own Linux Shell in C
- Get to know Ubuntu 18.04 LTS | Welcome Bionic Beaver!!
- Interesting Facts about Ubuntu
- How to setup cron jobs in Ubuntu
- shutdown command in Linux with Examples
- alias command in Linux with Examples
- Creating custom domain name instead of localhost in Ubuntu
- Creating and Configuring Wi-Fi Hotspot in Ubuntu
- How to change login screen background in Ubuntu
- Configuring and Accessing Google Drive Account in Ubuntu
- How to speed up the downloading of packages using apt-fast in Ubuntu?
- How to Install Chrome in Ubuntu?
- Configuring Face Unlock in Ubuntu | Howdy
- Installing and Configure vim Plugin in Ubuntu
- How to Install and Configure Docker in Ubuntu?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.