设置Linux时间格式

1、永久改变显示样式,更改后的效果会保存下来(修改/etc/profile文件,在文件内容末尾加入如下内容)

[root@localhost /]# vim /etc/profile

#修改Linux显示的时间格式
export TIME_STYLE='+%Y-%m-%d %H:%M:%S'

[root@localhost /]# source /etc/profile

效果

[root@localhost dir1]# ll
总用量 0
-rw-r--r--. 1 root root 0 2021-07-31 18:36:47 file
-rw-r--r--. 1 root root 0 2021-07-31 18:13:53 file1

  

2、临时更改显示样式,当回话结束后恢复原来的样式

# 直接在命令中执行即可
export TIME_STYLE='+%Y-%m-%d %H:%M:%S'

  

https://github.com/godmaybelieve
原文地址:https://www.cnblogs.com/yuyu666/p/15083852.html