===== Separar la salida de comandos ejecutados en consola con una linea y hora de ejecuciĆ³n =====
Proceso para separar los comandos ejectados en la terminal mediante una linea.
Ejemplo de salida.
-------------------------------------------------------------------------------------------------- 11:27:21
root@slack:~# ls
ssh_keys_fa
-------------------------------------------------------------------------------------------------- 11:28:26
root@slack:~# ls -a
. .. .bash_history .bash_linie .ssh .viminfo ssh_keys_amazon
-------------------------------------------------------------------------------------------------- 11:29:28
root@slack:~# date
Tue Dec 25 11:29:33 CET 2010
-------------------------------------------------------------------------------------------------- 11:34:33
root@slack:~# time dir /
bin dev home lost+found opt root sbin sys usr
boot etc lib mnt proc run srv tmp var
real 0m0.014s
user 0m0.000s
sys 0m0.000s
-------------------------------------------------------------------------------------------------- 16:29:47
Fichero ///etc/bash_linie// (Todo los usuarios del sistema) o bien //$HOME/.bash_linie// (Solo el usuario).
fill="--- "
reset_style='\[\033[00m\]'
status_style=$reset_style'\[\033[0;90m\]' # gray color; use 0;37m for lighter color
prompt_style=$reset_style
command_style=$reset_style'\[\033[1;29m\]' # bold black
# Prompt variable:
PS1="$status_style"'$fill \t\n'"$prompt_style"'${debian_chroot:+($debian_chroot)}\u@\h:\w\$'"$command_style "
# Reset color for command output
# (this one is invoked every time before a command is executed):
trap 'echo -ne "\e[0m"' DEBUG
function prompt_command {
# create a $fill of all screen width minus the time string and a space:
let fillsize=${COLUMNS}-9
fill=""
while [ "$fillsize" -gt "0" ]
do
fill="-${fill}" # fill with underscores to work on
let fillsize=${fillsize}-1
done
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
bname=`basename "${PWD/$HOME/~}"`
echo -ne "\033]0;${bname}: ${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"
;;
*)
;;
esac
}
PROMPT_COMMAND=prompt_command
Fichero /etc/bash.bashrc o /etc/bashrc (Todos los usuarios del sistema).
if [ -f "/etc/bash_linie" ]; then
. "/etc/bash_linie"
fi
Fichero $HOME/.bashrc (Solo el usuario).
if [ -f "$HOME/.bash_linie" ]; then
. "$HOME/.bash_linie"
fi