Linux Set Date and Time From a Command Prompt

Linux Set Date and Time From a Command Prompt

by Vivek Gite on October 2, 2006 ·

from :http://www.cyberciti.biz/faq/howto-set-date-time-from-linux-command-prompt/

linux logoHow can I set the system date and time from the command prompt (bash shell)? I don't have GUI installed and I am login over ssh session. How can I set date under Linux operating systems?

Use the date command to display the current date and time or set the system date / time over ssh session. You can also run the date command from X terminal as root user.

This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from the shell prompt.

You must login as root user to use date command.

Linux Set Date

Use the following syntax to set new data and time:
date --set="STRING"

For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:
# date -s "2 OCT 2006 18:00:00"
OR
# date --set="2 OCT 2006 18:00:00"

You can also simplify format using following syntax:
# date +%Y%m%d -s "20081128"

Linux Set Time

To set time use the following syntax:
# date +%T -s "10:13:13"
Where,

  • 10: Hour (hh)
  • 13: Minute (mm)
  • 13: Second (ss)

Use %p locale’s equivalent of either AM or PM, enter:
# date +%T%p -s "6:10:30AM"
# date +%T%p -s "12:10:30PM"

See also:
  • You can also set new timzone using this mini-howto.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Command Prompt是Windows操作系统中的命令行工具。通过打开电脑的命令提示符(Command Prompt),用户可以执行各种命令和操作,例如运行程序、访问文件和文件夹、管理系统设置等。在Command Prompt中,可以使用不同的指令来完成不同的任务,比如安装Python库。对于安装Python库,可以使用以下几种方法: 1. 在命令提示符中使用pip命令进行安装:打开命令提示符,输入"pip install 包名"的指令,然后按回车键即可安装指定的Python库。 2. 使用Anaconda Prompt进行安装:打开Anaconda Prompt(Anaconda集成开发环境中提供的命令行工具),输入"conda install 包名"或者"pip install 包名"的指令,然后按回车键即可安装指定的Python库。 除此之外,还可以使用PyCharm等集成开发环境或Anaconda Navigator等图形界面工具来安装Python库,这些工具提供了更友好的界面和更方便的操作方式。 总结来说,Command Prompt是Windows操作系统中的命令行工具,可以通过输入不同的指令来执行各种任务,包括安装Python库。而对于安装Python库,可以通过命令提示符中的pip命令或使用Anaconda Prompt等工具来完成。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [Python库的几种安装方法:Pycharm、Command Prompt、Anaconda Prompt、Anaconda Navigator;常用conda命令...](https://blog.csdn.net/qq_45780647/article/details/123620613)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值