1. Command: Date2, the command function: Date can be used to display or set the date and time of the system.3. Command parameters-d-s-----version: Displays version information.4. List of date format strings%H H (00-23来 said). %I Hours (01-12来 said).
First, Shell script introductionThe shell is a scripting language, and the shell is a collection of system commands1, can use logic judgment, cycle and other grammar;It's a bit like C language, but it's fundamentally different.2, can be customized
Linux clock is divided into system clock and hardware (RealTimeClock, RTC) clock. The system clock is the clock in the current LinuxKernel, and the hardware clock is the clock powered by a battery on the motherboard. This hardware clock can be set
Defines the year, month, day, hour, and minute
Date = 'date + % Y % m % d-% H: % m'
[Root @ searchweb ~] # Date + % Y % m % d-% H: % m20120417-
In Linux, you only need to use
Date-d "X days ago" + % Y % m % d
X is replaced by a number. If
Displays the current system date settings. If used without parameters, date displays the current system date setting and prompts you to type a new date.
Grammar
Date [Mm-dd-yy] [/t]
Parameters
Mm-dd-yy
Set the specified date, where mm refers to
Usage: date [options] ... [+ format]Or: Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]
Displays the current time in the given format, or sets the system date.
-D,--date= string to display the time described by the specified string,
You need to manually modify the system's time zone to display the correct time.
1. Find the appropriate time zone file/usr/share/zoneinfo/asia/shanghai Replace the current file with this file
/etc/localtime
The first and last days of this month:
Echo 'date -- Date "$1" + "% Y-% m-01 "'
Year = 'date-d "$1" + "% Y "'Month = 'date-d "$1" + "% m "'Last_day = 'cal $ month $ year | xargs | awk '{print $ NF }''
Echo $ year-$ month-$ last_day
Calculate the
The first must be the root account.
Name: Date
Use Rights: All users
How to use:
Date [u] [D datestr] [s datestr] [--UTC] [--universal] [--DATE=DATESTR] [--SET=DATESTR] [--help] [--version] [+format] [MMDDHHMM[[CC]YY][.SS]]
Description
Dates
Lable: Set the volume label
[applicable occasions] used to mark the disk
[Usage]label display Disk volume label
label [letter] [volume name] set the volume label for the specified disk
Example
C:\>label
Volume in drive C is WANG
Volume Serial
1. Echo commandThe echo command is used in the terminal output string or variable after the value is extracted, in the format "echo [string | $ variable]".For example, the command to output the specified string "linuxprobe.com" to the terminal
The most basic requirement for a date command to display time in different time zones is to display the date and time in your time zone. But what if you have users across time zones? Or if you have friends or colleagues in different regions? You
Article Title: New School: Implementation of time in embedded Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open
UTC time & local time (1)
The whole earth is divided into twenty-four time zones, each of which has its own local time. For international radio communication, a unified time is used for the sake of unification, called Universal coordination Time
Common CentOS commands: bc, man, shutdown
This article mainly records the usage and meaning of some Linux commands, such as bc, man, and shutdown.
I. bc (a simple calculator in Linux)
In windows, a calculator tool is provided. We can use it for
& Nbsp; first, clarify a problem: 1. the time on the embedded system board is viewed using the date standard system command, and the date is the SHELL command, such as busybox or sash on uClinux. This time is maintained by running embedded LINUX
Implementation of system time in Embedded LINUX-general Linux technology-Linux programming and kernel information. The following is a detailed description. First, clarify a problem:
1. the time on the embedded system board is viewed using the date
This is the shell command and command execution, the article commands here to download Command command execution, the previous one is the shell variables, condition judgments, control structures and functions, the previous section on what is Shell,
Shell script example: calculate the time difference in milliseconds and microseconds, and shell microseconds
You can use the time command to calculate the execution duration of a command. Although the time command can be precise to milliseconds, the
We often need common users to do jobs that require root permissions, such as using the date command to modify the system date. The date command can be executed only with the root permission. There are two methods to solve this problem:
Method 1:
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.