查看最后15行:history | tail -n 15
重新执行第number条命令: !numeber
删除当前会话的历史记录:history -c
这种删除只会删除当前会话的历史记录,下次用xshell打开的时候,你会发现你根本没删掉之前的。
你进入用户目录 cd ~/ 
输入 ls -alF
你会看到有两个隐藏的文件。
cat .bash_history
你会发现历史命令记录就在这个文件里,你删除这个文件,就能把history记录删掉,你重新登录会话,会发现也都删了。
rm ~/.bash_history
这个文件你删掉了之后,你有新的history记录,这个文件会重新生成的。
或者你可以这样删 history -c && history -w



history --help: history -c 删除旧的命令;
root@frp10:~# history --help
history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
    Display or manipulate the history list.

    Display the history list with line numbers, prefixing each modified
    entry with a `*'.  An argument of N lists only the last N entries.

    Options:
      -c        clear the history list by deleting all of the entries
      -d offset delete the history entry at position OFFSET.

      -a        append history lines from this session to the history file
      -n        read all history lines not already read from the history file
                and append them to the history list
      -r        read the history file and append the contents to the history
                list
      -w        write the current history to the history file

      -p        perform history expansion on each ARG and display the result
                without storing it in the history list
      -s        append the ARGs to the history list as a single entry

    If FILENAME is given, it is used as the history file.  Otherwise,
    if HISTFILE has a value, that is used, else ~/.bash_history.

    If the HISTTIMEFORMAT variable is set and not null, its value is used
    as a format string for strftime(3) to print the time stamp associated
    with each displayed history entry.  No time stamps are printed otherwise.

    Exit Status:
    Returns success unless an invalid option is given or an error occurs.

-N: 显示历史记录中最近的N个记录;
-c:清空当前历史命令;
-a:将历史命令缓冲区中命令写入历史命令文件中;
-r:将历史命令文件中的命令读入当前历史命令缓冲区;
-w:将当前历史命令缓冲区命令写入历史命令文件中;
-d:删除历史记录中第offset个命令
-n:读取指定文件