linux view history command
In Linux, the history of bash input will be stored in the .bash_history file. history command is mainly used to display the content of historical command records and issue commands in the historical records.
Usage: First open Terminal; then enter history and hit Enter; the screen will display 1000 historical commands.
Recommended: [Linux video tutorial]
Command syntax:
history [n] history [-c] history [-raw] histfiles
Parameters:
n :数字,要列出最近的 n 笔命令列表 -c :将目前的shell中的所有 history 内容全部消除 -a :将目前新增的history 指令新增入 histfiles 中,若没有加 histfiles,则预设写入 ~/.bash_history -r :将 histfiles 的内容读到目前这个 shell 的 history 记忆中 -w :将目前的 history 记忆内容写入 histfiles。
Common commands:
history N 显示最近的N条命令,例如history 5 history -d N 删除第N条命令,这个N就是前面的编号,例如history -d 990 history -c 清空命令历史 history -a 将当前会话中的命令历史写入指定文件 echo $HISTFILE 使用此命令查看环境变量 # echo $HISTFILE /root/.bash_history echo $HISTFILESIZE 查看最大保存数目 export HISTTIMEFORMAT=’%F %T ’ 让history可以有时间戳显示
The above is the detailed content of linux view history commands. For more information, please follow other related articles on the PHP Chinese website!