系统相关
首页 > 系统相关> > Ubuntu20.04修改history记录条数

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

标签:Ubuntu20.04,修改,bashrc,HISTSIZE,条数,lesspipe,bash,history
来源: https://www.cnblogs.com/cxupup/p/15866518.html