LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   login shell with system time ! (https://www.linuxquestions.org/questions/linux-newbie-8/login-shell-with-system-time-4175475860/)

shipon_97 09-04-2013 08:45 AM

login shell with system time !
 
Dear Friends ,

I want to add time format in my linux shell during every command . For example :

--------------------------------------------
[root@pbltest ~]# ls
anaconda-ks.cfg Desktop install.log install.log.syslog nmon_linux_x86 plsql
[root@pbltest ~]# mkdir temp
[root@pbltest ~]# ls
anaconda-ks.cfg Desktop install.log install.log.syslog nmon_linux_x86 plsql temp
[root@pbltest ~]#
-----------------------------------------

In the above output , when I make 'ls' and then press enter , for each and every enter it shows the system time with the default shell info , like :[root@TIME] .

Is it possible to add time with username shell ?

Waiting for your kind reply ... ..

schneidz 09-04-2013 08:54 AM

google(bash change prompt)[1] = http://www.cyberciti.biz/tips/howto-...up-prompt.html

teckk 09-04-2013 09:02 AM

Also this will put a running clock/date in the upper right corner of shell.

Code:

#! /usr/bin/env bash

clear
while sleep 1; do
tput sc
tput cup 0 $(($(tput cols)-29))
date
tput rc
done &


seanferguson 09-04-2013 01:59 PM

I believe that if you edit your PS1 in ~/.bashrc (or /etc/bashrc) to something along the lines of:

Code:

PS1="[\t \u@\h:\w] $ "
that should do what your wanting it to do, however read up on PS1 and bash prompts to get more creative.

unSpawn 09-04-2013 05:05 PM

Quote:

Originally Posted by shipon_97 (Post 5021572)
I want to add time format in my linux shell during every command .

Just to make sure: do you simply want to spruce up your shell prompt or are you trying to accomplish Something Completely Different?

shipon_97 09-04-2013 10:39 PM

Thx Texkk , seanferguson and All of the Friends . My purpose is completed .


All times are GMT -5. The time now is 08:33 PM.