`
liyixing1
  • 浏览: 953047 次
  • 性别: Icon_minigender_1
  • 来自: 江西上饶
社区版块
存档分类
最新评论

date指令,cal指令,bc指令

阅读更多
先看看date的help信息
[root@localhost ~]# date --help
Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.

  -d, --date=STRING         display time described by STRING, not `now'
  -f, --file=DATEFILE       like --date once for each line of DATEFILE
  -r, --reference=FILE      display the last modification time of FILE
  -R, --rfc-2822            output date and time in RFC 2822 format
      --rfc-3339=TIMESPEC   output date and time in RFC 3339 format.
                            TIMESPEC=`date', `seconds', or `ns' for
                            date and time to the indicated precision.
  -s, --set=STRING          set time described by STRING
  -u, --utc, --universal    print or set Coordinated Universal Time
      --help     显示此帮助信息并退出
      --version  输出版本信息并退出

FORMAT controls the output.  The only valid option for the second form
specifies Coordinated Universal Time.  Interpreted sequences are:

  %%   a literal %
  %a   locale's abbreviated weekday name (e.g., Sun)
  %A   locale's full weekday name (e.g., Sunday)
  %b   locale's abbreviated month name (e.g., Jan)
  %B   locale's full month name (e.g., January)
  %c   locale's date and time (e.g., Thu Mar  3 23:05:25 2005)
  %C   century; like %Y, except omit last two digits (e.g., 21)
  %d   day of month (e.g, 01)
  %D   date; same as %m/%d/%y
  %e   day of month, space padded; same as %_d
  %F   full date; same as %Y-%m-%d
  %g   last two digits of year of ISO week number (see %G)
  %G   year of ISO week number (see %V); normally useful only with %V
  %h   same as %b
  %H   hour (00..23)
  %I   hour (01..12)
  %j   day of year (001..366)
  %k   hour ( 0..23)
  %l   hour ( 1..12)
  %m   month (01..12)
  %M   minute (00..59)
  %n   a newline
  %N   nanoseconds (000000000..999999999)
  %p   locale's equivalent of either AM or PM; blank if not known
  %P   like %p, but lower case
  %r   locale's 12-hour clock time (e.g., 11:11:04 PM)
  %R   24-hour hour and minute; same as %H:%M
  %s   seconds since 1970-01-01 00:00:00 UTC
  %S   second (00..60)
  %t   a tab
  %T   time; same as %H:%M:%S
  %u   day of week (1..7); 1 is Monday
  %U   week number of year, with Sunday as first day of week (00..53)
  %V   ISO week number, with Monday as first day of week (01..53)
  %w   day of week (0..6); 0 is Sunday
  %W   week number of year, with Monday as first day of week (00..53)
  %x   locale's date representation (e.g., 12/31/99)
  %X   locale's time representation (e.g., 23:13:48)
  %y   last two digits of year (00..99)
  %Y   year
  %z   +hhmm numeric timezone (e.g., -0400)
  %:z  +hh:mm numeric timezone (e.g., -04:00)
  %::z  +hh:mm:ss numeric time zone (e.g., -04:00:00)
  %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)
  %Z   alphabetic time zone abbreviation (e.g., EDT)

