Jump to content
aelius

Marirea dimensiunii istoricului comenzilor executate in bash

Recommended Posts

Spre diferenta de altii care sterg frecvent '.bash_history' sau altereaza environmentul astfel incat sa nu existe un istoric al comenzilor executate, eu prefer sa maresc dimensiunea acestuia si sa imi afiseze data exacta la care a fost data o comanda. Motivul este simplu, mai uit ce am facut pe acel server si am nevoie sa vad exact.

Am adaugat in '~/.bashrc' urmatoarele linii:


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

Cam asa arata history default:


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 root@ns.xxx.org
macbook ~$

Asa arata pe un server cu history modificat:


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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...