Add the following to your .bashrc:
export HISTTIMEFORMAT="%h/%d – %H:%M:%S "
The result is this:
[root@server ~]# history
1 Mar/16 – 18:09:00 cd /etc
2 Mar/16 – 18:09:10 vi fstab
3 Mar/16 – 18:09:43 ls -la
Add the following to your .bashrc:
export HISTTIMEFORMAT="%h/%d – %H:%M:%S "
The result is this:
[root@server ~]# history
1 Mar/16 – 18:09:00 cd /etc
2 Mar/16 – 18:09:10 vi fstab
3 Mar/16 – 18:09:43 ls -la
Ok, so for a while I have done this a bunch of different ways but I think the best way I found is with a simple case statement. In here you can set variables, execute commands, functions, nest statements etc… It works out really well. here is a snippet to show you what i mean.
while [ $# -gt 0 ]
do
case $1
in
-v)
VERBOSE=YES
shift 1
;;-l)
echo "$MODULES"
exit 0
;;-os)
if [ -z $2 ]
then
echo "You must choose a VERSION"
exit 1
else
for MOD in $MODULES
do
if [ "$MOD" = "$2" ]
then
LISTED=YES
fi
done
if [ "$LISTED" = "YES" ]
then
VERSION=$2
shift 2
else
echo "Module not found. Use -l for listing"
exit 1
fi
fi
;;-h)
HELPMENU
exit 1
;;–help)
HELPMENU
exit 1
;;*)
HELPMENU
exit 1
;;
esac
done
Create a key with no passphrase on the source machine
[install@source ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/install/.ssh/id_rsa):
Created directory ‘/home/install/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/install/.ssh/id_rsa.
Your public key has been saved in /home/install/.ssh/id_rsa.pub.
The key fingerprint is:
66:c1:3f:95:c6:a9:d6:99:49:bf:a0:57:4f:a3:78:49 install@localhost.localdomain
Copy it to the destination machine…
[install@source ~]$ scp id_rsa.pub 10.50.2.50:~
On the destination machine create the .ssh directory and copy the id_rsa.pub to authorized_keys. If you have multiple keys you can just append it, something like this “cat id_rsa.pub >> authorized_keys”
[install@destination ~]$ mkdir .ssh
[install@destination ~]$ chmod 700 .ssh
[install@destination ~]$ cp id_rsa.pub .ssh/authorized_keys
Now you should be able to login…
[install@source .ssh]$ ssh 10.50.2.50
Last login: Fri Sep 5 14:18:01 2008 from 10.50.2.51
[install@destination ~]$