Linux common commands type, date

Linux command type:

         Built-in command (shell built-in): cd is shell builtin

        External command: command is / usr / bin / command, a command name corresponding to the path of the executable file in a file system

type: Displays the command specifies what type of command belongs

type cd

 

 The results showed that the cd command is built-in command

type date

 The results show date command is an external command, that is a date the executable file / usr / bin / directory

 

Environment: Environment variables are named memory space

        Variable assignment:

                NAME=Jerry

        System environment variable PATH: the use of colon-separated path, the Linux commands printenv can print system environment variables, any executable program is executed to find the PATH from the inlet, the inlet as JAVA code program as the main method;

         Implementation of hash command to view the command path and the current use of cache hits

 

date: Time Management

Windows system time management tool is NTP (Network Time Protocol);

Linux system clock management tool is the RTC (Real Time Clock), that is, the real-time clock chip, the use of spare lithium batteries in the event of power failure continues to record time, so as to ensure the accuracy of time.

The expansion of knowledge:

       Linux systems have points of the system time and hardware time:

       System Time: Generally the date command execution time is what we see, all the time calling linux system (except for the command to directly access the hardware time) this time are used.

       Hardware time (hwclock): motherboard BIOS time, the battery from the motherboard to maintain the operation, this time to read system boot, and to set it in accordance with the system time (Note: The system is set according to the hardware at system startup time when the process in terms of the time zone may be present, depending on the particular system and related setting).

Execution date command to obtain the system time

 

 Hwclock command execution, the time available hardware, ie hwclock Hardware Clock, This command can be executed as root

 

Execute man date, the user can view the order date command, or use the date --help help documentation

 

 

date +% D, displays the current date in the format year month day

 

 

date +% T, the current time

 

 

date +% Y, displays the current year

 

 

date +% y, displays the current year Acronym

 

 

Application practice:

1, view the current system time date:

 

2, the system time provided time date -s +

 

 

 

3, when setting the system time, if required to set the date, the date and time values ​​will have wrapped in double quotes

 

4. Check the hardware time with hwclock command:

 

5, the hardware time is written to the system time, execution hwclock -s, and then use the date to see if there is time and hardware time consistent:

 

 

 

6, the system time to hardware time to write, perform hwclock -w:

 

 

7, time synchronization, Linux systems need to install ntpdate

Check whether the installation ntpdate: rpm -qa | grep ntpdate

If it is not installed, run the following command: yum install ntpdate

Time synchronization command: ntpdate www.pool.net.org, which www.pool.net.org is the Internet standard time servers

 

8, contab command

Through vi etc / crontab command to see / write timing of the task format

[root@surfer ~]# vi/etc/crontab

SHELL = / bin / bash #SHELL variable specifies which shell to use the system

PATH = / sbin: / bin: / usr / sbin: / usr / bin #PATH variable specifies the path to the system to execute a command

MAILTO = root #MAILTO variable specifies crond task execution information will be sent to the root user via e-mail, if the MAILTO variable is null, then does not transmit information to the user task execution

 

References: https: //blog.csdn.net/qq_20663229/article/details/80812215

https://blog.csdn.net/qq_20663229/article/details/80812215

Guess you like

Origin www.cnblogs.com/wx170119/p/12055475.html