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

PHP On Tomcat

Fue tomado de http://fabien.duminy.ifrance.com/blog/archives/2007/08/entry_14.html tomcat and php Here are the steps to run php in tomcat : Download tomcat and unzip the archive where you want (=> TOMCAT_DIR ) Create the following directories : TOMCAT_DIR /webapps/testPHP If necessary, create directory TOMCAT_DIR /common/lib (it seems, at least with tomcat 6, that the directory is no more created) Edit the file TOMCAT_DIR /conf/catalina.properties and modify the line for property shared.loader : shared.loader=${catalina.home}/common/classes,${catalina.home}/common/lib/*.jar Edit the file TOMCAT_DIR /conf/web.xml and add the lines mentionned below (see ' lines to add to web.xml of your tomcat installation ') To download quercus ( a php 5 engine written in pure java), you must in fact download resin becau...

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...

OpenMeetings en Debian

Artículo tomado de  http://liberamemoria.blogspot.com/ Instalando OpenMeetings 0.7 RC 2 en Debian Lenny Mucho ha pasado desde mi último post y mucho más desde  aquel en que hablaba de OpenMeetings . Aprovechando la salida de  Debian 5.0  (Lenny para los amigos) y de  OpenMeetings 0.7 RC 2  reescribí dicho tutorial. Entre las mejoras notables de la nueva versión de OpenMeetings encontramos: Se puede incrementar el número de participantes en las salas desde la Administración hasta 1000 usuarios. Las ventanas de vídeo de los participantes se puede redimensionar. Desde el menú de Administración se puede expulsar usuarios. Se puede autenticar usuarios por LDAP. Como en el tutorial anterior, partimos de una instalación estándar de Debian Lenny sin entorno gráfico. 1) Instalación de Sun Java Development Kit Vamos a tener que habilitar los repositorios de la rama non-free de Debian Lenny. Para ellos editamos el archivo sources.list: # pico /etc/apt/sources.list Agregamos non-free a alguno de l...