Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

讓 ll 顯示完整年月日時分秒的 alias 設定

在 Linux 中,預設的 ls -l 不一定顯示完整年月日與時分秒。若希望 ll 顯示完整時間,可使用 --time-style 參數。

ls -lh --time-style=+"%Y-%m-%d %H:%M:%S"

可建立 alias:

alias ll='ls -lh --time-style=+"%Y-%m-%d %H:%M:%S"'

之後執行 ll,即可看到完整時間格式。

[root@linux boot]# ll
total 13M
-rw-r--r-- 1 root root 69K 2011-01-14 06:40:04 config-2.6.18-238.el5PAE
-rw-r--r-- 1 root root 69K 2016-09-06 06:26:21 config-2.6.18-412.el5PAE
drwxr-xr-x 2 root root 1.0K 2016-10-19 23:26:18 grub

若要永久生效,可將 alias 寫入 shell 設定檔,例如 ~/.bashrc。

Copyright © Linux教程網 All Rights Reserved