Ubuntu20.04修改history记录条数

目录

Ubuntu20.04修改history记录条数

1.修改当前用户目录下.bashrc文件第16行HISTSIZE

vim ~/.bashrc

  1 # ~/.bashrc: executed by bash(1) for non-login shells.
  2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  3 # for examples
  4 
  5 # If not running interactively, don't do anything
  6 [ -z "$PS1" ] && return
  7 
  8 # don't put duplicate lines in the history. See bash(1) for more options
  9 # ... or force ignoredups and ignorespace
 10 HISTCONTROL=ignoredups:ignorespace
 11 
 12 # append to the history file, don't overwrite it
 13 shopt -s histappend
 14 
 15 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1),修改为10000条
 16 HISTSIZE=10000
 17 HISTFILESIZE=2000
 18 
 19 # check the window size after each command and, if necessary,
 20 # update the values of LINES and COLUMNS.
 21 shopt -s checkwinsize
 22 
 23 # make less more friendly for non-text input files, see lesspipe(1)
 24 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
 25 
 26 # set variable identifying the chroot you work in (used in the prompt below)
 27 if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
:set nu

2.重新初始化修改后的~/.bashrc

source ~/.bashrc

3.修改成功

[root@master01 ~]# echo $HISTSIZE
10000

上一篇:IT审计-zabbix安装


下一篇:CentOS8提前EOL,阿里云源停止维护后的更新配置方法 2022-2-17