如果没有线路号码,我如何获得Ubuntu终端历史记录?
historyhistory命令以行号返回前面的命令。我在找这样的东西:
cd tizen-sdk\tools
ls而不是
924 cd tizen-sdk\tools
925 ls发布于 2016-10-20 13:35:58
您可以使用fc命令代替。来自help fc:
fc: fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command]
Display or execute commands from the history list.
fc is used to list or edit and re-execute commands from the history list.
FIRST and LAST can be numbers specifying the range, or FIRST can be a
string, which means the most recent command beginning with that
string.
Options:
-e ENAME select which editor to use. Default is FCEDIT, then EDITOR,
then vi
-l list lines instead of editing
-n omit line numbers when listing
-r reverse the order of the lines (newest listed first)因此:
fc -ln您也可以直接查看历史文件,但可能不会更新:
cat "$HISTFILE"发布于 2016-10-20 13:36:53
使用以下命令:
history | cut -c 8-发布于 2016-10-20 13:50:01
使用awk。
history | awk '{$1=""; print}'https://askubuntu.com/questions/839639
复制相似问题