[root@AWS ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@AWS ~]# uname -a
Linux AWS 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@AWS ~]#bash
根據需求,有三種不一樣的設置環境變量的方法。.net
注意:不要忘了在最後那個單引號前加上空格,不然輸出會很混亂的。htm
方法 1:get
運行下面命令爲爲當前用戶臨時設置 HISTTIMEFORMAT 變量。這會一直生效到下次重啓變量
# export HISTTIMEFORMAT='%F %T 'file
方法 2:grep
將 HISTTIMEFORMAT 變量加到 .bashrc 或 .bash_profile 文件中,讓它永久生效方法
# echo 'HISTTIMEFORMAT="%F %T "' >> ~/.bashrcrbac
#source~/.bashrc環境變量
方法 3:
將 HISTTIMEFORMAT 變量加入 /etc/profile 文件中,讓它對全部用戶永久生效
[root@AWS ~]# echo 'HISTTIMEFORMAT="%F %T "' >> /etc/profile
[root@AWS ~]# source/etc/profile
[root@AWS ~]# history
970 2020-10-19 10:52:08 kubectl get pod -A | grep kfserving
971 2020-10-19 10:52:08 kubectl get all -A | grep kfserving
972 2020-10-19 10:52:08 kubectl get logs pod/kfserving-controller-manager-0 -n auth
973 2020-10-19 10:52:08 kubectl get logs pod/kfserving-controller-manager-0 -n kubeflow
974 2020-10-19 10:52:08 kubectl logs -f pod/kfserving-controller-manager-0 -n kubeflow
975 2020-10-19 10:52:08 kubectl logs -f pod/kfserving-controller-manager-0 kube-rbac-proxy -n kubeflow
976 2020-10-19 10:52:08 kubectl logs -f pod/kfserving-controller-manager-0 manager -n kubeflow
參考:
https://www.jb51.net/article/133170.htm