One, time zone1. View the current time zoneDate-r2. Modify the settings time zoneMethod (1)TzselectMethod (2) limited to Redhat Linux and CentOSTimeconfigMethod (3) applies to DebianDpkg-reconfigure Tzdata3. Copy the appropriate time zone file, replace the system
1.Date Displays system time, dateDate + "%y-%m-%d%h:%m:%s"2015-07-02 14:32:15Date%Y four-bit format printing yearDate%y Two-bit format printing yearDate%m MonthDate%d DayDate%H HoursDate%M minutesData%s seconds2. time of the day before useDate-d "-1 day" +%dOne hour before useDate-d "-1 Hour" +%hOne minute before useDate-d "-1 min" +%m3. system time (date) and ha
First, revise the Beijing time zone
Here old left to modify the time zone as the default, if there are other needs, you can modify the corresponding.
The code is as follows
Copy Code
Rm-rf/etc/localtime #先删除默认的时区设置
Ln-s/usr/share/zoneinfo/asia/shanghai/etc/localtime #替换上海/Beijing as Default
Second, manually modify the current system
View/modify Linux time zone and timeOne, time zone1. View the current time zoneDate-r2. Modify the settings time zoneTzselect3. Copy the appropriate time zone file, replace the system time
Linux Server Vsftp Service at the time of the machine and the time after the FTP connection is inconsistent resolutionThe time on this machine[email protected] ctrl]$ LLTotal 112-rw-r--r--1 wxbftp wxbftp 163 Jan 6 05:54 Miliao_20170106_103e2c8fb4d649d1b607a07426112384.json-rw-r--r--1 wxbftp wxbftp 2 Jan 6 05:54 MILIAO_
In Linux systems, there are many occasions when a timestamp is used to represent the time, from January 1, 1970 to the current number of days or seconds. Date and date +%s display the current time and time stamp
How to convert from timestamp to standard time. Format such
This article address http://comexchan.cnblogs.com/, author Comex Chan, respect intellectual property rights, reproduced Please indicate the source, thank you!Backing up the time zone configuration fileCp/etc/localtime/etc/localtime. ' Date +%y%m%d.%h%m%s 'Modify Time ZoneCp/usr/share/zoneinfo/asia/shanghai/etc/localtimeView EffectsDate-r=====================================================This article addre
1.uptime commandOutput: 16:11:40 up, 4:21, 2 users, load average:0.00, 0.01, 0.002. View the/proc/uptime file calculation system start timeCat/proc/uptimeOutput: 5113396.94 575949.85The first number is the system has been running for 5,113,396,.94 seconds, using the System tool date to calculate the system boot time
Code: Select All
date -d "$(awk -F. ‘{print $1}‘ /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
Output: 2008-1
input, 01-12
%j
Date in year, 001-366
%m
Month in year, 01-12
%M
Points, 00-59
%p
Morning or afternoon
%s
Seconds, 00-60
%u
Day of the week, 1-7
%w
Day of the week, 0-6
%x
Date in local format
%x
Time in local format
%y
Last two digits in the year, 00-99
Questions about time programming under Linux:1. Time-related structures under Linuxstruct Timeval{int tv_sec;int tv_usec;};Where Tv_sec is the number of seconds from the beginning of the morning, Tv_usec is microseconds (10E-6 second).struct TIMEZONE{int tv_minuteswest;int tv_dsttime;};Tv_minuteswest is the time dif
Just installed a system, this system verification must be with his server time consistent to enter the background.Entering date on your own server was found to be quite different from the standard time.The next step is to modify the server timeGeneral Repair Linux Server time should use the command:Ntpdate Time Server
First, the time to modify LinuxUnder root user, use the date command: date-s1. Only modify the date, do not modify the time, enter:-Geneva-2. Modify the time only, enter::xx 3. Also modify the date time, note to add single/double quotation marks, date and time there is a spa
The following function, GET_TIME_STR, implements the ability to get local time in the kernel.He first gets the UTC time and then translates the cost to time based on the system's time zone timezone,The time is finally exported to the output buffer in the form of a string of
For some people it doesn't matter how long the system has been running, but this is important information for the server administrator. When the server is running important applications,Must try to ensure long-running stable operation, and sometimes even require zero downtime. So how do we know how long the server has been running? In the Linux system, the following methods can be used to query.1.uptime Command2. View the/proc/uptime file calculation
The system time and local time were not always correct when the machine was debugged, and the beginning thought it was time error,
Then find the use of Ntpdate-u 211.115.194.21 synchronized network time, but still wrong, compared with the local only found that there is always a difference of eight hours,
Find it
From time to time, linux will give a beep sound on the virtual machine, and the audience will be upset. as a result, we finally cannot stand it. we decided to completely solve this problem. The solution is as follows: 1. it takes effect immediately, it will also take effect after the restart. The global configuration file is used. when it is started, the file wil
# Include # Include # Include
Struct timeval tvpre, tvafter;Gettimeofday ( tvpre, null );Sleep (3); // This is Linux programming. This sleep is in seconds.Gettimeofday ( tvafter, null );Ast_log (log_notice, "prepaid_staff_log: Test spend time is % d msecond./N", (tvafter. TV _sec-tvpre. TV _sec) * 1000 + (tvafter. TV _usec-tvpre. TV _usec)/1000 );
The output is 3002 milliseconds.
Here we need to know
One, Linux time management basicshttp://blog.csdn.net/droidphone/article/details/7975694http://blog.csdn.net/smilingjames/article/details/6205540Linux All-time basis is based on low-level hardware, low-level hardware has GPT and CPU local timer, such as the GPT clock source for the 13M hzlinux low-level time architectu
Let's start by outlining the 3 main commands for time zone/system time/hardware times.Tzselect#tzselect command mainly for the time zone setting and viewing the abbreviation of #tz=timezone, literal translation = time zone date#date command mainly for the system time setting
Answer:To view the system time using the date commandView current time zone, +0800 East Eight (geographical knowledge, not explained)[Email protected] ~]# Date-rsun, 2017 23:39:06 +0800If it is not China time zone, fix method: CentOS6:Cp/usr/share/zoneinfo/asia/shanghai/etc/localtimeCentOS7:Timedatectl Set-timezone Asia/shanghaiNoteToday is the 104th Day of the d
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.