`

hp-ux 修改系统时间

阅读更多
<!--StartFragment -->
hp-ux修改系统时间
简单举一例子如下:
date -u  1016102115
date [-u] [mmddhhmm[[cc]yy]]
以上时间修改为2015年10月16日10:21
以下是man date 信息,可参考其他参数:
# man date
 date(1)                                                             date(1)
 NAME
      date - display or set the date and time
 SYNOPSIS
      date [-u]
      date [-u] +format
      date [-u] [mmddhhmm[[cc]yy]]
      date [-a [-]sss[.fff]]
 DESCRIPTION
      The date command displays or sets the current HP-UX system clock date
      and time.  Since the HP-UX system operates in Coordinated Universal
      Time (UTC), date automatically converts to and from local standard or
      daylight/summer time, based on your TZ environment variable.  See
      Environment Variables in EXTERNAL INFLUENCES below.
    Options
      date recognizes the following option:
           -u   Input and output values in Coordinated Universal Time (UTC),
                functionally equivalent to Greenwich Mean Time (GMT),
                instead of in local time.
           -a [-]sss[.fff]
                Slowly adjust the time by sss.fff seconds (fff represents
                fractions of a second).  This adjustment can be positive or
                negative.  The system's clock will be sped up or slowed down
                until it has drifted by the number of seconds specified.
    Formats
      The date command has two forms for displaying the date and time and
      one form for setting them.
           date [-u]
                   Display the current date and time.  The output is the
                   same as for the %c formatting directive for all languages
                   except the C default language.  See Formatting Directives
                   and EXAMPLES below.
           date [-u] +format
                   Display the current date and time according to formatting
                   directives specified in format, which is a string of zero
                   or more formatting directives and ordinary characters.
                   If it contains blanks, enclose it in apostrophes or
                   quotation marks.
 Hewlett-Packard Company            - 1 -       HP-UX 11i Version 3 Feb 2007
 date(1)                                                             date(1)
                   See Formatting Directives below.
                   All ordinary characters are copied unchanged into the
                   output string.
                   The output string is always terminated with a newline
                   character.
                   If + is specified and format is omitted, only a newline
                   is output.
           date [-u] [mmddhhmm[[cc]yy]]
                   Set the HP-UX system clock to the date and time
                   specified.  You require the superuser privilege.
                   If you include the -u option, the specified date and time
                   is assumed to be in Coordinated Universal Time (UTC).
                   The numeric argument is interpreted left to right in
                   two-digit pairs as follows:
                        mm   Month number [01-12].
                        dd   Day number in the month [01-31].
                        hh   Hour number (24-hour system) [00-23].
                        mm   Minute number [00-59].
                        cc   Century minus one [19-20].
                        yy   Last two digits of the year number [70-99, 00-
                             37 (1970-1999, 2000-2037)].  If omitted, the
                             current year is used.
                   If you attempt to set the date backwards, date generates
                   the warning,
                        do you really want to run time backwards?[yes/no]
                   Type yes or the equivalent for your locale to set the
                   clock backwards; anything else to cancel the command.
                   When date is used to set the date, a pair of date change
                   records is written to the file /var/adm/wtmps.
                   (UNIX Standard only, see standards(5).) No warning is
                   generated if date is set backwards.
 Hewlett-Packard Company            - 2 -       HP-UX 11i Version 3 Feb 2007
 date(1)                                                             date(1)
    Formatting Directives
      The following formatting directives, shown without the optional field
      width and precision specification, are replaced by the indicated
      characters.  If a directive is not one of the following, the result is
      undefined.
      The output for digits, characters, and words depends on the
      language/locale settings.  See Environment Variables in EXTERNAL
      INFLUENCES below.
      The examples assume that the date command was executed on Wednesday,
      January 12, 1994 at 7:45:58 p.m. Pacific Standard Time, using the C
      default language.
           %a   Abbreviated weekday name.  For example, Wed.
           %A   Full weekday name.  For example, Wednesday.
           %b   Abbreviated month name.  For example, Jan.
           %B   Full month name.  For example, January.
           %c   Current date and time representation.  For example, Wed Jan
                12 19:45:58 1994.
           %C   Century (the year divided by 100 and truncated to an
                integer) as a two-digit decimal number [00-99].  For
                example, 19.
           %d   Day of the month as a two-digit decimal number [01-31].  For
                example, 12.
           %e   Day of the month as a two-character decimal number with
                leading space fill [" 1"-"31" ].  For example, 12.
           %E   Combined Emperor/Era name and year.
           %H   Hour (24-hour clock) as a two-digit decimal number [00-23].
                For example, 19.
           %I   Hour (12-hour clock) as a two-digit decimal number [01-12].
                For example, 07.
           %j   Day of the year as a three-digit decimal number [001-366].
                For example, 012.
           %m   Month as a decimal two-digit number [01-12].  For example,
                01.
           %M   Minute as a decimal two-digit number [00-59].  For example,
                45.
 Hewlett-Packard Company            - 3 -       HP-UX 11i Version 3 Feb 2007
 date(1)                                                             date(1)
           %n   Newline character.
           %N   Emperor/Era name.
           %o   Emperor/Era year.
           %p   Equivalent of either AM or PM.  For example, PM.
           %R   Time as %H:%M
           %S   Second as a two-digit decimal number (allows for possible
                leap seconds) [00-61].  For example, 58.
           %t   Tab character.
           %u   Weekday as a one-digit decimal number [1-7 (Monday-Sunday)].
                For example, 3.
           %U   Week number of the year (Sunday as the first day of the
                week) as a two-digit decimal number [00-53].  All days that
                precede the first Sunday in the year are considered to be in
                week 00.  For example, 02.
           %V   Week number of the year (Monday as the first day of the
                week) as a two-digit decimal number [01-53].  If the week
                containing January 1 has four or more days in the new year
                (January 1 is Thursday or sooner), it is designated as week
                01; otherwise, (January 1 is Friday or later), it is
                designated as the last week of the previous year, and the
                next week is week 01.  For example, 02.
           %w   Weekday as a one-digit decimal number [0-6 (Sunday-
                Saturday)].  For example, 3.
           %W   Week number of the year (Monday as the first day of the
                week) as a two-digit decimal number [00-53].  All days that
                precede the first Monday in the year are considered to be in
                week 00.  For example, 02.
           %x   Current date representation.  For example, 01/12/94.
           %X   Current time representation.  For example, 19:45:58.
           %y   Year without century as a two-digit decimal number [00-99].
                For example, 93.
           %Y   Year with century as a four-digit decimal number [1970-
                2037].  For example, 1994.
           %Z   Time zone name (or no characters if time zone cannot be
                determined).  For example, PST.
 Hewlett-Packard Company            - 4 -       HP-UX 11i Version 3 Feb 2007
 date(1)                                                             date(1)
           %%   The % character.
    Obsolescent Directives
      The following directives are provided for backward compatibility.  It
      is recommended that the preceding directives be used instead.
           %D   Date in usual U.S. format.  For example, 01/12/94.  Use %x
                or %m/%d/%y instead.
           %F   Full month name.  For example, January.  Use %B instead.
           %h   Abbreviated month name.  For example, Jan.  Use %b instead.
           %r   Time in 12-hour U.S. format.  For example, 07:45:58 PM.  Use
                "%I:%M:%S %p" instead.
           %T   Time in 24-hour U.S. format.  For example, 19:45:58.  Use %X
                or %H:%M:%S instead.
           %z   Time zone name (or no characters if time zone cannot be
                determined).  For example, PST.  Use %Z instead.
    Modified Formatting Directives
      Some Formatting Directives can be modified by the E and O modifier
      characters to indicate a different format or specification for the
      language specified in the LC_TIME environment variable.
      If the corresponding keyword (era, era_year, era_d_fmt, and alt_digit)
      is not specified or not supported, the unmodified field descriptor
      value is used.  The command
           LC_ALL=language locale -ck era era_year era_d_fmt alt_digit
      displays the keywords and their values in the specified language (see
      locale(1)).
           %Ec       Alternate appropriate date and time representation.
           %EC       The name of the base year in alternate representation.
           %Ex       Alternate date representation.
           %Ey       Offset from %EC (year only) in the alternate
                     representation.
           %EY       Full alternate year representation.
           %Od       Day of month using the alternate numeric symbols.
           %Oe       Day of month using the alternate numeric symbols with
                     leading space-character fill if applicable.
 Hewlett-Packard Company            - 5 -       HP-UX 11i Version 3 Feb 2007
 date(1)                                                             date(1)
           %OH       Hour (24-hour clock) using the alternate numeric
                     symbols.
           %OI       Hour (12-hour clock) using the alternate numeric
                     symbols.
           %Om       Month using the alternate numeric symbols.
           %OM       Minutes using the alternate numeric symbols.
           %OS       Seconds using the alternate numeric symbols.
           %OU       Week number of the year (Sunday is the first day of the
                     week) using the alternate numeric symbols.
           %Ow       Weekday as number using the alternate numeric symbols
                     (Sunday=0).
           %OW       Weekday number of the year (Monday is the first day of
                     the week) using the alternate numeric symbols.
           %Oy       Year (offset from %C) in alternate representation.
    Field Width and Precision
      An optional field width and precision specification can immediately
      follow the initial % of a formatting directive in the following order:
           [-|0]width  The decimal digit string width specifies a minimum
                       field width in which the result of the conversion is
                       right- or left-justified.  The default is right-
                       justified with space padding on the left.  If the
                       string starts with "-", the result is left-justified
                       with space padding on the right.  If the string
                       starts with "0", the result is right-justified and
                       padded with zeros on the left.
           .prec       The decimal digit string prec specifies the minimum
                       number of digits to appear for the d, H, I, j, m, M,
                       o, S, U, w, W, y, and Y numeric directives.  If a
                       directive supplies fewer digits than specified by the
                       precision, it will be expanded with leading zeros.
                       prec specifies the maximum number of characters to be
                       used from the a, A, b, B, c, D, E, F, h, n, N, p, r,
                       t, T, x, X, z, Z, and % text directives.  If a
                       directive supplies more characters than specified by
                       the precision, excess characters are truncated on the
                       right.
      If no field width or precision is specified for a d, H, I, m, M, S, U,
      W, or y directive, the default is .2; for the j directive, the default
 Hewlett-Packard Company            - 6 -       HP-UX 11i Version 3 Feb 2007
 date(1)                                                             date(1)
      is .3; for Y, the default is .4; for w, the default is .1.
 EXTERNAL INFLUENCES
      For information about the UNIX Standard environment, see standards(5).
    Environment Variables
      LC_CTYPE determines the interpretation of the bytes within the format
      string as single- and/or multi-byte characters.
      LC_NUMERIC determines the characters used to form numbers for those
      directives that produce numbers in the output.  The characters used
      are those defined by alt_digit (see locale(1) and ALT_DIGIT in
      langinfo(5)).
      LC_TIME determines the content (for example, the weekday names
      produced by the %a directive) and format (for example, the current
      time representation produced by the %X directive) of date and time
      strings output by the date command.
      LC_MESSAGES determines the language in which messages (other than the
      date and time strings) are displayed.
      If LC_CTYPE, LC_NUMERIC, LC_TIME, or LC_MESSAGES is not specified or
      is null, it defaults to the value of LANG.
      If LANG is not specified or is null, it defaults to C (see lang(5)).
      If any internationalization variable contains an invalid setting, all
      internationalization variables default to C (see environ(5)).
      TZ determines the conversion between the system time in UTC and the
      time in the user's local time zone.  See environ(5) and tztab(4).  TZ
      also determines the content (that is, the time-zone name produced by
      the %z and %Z directives) of date and time strings output by the date
      command.
      If TZ is not set or is set to the empty string, its default value is
      EST5EDT.  If the EST5EDT or the TZ value cannot be read from the time
      zone adjustment table tztab, then date returns the time in UTC.
    International Code Set Support
      Single and multibyte character code sets are supported.
 DIAGNOSTICS
      The following messages may be displayed.
      bad conversion
              The date/time specification is syntactically incorrect.  Check
              it against the usage and for the correct range of each of the
 Hewlett-Packard Company            - 7 -       HP-UX 11i Version 3 Feb 2007
 date(1)                                                             date(1)
              digit-pairs.
      bad format character - c
              The character c is not a valid format directive, field width
              specifier, or precision specifier.
      do you really want to run time backwards?[yes/no]
              The date/time you specified is earlier than the current clock
              value.  Type yes (or the equivalent for your locale) to set
              the clock backwards; anything else to cancel the command.
      no permission
              You need the superuser privilege to change the date.
 EXAMPLES
    Date in Different Languages
      Display the date.  In this example, the TZ environment variable
      contains PST8PDT, and the language environment variables are set as
      noted.
      date    -> Fri Aug 20 15:03:37 PDT 1993  <- C (default)
      date -u -> Fri Aug 20 22:03:37 UTC 1993  <- C (default)
      date    -> Fri, Aug 20, 1993 03:03:37 PM <- en_US.roman8 (U.S. English)
      date    -> Fri. 20 Aug, 1993 03:03:37 PM <- en_GB.roman8 (U.K. English)
      date    -> 20/08/1993 15.47.47           <- pt_PT.roman8 (Portuguese)
    Set Date
      Set the date to Oct 8, 12:45 a.m.
           date 10080045
    Display Formatted Date
      Display the current date and time using a format.  Note the use of
      quotation marks due to the blanks in the format.
           date "+DATE: %m/%d/%y%nTIME: %H:%M:%S"
      The output resembles the following:
           DATE: 10/08/87
           TIME: 12:45:05
    Display Formatted Date Using Local Language Conversion
      With the date as set in the "Set Date" example above and LC_TIME set
      to de_De.roman8 (German):
           date +'%-4.4h %2.1d %H:%M'
 Hewlett-Packard Company            - 8 -       HP-UX 11i Version 3 Feb 2007
 date(1)                                                             date(1)
      generates output similar to:
           Okt   8 12:45
      where the month field is four characters long, flush-left, and space-
      padded on the right if the month name is shorter than four characters.
      The day field is two characters long, with leading zeros suppressed.
 WARNINGS
      The former HP-UX format directive A has been changed to W for ANSI
      compatibility.
      Changing the date while the system is running in multiuser mode should
      be avoided to prevent disrupting user-scheduled and time sensitive
      programs and processes.  Also, changing the date can cause make and
      the SCCS and cron subsystems to behave in an unexpected manner.  The
      cron daemon should be killed prior to setting the date backwards, then
      restarted.  SCCS files should be checked with the val command (see
      val(1)) if deltas have been made while the clock was wrongly set.
      The following formatting directives may be deleted from future
      releases: %E, %F, %o, %z.
      Currently, the maximum date supported is December 31, 2037 23:59:00
      UTC.
 AUTHOR
      date was developed by AT&T and HP.
 FILES
      /var/adm/wtmps
 SEE ALSO
      locale(1), stime(2), ctime(3C), strftime(3C), tztab(4), environ(5),
      lang(5), langinfo(5), standards(5).
 STANDARDS CONFORMANCE
      date: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2
 Hewlett-Packard Company            - 9 -       HP-UX 11i Version 3 Feb 2007
 
分享到:
评论

相关推荐

    HP-UX System Administration Tasks

    根据提供的文档信息,我们可以深入探讨HP-UX系统管理任务中的关键知识点。HP-UX是HP(现为HPE)开发的一款基于UNIX的操作系统,广泛应用于各种服务器环境之中。本手册《HP-UX System Administration Tasks》第四版...

    HP-UX系统管理(晋级培训)(212)

    - 学习如何利用这些命令来查询手册页、获取系统时间、了解用户信息以及监控系统活动。 2. **掌握vi编辑器的使用:** - 了解vi编辑器的基本概念及其启动方式。 - 掌握在vi编辑器中常见的操作模式(命令模式与输入...

    HP-UX初学小技巧

    【HP-UX初学小技巧】对于从其他Linux或Unix系统转到HP-UX的用户,可能会遇到一些适应性问题。以下是一些实用的小技巧,帮助你更好地掌握HP-UX的使用。 首先,关于shell的差异。在大多数Linux系统中,默认的shell是...

    HP-UX_11i培训文档

    `timex`查询系统时间;`top`实时显示系统资源使用情况;`vmstat`显示虚拟内存统计信息。 ### 网络命令 网络管理命令包括`ping`测试网络连通性;`netstat`显示网络状态信息;`route`管理路由表;`ifconfig`配置网络...

    5187-2211-使用 HP-UX.pdf

    《使用 HP-UX》这本书是针对HP 9000计算机系列,特别是E1202型号的操作系统HP-UX的指南。HP-UX是一种基于Unix的系统,它提供了多用户环境和高度安全的可信计算基础。该文档的生产日期为2002年12月,需要注意的是,...

    HP-UX 11i培训文档 (绝密)

    - **timex**:显示系统时间同步的状态。 - **top**:实时显示系统资源使用情况。 - **vmstat**:显示虚拟内存统计信息。 ##### 2.5 网络命令 - **ping**:测试网络连接是否可达。 - **netstat**:显示网络连接、...

    HP-UX常用命令

    本资源摘要信息将向您介绍HP-UX操作系统中常用的命令和技术,旨在提高您的系统管理和维护效率。 一、目录管理命令 * cd 命令:用于切换目录,例如 cd - 可以返回上一次的目录。 * Esc 键的使用:在命令行中可通过...

    HP-UX系统管理(晋级培训).pdf

    - **基本命令的使用**:这部分涵盖了常用的命令如`man`(用于查询命令手册)、`date`(显示系统日期时间)、`id`(显示用户ID和组ID)、`who`(显示当前登录的用户列表)、`passwd`(更改用户密码)、`echo`(输出...

    中兴通讯HP-UX系统管理专题培训教材(普通下载).pdf

    从给定的文件信息来看,这是一份关于中兴通讯HP-UNIX系统管理的专题培训教材,主要针对HP-UX操作系统进行深入讲解和操作指导。HP-UX是惠普公司开发的一款基于UNIX的操作系统,广泛应用于企业级服务器环境中,提供高...

    wxh HP-UX常用操作命令

    1. **date**:显示当前系统时间。 #### 六、环境配置 1. **alias**:定义命令别名。 2. **man [command_name]**:查看命令的手册页面,获取更多关于命令的信息。 3. **echo $PATH**:显示 PATH 环境变量的内容。 4...

    HP-UX备份与恢复宝典

    - **fbackup**:此命令用于执行HP-UX系统的备份操作,支持多种备份级别和选项,是进行系统级备份的重要工具。 - **常用方式一**: - 进入单用户模式:`#shutdown -y 0` - 挂载文件系统:`#/etc/mount -a` - 执行...

    HP-UX下通过lvmirror方式实现磁盘更换

    在HP-UX操作系统中,LVM(Logical Volume Manager)是一个重要的磁盘管理工具,它允许系统管理员动态管理和扩展存储资源。LVMmirror功能是LVM的一部分,它提供了磁盘镜像,增强了数据安全性并实现了故障切换能力。在...

    HP UX 系统管理

    ### HP UX 系统管理知识点详解 #### 一、HP-UX系统管理概述 HP-UX,即Hewlett-Packard Unix,是由惠普公司开发的一款高性能Unix操作系统,广泛应用于服务器环境中。它提供了丰富的功能来支持高可用性、可扩展性和...

    HP-UX参考手册(第4节 文件格式)

    在HP-UX操作系统中,文件格式是至关重要的组成部分,它决定了数据如何被组织、存储和访问。本节将深入探讨HP-UX中的各种文件格式,包括文本文件、二进制文件、特殊文件以及档案文件(如压缩包)的处理。 1. **文本...

    HP-UX系统管理(高级)

    ### HP-UX系统管理(高级) #### 第1章:UNIX基本使用和基本命令 ##### 1.1 课程目标 本章旨在为学员提供HP-UX操作系统基础层面的知识,包括登录、基本命令的使用等,使学员能够熟练掌握在HP-UX环境下执行常见任务的...

    User’s Reference HP-UX/HP 9000

    本手册《用户参考 HP-UX/HP 9000》主要介绍了HP-UX操作系统在HP 9000系列计算机上的配置管理与使用方法。HP-UX是惠普公司基于Unix的操作系统之一,广泛应用于各种服务器和工作站环境中,特别是在HP 9000系列计算机上...

Global site tag (gtag.js) - Google Analytics