History displays the time information

简介: For those of you who use terminals a lot, one of the most common commands is probably history, which allows you to view the history of terminal commands executed

history 执行很简单:如下:参考

pi@raspberrypi:~ $ history

1  clear
2  ls
3  sudo apt update
4  df -h
5  sudo apt install vim
6  sudo reboot
7  clear
8  ls
9  sudo apt install vim

10 locale

Sometimes, however, we want to get more historical information, such as the time when a command was executed, to determine some actions.

针对 bash 这样设置

echo 'HISTTIMEFORMAT="%F %T "' >> ~/.bashrc
source ~/.bashrc

然后再次执行
history

1  2022-02-06 21:55:32 clear
2  2022-02-06 21:55:32 ls
3  2022-02-06 21:55:32 sudo apt update
4  2022-02-06 21:55:32 df -h
5  2022-02-06 21:55:32 sudo apt install vim
6  2022-02-06 21:55:32 sudo reboot
7  2022-02-06 21:55:32 clear
8  2022-02-06 21:55:32 ls
9  2022-02-06 21:55:32 sudo apt install vim

10 2022-02-06 21:55:32 locale

However, for terminals that use the ZSH environment (such as OHmyzsh), the above configuration does not take effect, and history-i is required

history -i

1  2020-07-05 16:48  mv ~/Downloads/aaaaa.zip ./
2  2020-07-05 16:48  unzip aaaaa.zip
3  2020-07-03 21:58  export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;
4  2020-07-03 21:58  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
5  2020-07-03 22:10  sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
6  2020-07-03 22:13  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"\n
7  2020-07-03 22:44  cd OneDrive





目录
相关文章
|
5月前
|
Oracle 关系型数据库 数据库
Active Data Guard Real-Time Cascade
12c 的 Cascaded Standby 数据库
51 7
有趣的 events_statements_current 表问题
有趣的 events_statements_current 表问题
156 0
We cannot activate inspection type for article master in transaction code MM41?
We cannot activate inspection type for article master in transaction code MM41?
We cannot activate inspection type for article master in transaction code MM41?
|
算法 前端开发 弹性计算
译《Time, Clocks, and the Ordering of Events in a Distributed System》
Motivation 《Time, Clocks, and the Ordering of Events in a Distributed System》大概是在分布式领域被引用的最多的一篇Paper了。
907 0
0227show all segment level statistics
[20180227]show all segment level statistics.txt https://orainternals.wordpress.com/2013/06/12/dude-where-is-my-redo/ REM Author : Ri...
1015 1
|
容器 安全 物联网
Speed Matters: How To Process Big Data Securely For Real-time Applications
Big Data processing has stepped up to provide organizations with new tools and technologies to improve business efficiency and competitive advantage.
1314 0
Speed Matters: How To Process Big Data Securely For Real-time Applications
|
SQL
Remote table-valued function calls are not allowed
在SQL Server中,在链接服务器中调用表值函数(table-valued function)时,会遇到下面错误:   SELECT * FROM LNK_TEST.TEST.DBO.TEST(12)   消息 4122,级别 16,状态 1,第 1 行   Remote table-valued function calls are not allowed.   以前几乎没有在链接服务器(Linked Server)当中调用过表值函数,查了一下资料,看来SQL Server这似乎是不支持的(抑或是不允许)的。
1413 0