CentOS basic command Learning
Learn the following command on your own
Date, clock, hwclock, cal
Ls, cd, pwd, tty, whereis, which
Stat, echo, shutdown, halt, reboot, poweroff
Who, w, whoami
After learning the above commands, we first know whether these commands are external commands or internal commands.
Type: Check whether the directory is an internal command or an external command
Type COMMAND
Internal command:
Help COMMAND
External commands:
COMMAND -- help
Command manual: manual
Man COMMAND
Whatis COMMAND to check which chapter is in
Sub-sections:
1. USER commands (/bin, // usr/bin,/usr/local/bin)
2. System Call
3. database users
4. Special files (device files)
5. File Format (Configuration File Syntax)
6. Games
7. Miscellaneous: (Minscellaneous)
8. management commands (/sbin,/usr/sbin,/usr/local/sbin)
Date:
Date-print or set the system date and time
Display the current time or set the system time according to the specified format.
-D, -- date = STRING
Display the time specified by the STRING instead of the current time
-F, -- file = DATEFILE
Display the time specified for each row in DATEFILE, just as using each row in DATEFILE as the -- date Parameter
-I, -- iso-8601 [= TIMESPEC] outputs time according to the date/time format of the ISO-8601.
TIMESPEC = 'date' (or not specified) only outputs the date, which is equal to 'urs', 'minutes ', or 'seconds' Based on the specified precision.
-R, -- reference = FILE
Display the last modification time of the FILE
-R, -- rfc-822
Specify a format to output a date based on the RFC-822
-S, -- set = STRING
Set time according to STRING
-U, -- utc, -- universal
Display or set the global time (Greenwich Mean Time)
-- Help
Show the Help file and exit
-- Version
Show version information and exit
The FORMAT controls the output FORMAT. This FORMAT is valid only when the option is set to global time. They are explained as follows:
%
Text %
%
Abbreviation of the day of the week in the current region (Sun .. Sat)
%
Full name of the day of the week in the current region (different lengths) (Sunday... Saturday)
% B
The abbreviation of the month in the current region (Jan .. Dec)
% B
The full name of the month in the current region (variable length) (January... December)
% C
Date and time of the Current region (Sat Nov 04 12:02:33 EST 1989)
% D
(Number in the month) (expressed by two digits) (01 .. 31)
% D
Date (displayed in month/date/year format) (mm/dd/yy)
% E
(In the month) number (expressed by 0) (1 .. 31)
% H
Same as % B
% H
Hour (displayed in 24-hour format, expressed in two digits) (00 .. 23)
% I
Hour (displayed in 12-hour format, expressed in two digits) (01 .. 12)
% J
(In a year) Day (represented by three digits) (001 .. 366)
% K
Hour (displayed in 24-hour format, 0 to 23)
% L
Hour (displayed in 12-hour format, expressed by 0) (1 .. 12)
% M
Month (expressed in two digits) (01 .. 12)
% M
Minutes (expressed by two digits) (00 .. 59)
% N
Line feed
% P
Whether the current time is AM or PM
% R
Time, in 12-hour format (hh: mm: ss [A/P] M)
% S
Number of seconds that have elapsed since 00:00:00, January 1, January 1, 1970 (GNU expansion)
% S
Number of seconds (expressed in two digits) (00 .. 60)
% T
Horizontal tab
% T
Time, in 24-hour format (hh: mm: ss)
% U
(In a year) day of the week, starting with Sunday as the week (expressed by two) (00 .. 53)
% V
The week (in a year) starting from Monday (expressed in two digits) (01 .. 52)
% W
The number represents the day of the week (0 .. 6); 0 represents Sunday
% W
(In a year) day of the week, Monday as the beginning of the week (expressed by two) (00 .. 53)
% X
Display the current date in mm/dd/yy format
% X
Display the current time in (% H: % M: % S) Format
% Y
The last two digits of the Year (00 .. 99)
% Y
Year (represented by four digits) (1970 ...)
% Z
Display by the digital time zone specified in the RFC-822 (for example,-0500) (for non-standard expansion)
% Z
The Time Zone (for example, EDT (US east Time Zone) is empty if you cannot decide which time zone it is.
Clock:
Clock command: set or display the approximate value of the hardware time
Required Parameters
-- Adjust automatically adjusts the hardware clock time
-- The detailed processing process is output during debug running.
-- Directisa directly accesses the hardware clock without using the device file/etc/rtc.
-- Getepoch outputs the value of the hardware clock to the standard output.
-- Hctosys clock synchronization to synchronize the system clock with the hardware clock
-- Se -- date: Set the hardware time
-- Show: display the hardware clock to the standard output
-- Systohc system time written to hardware clock
-- Test
-- Set the hardware clock time to utc in UTC.
Select Parameters
-Setepoch-epoch = <year> set the year of the hardware clock
-- Version: displays version information.
Hwclock:
Hwclock command: displays and sets the hardware clock.
Required Parameters
-- Adjust hwclock is recorded in the/etc/adjtime file every time the hardware clock is changed. With the -- adjust parameter, hwclock can estimate the hardware clock deviation based on previous records and use it to correct the hardware clock.
-- Debug displays detailed information about hwclock execution.
-- Directisa hwclock presets to access the hardware clock from the/dev/rtc device. If no access is available, you can use this parameter to directly access the hardware clock using an I/O command.
-- Hctosys adjusts the system clock to be consistent with the hardware clock. Hwclock converts the hardware time to the local time zone according to the time zone of the hardware clock,
-- Set -- date = <date and time> to set the hardware clock.
-- Show: displays the time and date of the hardware clock.
-- Systohc adjusts the hardware clock to be consistent with the system clock. When the hardware clock is set, hwclock automatically converts the system time to the time zone corresponding to the hardware clock.
-- Test only tests the program without actually changing the hardware clock.
-- Utc treats hardware time as UTC time. To use Greenwich Mean Time, add this parameter. hwclock performs conversion.
-- Localtime treats the hardware clock as the local time. At this time, hwclock does not perform time conversion.
-- Version: displays the version information.
Cal
Related commands:
Cal command: Used to view time information such as calendar. If there is only one parameter, it indicates the year (1-9999). If there are two parameters, it indicates the month and the year.
-1. view the calendar of a month.
-3. view the calendar within three months.
-H disable highlight
-J. view the calendar of Rome
-M indicates that the calendar is displayed at the beginning of Monday.
-S starts with Sunday and displays the calendar
-Y: view the calendar of 12 months
Ls: list displays the files in the current directory by default.
-L: long format
File Type:
-: Common file (f)
D: directory file
B: block Device Files)
C: character device file (character)
L: symbolic link file)
P: Command Pipeline character file (pipe)
S: socket File)
File Permission: 9 bits, each 3 bits, each group: rwx (read, write, execute), r --
Number of file hard drive links
File owner)
File group)
File size (size), in bytes
Timestamp
Access: access
Modify: modify. The file content has been modified.
Change: change, metadata, original data
-H: converts units.
-A: displays hidden files starting ".".
. Indicates the current directory
.. Indicates the parent directory
-A: List all directories except .. and ..
-D: displays the directory attributes.
-I: index node and inode; displays the node number of the file.
-R: reverse display
-R: recursive display
Cd: change directory
Home directory, home directory, home directory
Cd ~ USERNAME: Enter the Home Directory of the specified user
Cd-: switch back and forth between the current directory and the previous directory
Pwd:
Pwd displays the current directory
-L, -- logical
Show Current Directory
-P, -- physical
Displays the actual physical address of the current directory
-- Help
-- Version
Tty:
Usage: tty [Option]...
The file name of the terminal device connected to the current standard input is displayed.
-S, -- silent, -- quiet does not display anything. Only the exit status value is returned.
-- Help: displays the help information and exits.
-- Version: displays the version information and exits.
Whereis:
Syntax of the whereis command: whereis [-bmsu] [BMS directory name-f] File Name
The options of the whereis command are as follows:
-B. Locate the executable file.
-M: locate the Help file.
-S: locate the source code file.
-U searches for executable files, source code files, and help files in the default path.
-B specifies the path to search for executable files.
-M specifies the path for searching the Help file.
-S specifies the path to search for source code files.
Which:
Search for files in Environment Variables
-A: search for all content, not the first file.
-N <file name length> specifies the file name length. The specified length must be greater than or equal to the longest file name in all files.
-P <file name length> is the same as the-n parameter, but the <file name length> here includes the file path.
-W specifies the width of the field when the output is made.
-V displays the version information.
Stat:
Usage: stat [Option]... file...
Displays the status of a file or file system.
-L, -- dereference follow Link
-F, -- file-system: displays the file system status rather than the file status.
-C -- format = format: Replace the default value with the specified output format.
-- Printf = The format is similar to -- format, but it will explain the backslash escape character without using line breaks.