By default, date pads numeric fields with zeroes.
The following optional flags may follow `%':

  - (hyphen) do not pad the field
  _ (underscore) pad with spaces
  0 (zero) pad with zeros
  ^ use upper case if possible
  # use opposite case if possible

After any flags comes an optional field width, as a decimal number;
then an optional modifier, which is either
E to use the locale's alternate representations if available, or
O to use the locale's alternate numeric symbols if available.

请向 <bug-coreutils@gnu.org> 报告错误。

直接运行date,由于我是中文环境,结果是:
[root@localhost ~]# date
2011年 04月 23日 星期六 13:59:20 CST

设定格式
[root@localhost ~]# date +%Y/%m/%d
2011/04/23


cal指令
[root@localhost ~]# man cal
Cannot open the message catalog "man" for locale "zh_CN.UTF-8"
(NLSPATH="<none>")

Formatting page, please wait...
CAL(1)                    BSD General Commands Manual                   CAL(1)

NAME
     cal - displays a calendar

SYNOPSIS
     cal [-smjy13] [[month] year]

DESCRIPTION
     Cal displays a simple calendar.  If arguments are not specified, the cur-
     rent month is displayed.  The options are as follows:

     -1      Display single month output.  (This is the default.)

     -3      Display prev/current/next month output.

     -s      Display Sunday as the first day of the week.  (This is the
             default.)

     -m      Display Monday as the first day of the week.

     -j      Display Julian dates (days one-based, numbered from January 1).

     -y      Display a calendar for the current year.

     A single parameter specifies the year (1 - 9999) to be displayed; note
     the year must be fully specified: “cal 89” will not display a calendar
     for 1989.  Two parameters denote the month (1 - 12) and year.  If no
     parameters are specified, the current month’s calendar is displayed.

     A year starts on Jan 1.

     The Gregorian Reformation is assumed to have occurred in 1752 on the 3rd
     of September.  By this time, most countries had recognized the reforma-
     tion (although a few did not recognize it until the early 1900’s.)  Ten
     days following that date were eliminated by the reformation, so the cal-
     endar for that month is a bit unusual.

HISTORY
     A cal command appeared in Version 6 AT&T UNIX.

OTHER VERSIONS
     Several much more elaborate versions of this program exist, with support
     for colors, holidays, birthdays, reminders and appointments, etc. For
     example, try the cal from http://home.sprynet.com/~cbagwell/projects.html
     or GNU gcal.

BSD                              June 6, 1993                              BSD

[root@localhost ~]# cal
     四月 2011     
日 一 二 三 四 五 六
                1  2
3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

显示整年的日历
[root@localhost ~]# cal 2010
                               2010                               

        一月                   二月                   三月        
日 一 二 三 四 五 六   日 一 二 三 四 五 六   日 一 二 三 四 五 六
                1  2       1  2  3  4  5  6       1  2  3  4  5  6
3  4  5  6  7  8  9    7  8  9 10 11 12 13    7  8  9 10 11 12 13
10 11 12 13 14 15 16   14 15 16 17 18 19 20   14 15 16 17 18 19 20
17 18 19 20 21 22 23   21 22 23 24 25 26 27   21 22 23 24 25 26 27
24 25 26 27 28 29 30   28                     28 29 30 31
31
        四月                   五月                   六月        
日 一 二 三 四 五 六   日 一 二 三 四 五 六   日 一 二 三 四 五 六
             1  2  3                      1          1  2  3  4  5
4  5  6  7  8  9 10    2  3  4  5  6  7  8    6  7  8  9 10 11 12
11 12 13 14 15 16 17    9 10 11 12 13 14 15   13 14 15 16 17 18 19
18 19 20 21 22 23 24   16 17 18 19 20 21 22   20 21 22 23 24 25 26
25 26 27 28 29 30      23 24 25 26 27 28 29   27 28 29 30
                       30 31
        七月                   八月                   九月        
日 一 二 三 四 五 六   日 一 二 三 四 五 六   日 一 二 三 四 五 六
             1  2  3    1  2  3  4  5  6  7             1  2  3  4
4  5  6  7  8  9 10    8  9 10 11 12 13 14    5  6  7  8  9 10 11
11 12 13 14 15 16 17   15 16 17 18 19 20 21   12 13 14 15 16 17 18
18 19 20 21 22 23 24   22 23 24 25 26 27 28   19 20 21 22 23 24 25
25 26 27 28 29 30 31   29 30 31               26 27 28 29 30

        十月                  十一月                 十二月       
日 一 二 三 四 五 六   日 一 二 三 四 五 六   日 一 二 三 四 五 六
                1  2       1  2  3  4  5  6             1  2  3  4
3  4  5  6  7  8  9    7  8  9 10 11 12 13    5  6  7  8  9 10 11
10 11 12 13 14 15 16   14 15 16 17 18 19 20   12 13 14 15 16 17 18
17 18 19 20 21 22 23   21 22 23 24 25 26 27   19 20 21 22 23 24 25
24 25 26 27 28 29 30   28 29 30               26 27 28 29 30 31
31

显示指定年份,月份
[root@localhost ~]# cal 1 2010
     一月 2010     
日 一 二 三 四 五 六
                1  2
3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

bc
[root@localhost ~]# bc --help
usage: bc [options] [file ...]
  -h  --help         print this usage and exit
  -i  --interactive  force interactive mode
  -l  --mathlib      use the predefine math routnes
  -q  --quiet        don't print initial banner
  -s  --standard     non-standard bc constructs are errors
  -w  --warn         warn about non-standard bc constructs
  -v  --version      print version information and exit

[root@localhost ~]# bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
1+1
2
quit
1+1是我输入的
2是显示的结果
quit输入后,退出
分享到:
评论

相关推荐

    linux指令命令完全手册

    在Linux命令的字母索引中,我们还可以找到如`arch`显示系统架构,`at`规划执行任务,`bc`计算器,`cal`显示日历,`chmod`改变文件权限,`compress`压缩文件,`dir`显示目录内容等。这些命令覆盖了日常使用的诸多方面...

    Linux系统常用指令

    1. **显示日期和时间**:`date` 指令用于显示当前系统的日期和时间,这对于记录或验证系统时间至关重要。 2. **显示日历**:`cal` 命令用于打印出当前月份的日历,或者指定年份和月份的日历,方便查看日期。 3. **...

    Unix命令行程序和内建指令

    6. **date**:显示或设置日期和时间。 7. **dd**:数据转换和复制工具。 8. **file**:识别文件类型。 9. **help**:显示Shell内置命令的帮助。 10. **info**:查看更详细的文档信息。 11. **size**:显示目标文件的...

    LINUX入门常用的基本命令

    1. 显示日期的指令:date date命令用于显示和设置系统的日期和时间。格式为“date [选项]... [格式]”,其中不带任何参数时,date会显示当前系统的日期和时间。用户可以通过指定格式来改变输出的日期和时间格式,...

    linux常用知识-文件结构、常用指令,适合速查

    ### Linux常用知识详解:文件结构与常用指令 #### Linux文件系统结构 Linux 文件系统的组织遵循一个清晰且逻辑化的结构,这种结构有助于用户更好地理解和管理文件。以下是对 Linux 核心目录及其用途的详细介绍: ...

    linux日常使用命令

    1. **显示日期和时间**:`date` 指令用于显示当前的日期和时间。例如,当你在终端输入 `date`,它会显示系统当前的时间和日期。 2. **显示日历**:`cal` 命令用于显示一个简单的日历。输入 `cal` 可以看到当前月份...

    鸟哥的 Linux 私房菜第05章-首次登入與線上求助 man page1

    - 指令操作:在文本模式下,用户需要熟悉基本的命令行操作,例如使用 `date` 查看日期,`cal` 显示日历,`bc` 进行计算等。 - 语系支援:系统允许用户选择不同的语言环境,确保显示的字符集正确无误,避免乱码问题...

    Linux命令详称--各命令的英文全称

    7. `bc`: 提供任意精度计算能力的语言,常用于进行数学运算。 8. `bg`: 将命令放到后台运行,让当前终端窗口可以继续执行其他任务。 9. `break`: 在循环中退出,结束当前循环的执行。 10. `builtin`: 运行Shell内置...

    Linux常用操作命令

    1. **显示日期的指令:date** - `date` 命令用于查看或设置系统的日期与时间。 - 示例:`date`(显示当前日期和时间) - 示例:`date +%Y%m%d`(显示格式化后的日期,如20230901) 2. **显示日历的指令:cal** ...

    Linux常用命令

    #### 一、显示日期的指令:date `date` 命令用于显示或设置系统的日期和时间。默认情况下,它会显示当前的日期和时间。 **基本语法:** ``` date [选项] ``` **示例:** ``` date ``` 这将显示当前的时间和日期。 ...

    linux学习鸟哥的私房菜

    - **bc**:是一个用于执行任意精度数学运算的工具。 - **cal**:用于打印日历的简单工具。 - **case**:是Shell编程中的一个重要结构,用于处理多条件分支。 - **chage**:用于修改用户密码的有效期。 - **...

    linux学习笔记.doc

    `cal`指令用于显示日历,而`bc`是一个简单的命令行计算器。查看man页时,可以使用空格、Page Up/Down、Home和End键进行导航,使用/word搜索特定内容。 在关闭Linux系统时,应首先检查系统状态,例如使用`who`、`...

    菜鸟私房钱

    `date`用于查看和设置时间,如`date +%y/%m/%d`显示年月日,`cal`用于查看日历,`bc`是计算器,`shutdown`用于关机和重启,例如`shutdown –h now`立刻关机,`shutdown –r now`立刻重启,`shutdown –k +10`发送...

    Linux 常用命令

    执行`date`后,可以得到当前系统的完整时间信息,包括年月日、时分秒等。 **2. 显示日历:** `cal` `cal`命令可以用来显示指定月份的日历。如果没有指定月份,则默认显示当前月份的日历。例如: ``` cal 8 2023 `...

    Linux4-5章1

    掌握基本的shell指令是使用Linux的基础,如`ls`用于列出目录内容,`date`显示日期时间,`cal`查看日历,以及`bc`作为计算器。此外,`Tab`键可用于自动补全命令和文件名,`Ctrl+C`用于强制终止当前运行的进程。 总的...

Global site tag (gtag.js) - Google Analytics