Linux basic commands (4) commands for shutting down and viewing system information

Source: Internet
Author: User
Tags time and date

Commands for shutting down and viewing system information
Command Description
Shutdown Normal shutdown
Reboot Restart your computer
Ps View current program execution status
Top View current program execution scenarios and memory usage
Kill Terminate a process
Date Change or view the current date
Aa. Show Calendar and Calendar
4.1 shutdown Command

To use this command, the root user must be guaranteed, otherwise the SU command will be used to change to the root user. The command format is as follows:

shutdown– (option)

Options Function
-K Not a real shutdown, just a warning order.
-R Restart after shutdown
-T Shut down within the specified time

Join to shut down within 2min, enter command:

Shutdown–t 2

If this is a reboot after shutdown, enter the command:

Shutdown–r

4.2 reboot Command

This command is also a shutdown command, only input, without any parameters, the system will be the fastest speed shutdown, and do not write memory or buffer contents back to the hard disk.

Options Function
-D Do not write the records in the/var/log/wtmp file (-n This parameter contains-D)
-F Forced re-boot, no call to shutdown this command
-N Do not write the memory data back to the hard drive before rebooting
-W Doesn't really reboot, just writes the records to the/var/log/wtmp file.
4.3 ps command

The PS command is used to see what programs are in progress in the computer system and how they are executed. This is a fairly powerful command that can be used to find out all the process IDs and names. In addition, the PS command can be used to list all programs that use memory. Use the following:

PS – (option)

Options Function
-L List in long format
-U List the name and usage time of the consumer
-M List the memory distribution situation
-R Only the foreground programs that are being executed are listed, and no additional information is listed
-X List all programs, including those with no terminals
4.4 Top Command

The top command can view the current program's execution scenarios and memory usage. It is similar to PS, however, it updates the system state for a few seconds and is easy to track. To get out of this program, press CTRL + C key to do it.

4.5 kill command

The KILL command is used to terminate a process that is executing. If a program fails during execution, you can terminate the program to avoid remaining in memory and consuming system resources. However, its practical significance is to send a signal to the executing program, calling it suicide. Can send a lot of signals to these programs, also can let them receive signal after doing a lot of things. Standard usage:

kill– (option) PID

Before the KILL command is executed. You can use the PS command to check the PID of a program that is down, and then remove a program by using kill. For example, to terminate a program with PID 90:

Kill 90

Options Function
-L List all available signal names
-P The printed PID does not send a signal
-signal The available signals are HUP (1), KILL (9), term (15), respectively, representing the re-run, chop off, and end

Cut down the stroke of the PID 323 (Kill):

Kill-9 323

To re-run the 456-PID Stroke (restart):

Kill-hup 456

4.6 Date Command

The date command is used to display, set, and modify the current time and date. Standard usage:

date– (option) Display time format (beginning with +, plus format)
Date set time format

Options Function
-U Use GMT
-R Last time the file was modified
-S Set the time

Several commonly used time formats are shown in the following table:

Format Description
%a Abbreviations for the day of the week, such as one, two or three
%A Full name of the day of the week, e.g. Monday, Tuesday
%d Date (mm/dd/yy format)
%T Display time format, 24-hour (HH:MM:SS)
%x Format of the display date (MM/DD/YY)
%y The last two digits of the year
%Y Years (e.g. 2007, 2008)
%r Time (Hh:mm:ss morning or afternoon)
%p Show morning or afternoon

If you enter a command:

Date "+%x,%r"

The system returns the following information:

March 26, 2010, 18:06 P.M. 49 seconds

4.7 cal Command

The CAL command has two functions: a monthly calendar and a calendar.

The direct Input CAL command displays a monthly calendar for the current month.

To display a year's annual calendar, you can add a 4-digit year of A.D. to the Cal command. For example, to display a 2008 year calendar, you must enter:

Cal 2008

If you enter Cal 08, the Year 8 calendar is most displayed.

To view only a January calendar for a given year, you can enter: Cal month AD year. For example, enter: "Cal 12 2004".

Linux basic commands (4) commands for shutting down and viewing system information

Related Article

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.