Ir al contenido principal

Adicionar Time a History en Linux

Llevo tiempo sin escribir en este blog, pero hoy nuevamente me he motivado a escribir. Para hoy traigo una utilidad que en algún momento nos puede servir. Muchas veces tenemos la necesidad de conocer la fecha en que fueron ejecutados via consola algunos comandos; recuerden que el comando básico para mirar este historial es "history".
Podemos entonces realizar por cada usuario lo siguiente: en este caso lo haré para  root

[root@quevaina~]# vi /root/.bashrc
# .bashrc  


# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias vi='vim' 


# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export HISTTIMEFORMAT="%h/%d - %H:%M:%S "

Después  de salvar podemos ejecutar el comando "source" para no tener que reiniciar.

[root@quevaina~]# source /root/.bashrc

Se puede verificar con el comando "history" y nos mostrará los ultimos comandos ejecutados con sus respectivas horas.



[root@quevaina~]# history

436 May/22 - 22:43:11 ifconfig
437 May/22 - 22:43:14 ifconfig  
438 May/22 - 22:44:30 vi /root/.bashrc

si el procedimiento se desea realizar para todos los usuarios, se adiciona la linea el el archivo
/etc/profile en la ultima linea

[root@quevaina~]#vi /etc/profile
export HISTTIMEFORMAT="%h/%d - %H:%M:%S "

Nuevamente el comando "source"
[root@quevaina~]# source /etc/profile

check it!

Comentarios

Entradas populares de este blog

Vulnerabilidad en Bluetooth -- BIAS

instalar FEDORA 9 en VirtualPC

Para instalar Fedora 9 en virtualPC se obtuvo ayuda desde la pagina web  http://blogs.technet.com/seanearp/archive/2008/05/19/installing-fedora-9-sulphur-in-virtual-pc-2007.aspx Installing Fedora 9 (Sulphur) in Virtual PC 2007 Fedora 9 was released last week, which you can download here: http://fedoraproject.org/get-fedora.html .  What's new?  Highlights from the release notes include: GNOME 2.22 . GNOME now includes a webcam photo and video creation utility called Cheese , improved network filesystem support, a new international clock applet, Google Calendar support and custom email labels in Evolution, a new Remote Desktop Viewer, improved accessibility features, and PolicyKit integration. KDE 4.0.3 Xfce 4.4.2 NetworkManager 0.7 provides improved mobile broadband support, including GSM and CDMA devices, and now supports multiple devices and ad-hoc networking for sharing connections. The Fedora installer, Anaconda , now supports partition resizing for ext2...

25 Useful IPtable Firewall Rules Every Linux Administrator Should Know

Tomado de http://www.tecmint.com/linux-iptables-firewall-rules-examples-commands/ Managing network traffic is one of the toughest jobs a system administrators has to deal with. He must configure the firewall in such a way that it will meet the system and users requirements for both incoming and outgoing connections, without leaving the system vulnerable to attacks.  25 IPtables Firewall Rules for Linux This is where iptables come in handy. Iptables is a Linux command line firewall that allows system administrators to manage incoming and outgoing traffic via a set of configurable table rules. Iptables uses a set of tables which have chains that contain set of built-in or user defined rules. Thanks to them a system administrator can properly filter the network traffic of his system. Per iptables manual, there are currently 3 types of tables: FILTER – this is the default table, which contains the built in chains for:IN...