Generally, one uses the shutdown
command. It allows a time delay and warning message before shutdown or reboot, which is important for system administration of multiuser shell servers; it can provide the users with advance notice of the downtime.
As such, the shutdown command has to be used like this to halt/switch off the computer immediately (on Linux and FreeBSD at least):
shutdown -h now
Or to reboot it with a custom, 30 minute advance warning:
shutdown -r +30 "Planned software upgrades"
After the delay, shutdown
tells init
to change to runlevel 0 (halt) or 6 (reboot). (Note that omitting -h
or -r
will cause the system to go into single-user mode (runlevel 1), which kills most system processes but does not actually halt the system; it still allows the administrator to remain logged in as root.)
Once system processes have been killed and filesystems have been unmounted, the system halts/powers off or reboots automatically. This is done using the halt
or reboot
command, which syncs changes to disks and then performs the actual halt/power off or reboot.
On Linux, if halt
or reboot
is run when the system has not already started the shutdown process, it will invoke the shutdown
command automatically rather than directly performing its intended action. However, on systems such as FreeBSD, these commands first log the action in wtmp
and then will immediately perform the halt/reboot themselves, without first killing processes or unmounting filesystems.
shell
is the oldest of these 3 choices. It uses Emacs's comint-mode
to run a subshell (e.g. bash
). In this mode, you're using Emacs to edit a command line. The subprocess doesn't see any input until you press Enter. Emacs is acting like a dumb terminal. It does support color codes, but not things like moving the cursor around, so you can't run curses-based applications.
term
is a terminal emulator written in Emacs Lisp. In this mode, the keys you press are sent directly to the subprocess; you're using whatever line editing capabilities the shell presents, not Emacs's. It also allows you to run programs that use advanced terminal capabilities like cursor movement (e.g. you could run nano
or less
inside Emacs).
eshell
is a shell implemented directly in Emacs Lisp. You're not running bash
or any other shell as a subprocess. As a result, the syntax is not quite the same as bash
or sh
. It allows things like redirecting the output of a process directly to an Emacs buffer (try echo hello >#<buffer results>
).
Best Answer
*.*
only matches filenames with a dot in the middle or at the end. For example:*
matches the filenames above, plus the names which don't have a dot at all. for example: