LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-07-2014, 01:47 AM   #1
rohitchauhan
Member
 
Registered: Nov 2010
Distribution: RedHat
Posts: 97

Rep: Reputation: Disabled
how to show the current time at the top in the current shell Always ?


Hi,
i am just trying something fun.

I want the current time to be displayed on the top of my screen ALWAYS...

I made changes in my .bashrc file like this:

Code:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
        . /home/rc/time
fi
The /home/rc/time file has the script which shows current time.

so when I log into the user i get the time on my screen but for only once.

But I want the time to be displayed on my screen all the time.

How can i achieve it ?
 
Old 04-07-2014, 01:58 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
you need to execute that script time by time. that will eat up a lot of resources. What do you mean by always? (in every second, every minute or ??)
 
Old 04-07-2014, 04:41 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Why not change your prompt to show it:

Code:
PS1="[\d \t \u@\h:\w ] $ "
 
1 members found this post helpful.
Old 04-07-2014, 09:20 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Code:
while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-75));date;tput rc;done &
 
2 members found this post helpful.
Old 04-09-2014, 12:32 AM   #5
rohitchauhan
Member
 
Registered: Nov 2010
Distribution: RedHat
Posts: 97

Original Poster
Rep: Reputation: Disabled
@pan64:
I found my solution from TenTenths and habitual.

@TenTenths:
Thank you for your reply.

@habitual:
That solution totally worked for me.
Now i will just spend some time to understand that.

Thanks again to all !!!
 
Old 04-09-2014, 03:05 PM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Glad it worked out.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
current os not show devendershekhawat Linux - Newbie 1 01-07-2012 02:16 AM
SELinux: Show current module policy TJNII Linux - Security 5 12-12-2011 06:24 PM
show current setting of apache hopefull Linux - Server 2 03-05-2009 11:25 AM
show the current keyboard layout tramni1980 Slackware 2 10-04-2007 08:40 AM
show complete current paht creilar Linux - Newbie 1 05-24-2004 04:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration