Hack Forums
Increasing history size of commands executed in bash - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Computing (https://hackforums.net/forumdisplay.php?fid=88)
+---- Forum: Linux (https://hackforums.net/forumdisplay.php?fid=85)
+---- Thread: Increasing history size of commands executed in bash (/showthread.php?tid=5245128)



Increasing history size of commands executed in bash - Tex. - Apr 21, 2016

Unlike the others who frequently delete '.bash_history' or alter the environment so no history of executed commands, i prefer to increase its size and to show my exact date was given an comman. The reason is simply, look what I did on that server and I need to see exactly .
I added in '~/.bashrc' following lines:
Code
export HISTTIMEFORMAT="%d/%m/%y %T "
export HISTFILESIZE=5000000
export HISTSIZE=5000000


So history shows default:
Code
macbook ~$ history
    1  cat Documents/provision
    2  cat Documents/status
    3  echo 540+876+7320+54|bc
    4  pico Work/ARM/echip/usr/src/sys.c
    5  pico Work/ARM/echip/usr/src/sys.c
    6  ssh [email protected]
macbook ~$

So look on a server with changed history:
Code
root@tex:~# history
......
  329  21/04/16 21:39:18 tail -f /var/log/mail.log
  330  21/04/16 21:39:18 cd /etc/amavis/
  331  21/04/16 21:39:18 ls
  332  21/04/16 21:39:18 cd conf.d/
  333  21/04/16 21:39:18 ls
  334  21/04/16 21:39:18 pico 01-debian
  335  21/04/16 21:39:18 grep group *
  336  21/04/16 21:39:18 pico 50-user
  337  21/04/16 21:39:18 apt-get install libnet-dns-perl libmail-spf-query-perl pyzor razor
  338  21/04/16 21:39:18 apt-get install arj
  339  21/04/16 21:39:18 apt-get install unarj
......



* - FreakyFreak - Apr 21, 2016

Why have a limit ?

export HISTTIMEFORMAT="%d/%m/%y %T "
export HISTFILESIZE=-1
export HISTSIZE=-1

as well as

export HISTFILESIZE=
export HISTSIZE=

makes it unlimited.


* - ayleid96 - Apr 21, 2016

install zsh and its easy... its easy to configure... bump


* - FreakyFreak - Apr 21, 2016

(Apr 21, 2016 02:19 PM)ayleid96 Wrote:  install zsh and its easy... its easy to configure... bump

Am I the only one who sticks to the system default and doesn't mess around with other variations of shells ?

Fuck bash, fuck zsh, fuck fish, be old school, use bourne shell.