LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-04-2013, 09:45 AM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 484

Rep: Reputation: 30
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 ... ..
 
Old 09-04-2013, 09:54 AM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,028

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
google(bash change prompt)[1] = http://www.cyberciti.biz/tips/howto-...up-prompt.html
 
Old 09-04-2013, 10:02 AM   #3
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,825

Rep: Reputation: 221Reputation: 221Reputation: 221
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 &
 
1 members found this post helpful.
Old 09-04-2013, 02:59 PM   #4
seanferguson
LQ Newbie
 
Registered: Aug 2013
Location: Fife, Scotland, UK
Distribution: ArchLinux
Posts: 4

Rep: Reputation: 0
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.
 
Old 09-04-2013, 06:05 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Quote:
Originally Posted by shipon_97 View Post
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?
 
Old 09-04-2013, 11:39 PM   #6
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 484

Original Poster
Rep: Reputation: 30
Thx Texkk , seanferguson and All of the Friends . My purpose is completed .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] The system time switches the time zone automatically but doesn't change the time RandomTroll Linux - Software 9 03-15-2013 01:28 PM
[SOLVED] No bash shell or login after booting lfs for first time ? aashayshah Linux From Scratch 11 03-05-2013 09:06 AM
Login Shell / Non-Login shell Clarification needed (RHEL 6.3) kingston Linux - Newbie 1 12-07-2012 01:51 AM
Howto change the shell Automatically each time i login??? teddyZA Linux - Software 5 04-27-2007 10:39 AM
starting bash as a login shell every time slackwarefan Slackware 3 04-30-2004 03:55 PM


All times are GMT -5. The time now is 04:23 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration