LinuxQuestions.org
Review your favorite Linux distribution.
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 07-24-2004, 02:00 PM   #1
suguru
Member
 
Registered: Dec 2003
Location: Voluntarily move into diaster relief areas.
Distribution: Upgraded from Suse 10 to Ubuntu.
Posts: 104

Rep: Reputation: 15
See the time of each bash command


I want to know the time that a long process was started.
How can I see the time when each bash command was given?
 
Old 07-24-2004, 03:08 PM   #2
Ebel
Member
 
Registered: May 2004
Distribution: Slackware 10
Posts: 63

Rep: Reputation: 15
I don't know exactly how to do this, but date is a programme that will print out the date and time of when you called it, so if you had a programme called some_programme, entering date && some_programe will print out the date and time, then execute the programme. If the programme had a lot of input/output it could be a pain.

Bringing this to the next level if you entered WHEN=`date` && some_programme && echo $WHEN then it'd execute the programme then print out when that programme was executed. You could put this all in a bash script to make it easier.
 
Old 07-24-2004, 03:30 PM   #3
Cluster
LQ Newbie
 
Registered: Jul 2004
Location: Richardson, TX
Distribution: Gentoo Linux
Posts: 14

Rep: Reputation: 0
suguru, I do not think it is possible. bash saves its commands into ~/.bash_history with one command per line. It does not save the time of each command. So, although you cannot see when you executed a particular command, you can follow Ebel's instructions for seeing how long a process has been running.

Alternately, you can change your bash prompt via the PS1 variable (see this page) to display the time for the PROMPT. So for example like this:
Code:
12:31:04 pwhite@machine $ gnucash
13:05:41 pwhite@machine $
In this case, you can implicitly see how long each command took to execute before exiting and returning to the prompt.
 
  


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
Get file modification date/time in Bash script cmfarley19 Programming 16 04-15-2015 07:25 PM
bash: <command name> command not found smash Programming 5 03-13-2006 09:48 AM
quit program after a specific time (prob. BASH) bglnelissen Linux - General 2 01-25-2005 02:22 AM
starting bash as a login shell every time slackwarefan Slackware 3 04-30-2004 03:55 PM
bash script - even more stupid question than last time. webamoeba Linux - Newbie 2 02-12-2004 04:03 AM


All times are GMT -5. The time now is 12:48 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