Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Sat Aug 19, 2017 2:43 am


Tips & Tricks, Questions regarding shell scripts, awk, perl, sed and much more.

Author Message
mandrei99
Post  Post subject: How to increase bash history size in Linux  |  Posted: Mon Jan 12, 2015 11:45 am

Joined: Tue Aug 04, 2009 9:16 am
Posts: 245

Offline
 

How to increase bash history size in Linux

How to increase bash history size in Linux

This tutorial has been tested on Debian and Centos / Rhel Linux.

Default Linux history size is 500 commands ( rows ).
Code:
# set | grep HIST
HISTFILE=/root/.bash_history
HISTFILESIZE=500
HISTSIZE=500



To increase this limit to 10k for example, I use the /etc/profile.d config directory for bash source files.
Code:
# vim /etc/profile.d/bash_hist.sh     
export HISTSIZE=10000
export HISTFILESIZE=10000

I use the "export" keyword to make this variable available to bash processes started subsequently by the user. The difference would be:
without "export":
Code:
user@linux:~# set | grep HIST
HISTFILE=/root/.bash_history
HISTFILESIZE=10000
HISTSIZE=10000
user@linux:~# bash
user@linux:~# set | grep HIST
HISTFILE=/root/.bash_history
HISTFILESIZE=500
HISTSIZE=500
user@linux:~#


with "export":
Code:
user@linux:~# set | grep HIST
HISTFILE=/root/.bash_history
HISTFILESIZE=10000
HISTSIZE=10000
user@linux:~# bash
user@linux:~# set | grep HIST
HISTFILE=/root/.bash_history
HISTFILESIZE=10000
HISTSIZE=10000
user@linux:~#





Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "How to increase bash history size in Linux"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Linux / FreeBSD: Avoid bash history duplicate lines with HISTCONTROL

mandrei99

0

546

Mon Jan 12, 2015 12:01 pm

mandrei99 View the latest post

There are no new unread posts for this topic. Password generator with user inputs bash script

Kvr123

0

319

Thu Dec 01, 2016 5:06 am

Kvr123 View the latest post

There are no new unread posts for this topic. How to echo newline in Linux/Unix shell

mandrei99

0

16707

Tue Jun 25, 2013 5:58 am

mandrei99 View the latest post

There are no new unread posts for this topic. Echo new line in linux - supress new line or echo multiple new lines

mandrei99

0

2788

Wed Jan 14, 2015 5:26 pm

mandrei99 View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO