Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
519 views
in Technique[技术] by (71.8m points)

linux - 如何在终端中获取当前日期和时间并在终端中为其设置自定义命令? [关闭](How to get the current date and time in the terminal and set a custom command in terminal for it? [closed])

I have to check the time in linux terminal.

(我要检查linux终端的时间。)
What is the command for getting date and time in Linux terminal ?

(在Linux终端中获取日期和时间的命令是什么?)
Is there any way in which we can set custom function ?

(有什么方法可以设置自定义功能吗?)

  ask by harshal translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The command is date

(命令是date)

To customise the output there are a myriad of options available, see date --help for a list.

(要自定义输出,可以使用多种选项,请参阅date --help帮助列表。)

For example, date '+%A %W %Y %X' gives Tuesday 34 2013 08:04:22 which is the name of the day of the week, the week number, the year and the time.

(例如, date '+%A %W %Y %X'给出Tuesday 34 2013 08:04:22这是星期几的名称,星期数,年份和时间。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...