LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-24-2005, 10:59 AM   #1
exit3219
Member
 
Registered: May 2005
Location: Moldova
Distribution: Kubuntu
Posts: 199

Rep: Reputation: 30
Question 'time' question


The 'time' command runs a program and then summarizes it's resources usage.
I have a really silly question:
How do I send arguments like '--verbose' to the time command?
Here's what I get:
Code:
exit@orclopes:~/Desktop/scor$ time --verbose ls
bash: --verbose: command not found

real    0m0.001s
user    0m0.000s
sys     0m0.001s
exit@orclopes:~/Desktop/scor$ time ls --verbose
ls: unrecognised option `--verbose'
Try `ls --help' for more information.

real    0m0.009s
user    0m0.007s
sys     0m0.000s
exit@orclopes:~/Desktop/scor$
Thanks everyone.
 
Old 11-24-2005, 12:33 PM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
Good question, it is impossible It is not a fact, but no of the examples
from manpage work. When I tried to do it myself I could not specify any
parametres to the 'time' tool.
 
Old 11-24-2005, 01:08 PM   #3
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
There are two different 'time'-s.

One is the shell time command which doesn't accept the parameters you saw on the man page.

To call the command 'time' use '/usr/bin/time' instead of just 'time' (of course you must have it installed on the system)
 
Old 11-25-2005, 07:14 AM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Yes.
When you use bash as the shell, options do not work because "time" is also a bash keyword (wich does not take options).

From "man time":
Quote:
Users of the bash shell need to use an explicit path in order to run the external time command and not the shell builtin variant.
So this does not work:
Code:
bash$ time --verbose sleep 1
But this does:
Code:
bash$ /usr/bin/time --verbose sleep 1
Because in the latter example, you are explicitly calling the program "time", instead of the bash keyword.
 
Old 11-25-2005, 09:00 AM   #5
exit3219
Member
 
Registered: May 2005
Location: Moldova
Distribution: Kubuntu
Posts: 199

Original Poster
Rep: Reputation: 30
Thanks a lot. I didn't notice that line in the man page.

(Note to myself: RTFM!)
 
  


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
Java 1.4.2 question: time manipulation borgy_t Programming 2 05-06-2005 03:04 AM
First time debian install...have a question. BmxFace Linux - Software 1 12-03-2004 04:25 PM
Me again...this time easy question! Y3k Linux - Newbie 6 05-29-2004 01:16 PM
ok n00b question of all time The_Drifter Linux - Newbie 10 05-03-2004 03:46 PM
yet another question, about hlds this time progster Linux - Software 1 07-18-2002 10:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:49 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
Open Source Consulting | Domain Registration