or
# shutdown -h 0
To incorporate a timed shutdown and a pertinent message to all active users, use shut down's time and message options, like so:
# shutdown -h 18:30 "System is going down for maintenance this evening"
This example shuts down your system and provides a warning to all active users 15 minutes before the shutdown (or reboot). Shutting down a running server can be considered drastic, especially if there are active users or exchanges of important data occurring (such as a backup in progress). One good approach is to warn users ahead of time. This can be done by editing the system Message of the Day (MOTD) motd
file, which displays a message to users after login. To create your custom MOTD, use a text editor and change the contents of /etc/motd
. You can also make downtimes part of a regular schedule, perhaps to coincide with security audits, software updates, or hardware maintenance.
You should shut down Fedora for only a few very specific reasons:
► You are not using the computer and want to conserve electrical power.
► You need to perform system maintenance that requires any or all system services to be stopped.
► You want to replace integral hardware.
TIP
Do not shut down your computer if you suspect that one or more intruders has infiltrated your system; instead, disconnect the machine from any or all networks and make a backup copy of your hard drives. You might want to also keep the machine running to examine the contents of memory and to examine system logs. See Chapter 14 and Chapter 30, "Securing Your Machines," for how to protect and monitor a network-connected system.
You should also use the shutdown
command to reboot your system. The fastest way to cleanly reboot Linux is to use the -r
option and the word now or the numeral zero ( 0
):
# shutdown -r now
or
# shutdown -r 0
Both rebooting and shutting down can have dire consequences if performed at the wrong time (such as during backups or critical file transfers, which arouses the ire of your system's users). However, Linux-based operating systems are designed to properly stop active system services in an orderly fashion. Other commands you can use to shut down and reboot Linux are the halt
and reboot
commands, but the shutdown
command is more flexible.
Although you learn the basics of using Fedora in this book, you need time and practice to master and troubleshoot more complex aspects of the Linux operating system and your distribution. As with any operating system, you can expect to encounter some problems or perplexing questions as you continue to work with Linux. The first place to turn for help with these issues is the documentation included with your system; if you cannot find the information you need there, check Fedora's website.
NOTE
Checking Fedora's website for security updates and bug fixes is a good idea. Browse to http://fedoraproject.org/wiki/. Alternatively, you can always do a quick yum update to make sure that your system has the most up-to-date software available.
Linux, like UNIX, is a self-documenting system, with man pages accessible through the man command. Linux offers many other helpful commands for accessing its documentation. You can use the apropos
command — for example, with a keyword such as partition
— to find commands related to partitioning, like this:
$ apropos partition
diskdumpfmt (8) - format a dump device or a partition
fdisk (8) - Partition table manipulator for Linux
GNU Parted [parted] (8) - a partition manipulation program
mpartition (1) - partition an MSDOS hard disk
MPI_Cart_sub (3) - Partitions a communicator into subgroups which form
lower-dimensional cartesian subgrids
partprobe (8) - inform the OS of partition table changes
pvcreate (8) - initialize a disk or partition for use by LVM
sfdisk (8) - Partition table manipulator for Linux
To find a command and its documentation, you can use the whereis
command. For example, if you are looking for the fdisk
command, you can do this:
$ whereis fdisk
fdisk: /sbin/fdisk /usr/share/man/man8/fdisk.8.gz
To learn more about a command or program, use the man
command, followed by the name of the command. Man pages for Linux and X Window commands are within the /usr/share/man
, /usr/local/share/man
, and /usr/X11R6/man
directories. So, for example, to read the rm
command's man page, use the man
command like this:
$ man rm
After you press Enter, the less
command (a Linux command known as a pager ) displays the man page. The less command is a text browser you can use to scroll forward and backward (even sideways) through the document to learn more about the command. Type the letter h
to get help, use the forward slash to enter a search string, or press q
to quit.
NOTE
Although nearly all the hundreds of GNU commands included with Linux each have a man page, you must use the info
command to read detailed information about using a GNU command. For example, to learn even more about bash
(which has a rather extensive manual page), use the info
command like this:
$ info bash
Press the n
and p
keys to navigate through the document, or scroll down to a menu item on the screen and press Enter to read about a specific feature. Press q
to quit reading.
Related Fedora and Linux Commands
The following programs and built-in shell commands are commonly used when working at the command line. These commands are organized by category to help you under stand the command's purpose. If you need to find full information for using the command, you can find that information under the command's man page.
► Managing users and groups— chage
, chfn
, chsh
, edquota
, gpasswd
, groupadd
, groupdel
, groupmod
, groups
, mkpasswd
, newgrp
, newusers
, passwd
, umask
, useradd
, userdel
, usermod
► Managing files and file systems— cat
, cd
, chattr
, chmod, chown, compress, cp, dd, fdisk, find, gzip, ln, mkdir, mksfs, mount
, mv
, rm
, rmdir
, rpm
, sort
, swapon
, swapoff
, tar
, touch
, umount
, uncompress
, uniq
, unzip
, zip
► Managing running programs— bg
, fg
, kill
, killall
, nice
, ps
, pstree
, renice
, top
, watch
► Getting information— apropos
, cal
, cat
, cmp
, date
, diff
, df
, dir
, dmesg
, du
, env
, file
, free
, grep
, head
, info
, last
, less
, locate
, ls
, lsattr
, man
, more
, pinfo
, ps
, pwd
, stat
, strings
, tac
, tail
, top
, uname
, uptime
, vdir
, vmstat
, w
, wc
, whatis
, whereis
, which
, who
, whoami
Читать дальше