Paco

Personal Content Organiser

Home / Linux

Navigation

Menu

Search

Dodaj date i czas do histori w BASH

By dodac date i czas do histri BASH musimy dodac do $HOME/.bashrc ponizsza linie:
export HISTTIMEFORMAT=?%h/%d - %H:%M:%S ?

Note

By ustawic powyzsze globalnie edytujemy plik /etc/bash.bashrc


Od nastepnego loginu bedzie zamiast tego:
574 tail -f /var/log/maillog 575 mailq | tail -15 576 tail -f /var/log/maillog 577 less /var/log/maillog
to:
1002 May/09 - 11:46:16 grep log /var/log/maillog 1003 Apr/09 - 14:17:40 passwd test 1004 Apr/09 - 14:50:28 history 15


Tip

export HISTTIMEFORMAT=?%F %T ?
da nam:
1 2008-08-05 19:02:39 cat /proc/cpuinfo


Some more bash history tips:

* The most efficent way to search your history is to hit Ctrl R and type the start of the command. It will autocomplete as soon as there?s a match to a history entry, then you just hit enter

* If you don?t want to save duplicate commands use the following option in your bashrc file ($HOME/.bashrc)
HISTCONTROL=ignoreboth
* If you want to set the size of the history file use the following option in your bashrc file ($HOME/.bashrc)
HISTSIZE=500