Linux Introduction (i) authority command System Management

Source: Internet
Author: User

First, the Authority directive

Normal users need to use sudo or root super Administrator to execute permission commands.

Second, the Linux system init program (1) Run the INIT program (reference runoob.com)

The init process is the starting point for all processes in the system, and you can compare it to the ancestor of all processes in the system, without which any process in the system will not start.

The INIT program first needs to read the configuration file/etc/inittab.

Run level

Many programs need to boot up. They are called "services" in Windows, and in Linux they are called "daemons" (daemon).

One of the major tasks of the Init process is to run these boot-up programs.

However, different applications need to start different programs, such as when serving as a server, the need to start Apache, as a desktop is not required.

Linux allows different start-up programs to be assigned for different occasions, which is called "RunLevel" (runlevel). That is, at startup, depending on the runlevel, determine which programs to run.

The Linux system has 7 runlevel (runlevel):

    • RunLevel 0: System down state, system default RunLevel cannot be set to 0, otherwise it will not start normally
    • RunLevel 1: Single User working status, root privilege, for system maintenance, remote login Forbidden
    • RunLevel 2: Multi-User State (no NFS)
    • RunLevel 3: Full multiuser State (with NFS), enter console command line mode after login
    • Run Level 4: System not used, reserved
    • Run level 5:x11 console, login to GUI mode
    • RunLevel 6: The system shuts down gracefully and restarts, the default runlevel cannot be set to 6, otherwise it will not start normally
(2) Init instruction

The init instruction must be executed under root authority.

Grammar

init [0123456Ss]

0-6: Represents the 7 levels that the system is running.

s or S: Used with power-on execution Level 1 o'clock, indicating that the/etc/inittab file is not referenced after booting.

A. Execute under normal user, prompt root permission required

B. Under the normal user root authorization normal execution

C.root Super Admin execution

Second, shutdown and restart (1) shutdown

Using the shutdown command before the system shuts down, the system administrator notifies all logged-on users that the system will be closed. And the login command is frozen, that is, the new user can no longer log in. It is possible to shut down directly or delay a certain amount of time before shutting down, and it may be possible to restart the computer. This is determined by the signal that all processes will receive from the system. This allows programs like VI to have time to store documents that are currently being edited, while programs like mail and news can normally leave and so on.

Shutdown does its job of sending a signal to the INIT program, requiring it to change the runlevel. Runlevel 0 is used to shut down,runlevel 6 is used to reboot the system, while Runlevel 1 is used to get the system into the state that the management work can take place.

A.shutdown syntax

shutdown [options] [TIME] [warning message]

Parameter options for B.shutdown

1.shutdown--help Display Parameters

2.shutdown Other parameters

-C: Cancellation of instruction execution;

-F: Do not perform fsck when restarting;

-F: Perform fsck upon reboot;

-H: Shut down the system;

-K: Just send out information to all users, but not actual shutdown;

-N: Do not call the INIT program to shut down, but by the shutdown themselves;

Restart after-r:shutdown;

-t< seconds;: How many seconds to delay between sending the warning message and deleting the message.

(2) Halt directive

The function of the halt command is to shut down the system, and its usage rights are super users.

Halt is called Shutdown-h. The halt executes, kills the application process, executes the system call of sync (which forces data stored in buffer to the hard disk), and stops the kernel after the file system writes are complete. If the operating level of the system is 0 or 6, the system is shut down, otherwise the shutdown instruction (plus the-h parameter) is replaced.

A. Syntax

Halt [Options]

B. Parameter options

-N: Do not write the memory data back to the hard drive before shutting down, prevent the sync system from being called, it is used after patching the root partition with fsck to prevent the kernel from overwriting the patched super block with the old version of the Super block.

-W: Not really shut down, just write the records in the/var/log/wtmp file.

-D: Do not write the record in the/var/log/wtmp file (-n This parameter contains the-D)-F: Forced shutdown, do not call shutdown this command

-I: Stop all network-related devices first before shutting down the machine

-P: When shutting down, by the way of the Power Off (Poweroff) action

(3) Reboot restart

The Linux reboot command is used to restart the computer.

If the system has a runlevel of 0 or 6, reboot, or replace it with the shutdown instruction (plus the-r parameter)

A. Syntax

Reboot [Options]

B. Parameter options

-N: Do not write the memory data back to the hard drive before rebooting

-W: does not really reboot, just writes the records to the/var/log/wtmp file.

-D: Do not write the record in the/var/log/wtmp file (-n This parameter contains-D)

-F: Force re-boot, do not call shutdown this command

-I: Stop all network-related devices first before re-booting

(4) Poweroff

The Poweroff command is used to shut down the computer's operating system and power off.

A. Syntax

Poweroff [Options]

B. Parameter options

-N: Do not perform sync operation when shutting down the operating system;

-W: does not really shut down the operating system, only in the log file "/var/log/wtmp";

-D: When the operating system is shut down, the operation is not written to the log file "/var/log/wtmp" to add the corresponding record;

-F: Force shutdown of the operating system;

-I: Shut down all network interfaces before shutting down the operating system;

-H: Set all hardware in the system to standby mode before shutting down the operating system.

(5) The init instruction is described above and is not repeated here.

Linux Introduction (i) authority command System Management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.