Geody Labs


# Main Index: Debian Linux Magic Spells Cheat Sheet (one liners, how to, tips and tricks)

# Shutdown and Reboot

Quitting a session, shutting down or rebooting system:
# Note that when a process receives a signal may behave differently from the default behavior
CTRL+C # terminate an application (sends a SIGINT (2) signal to the process, exits with Exit Code 130)
CTRL+\ # terminate the process and dump to a core file (sends a SIGQUIT signal to the process)
CTRL+D # send an EOT (End Of Tranmission) signal to the process (exits with Exit Code 0)
CTRL+Z # suspend an application (sends a SIGSUSP (20) signal to the process, exits with Exit Code 148)
return # return from a function or a sourced script
exit # exit from a non login shell
logout # logout from current session (you can also press CTRL+D )
shutdown -h now # halt the system
shutdown -h -P now # halt the system and turn off the machine (power off)
shutdown -r now # reboot the system
shutdown -r 22:00 # reboot the system at 22:00 (10:00 pm)
shutdown -r +5 # reboot the system after 5 minutes
reboot # reboot the system (like shutdown -r), might not work on older systems
reboot -f # force reboot without using shutdown

Show system reboot history:
last reboot
last -x|grep shutdown
for wtmp in `ls -t /var/log/wtmp*`; do last reboot -f $wtmp; done|grep reboot
last reboot|head -1 # Show only last reboot

Show uptime:
# A sysadmin will be judged by his uptime and by how many reboots he performed
uptime # Show uptime, total users, and load average of the system over the last 1, 5, and 15 minutes.
uptime -p # Show only uptime in pretty form
uptime -s # Show system up since (last boot)

Edit system startup script:
# Commands that will be executed when the system boots. Different runlevels are allowed.
jed /etc/inittab

Choose what command must be performed when CTRl+ALT+DEL is pressed:
jed /etc/inittab
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now




Please DONATE to support the development of Free and Open Source Software (PayPal, Credit Card, Bitcoin, Ether)

Page issued on 25-Sep-2022 04:56 GMT
Copyright (c) 2022 Geody - Legal notices: copyright, privacy policy, disclaimer