Unix C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.

tee command doubt

5 posters

Go down

tee command doubt Empty tee command doubt

Post by preethika subramanian Thu Mar 04, 2010 10:46 am

How to use tee such that the list of the logged users as well as their count is displayed only on the terminal and the same is not stored in any file.

preethika subramanian

Posts : 6
Points : 12
Join date : 2010-02-26

Back to top Go down

tee command doubt Empty reply

Post by anand Thu Mar 04, 2010 12:49 pm

who |tee <0; who |wc -l
this ll work.....
anand
anand

Posts : 55
Points : 70
Join date : 2010-02-26
Age : 36

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by Christopher Thu Mar 04, 2010 1:33 pm

"tee" command sends the output to standard output and also to a file.

eg
Code:
$ ls | tee -a -i sample.txt

Output of ls command will be printed in the screen and also stored in sample.txt file.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by Christopher Thu Mar 04, 2010 1:35 pm

-a ---> append to the file
-i ---> ignore interrupts
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by urvershi Thu Mar 04, 2010 1:35 pm

<0 is not required in above command.

This can also be used
who -q | tee

This command will save the result in some temporary file and also display the result.

urvershi

Posts : 21
Points : 70
Join date : 2010-02-26

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by Christopher Thu Mar 04, 2010 1:40 pm

what is the use of '-q' option?
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by Christopher Thu Mar 04, 2010 1:43 pm

i got it. It is called quick who. Only displays logged in usernames and their count...
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by urvershi Thu Mar 04, 2010 1:43 pm

-q is used for displaying only logged users name and total no. of users logged on.

urvershi

Posts : 21
Points : 70
Join date : 2010-02-26

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by Christopher Thu Mar 04, 2010 1:48 pm

even "who -q" produces the same output. then wat is the significance of using "tee" command there.
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by anand Thu Mar 04, 2010 1:51 pm

since the question needs it...............maybe
anand
anand

Posts : 55
Points : 70
Join date : 2010-02-26
Age : 36

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by Christopher Thu Mar 04, 2010 1:54 pm

k k Smile
Christopher
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 35

https://unixcpp.forumotion.com

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by Mahee Thu Mar 04, 2010 2:16 pm

Main purpose of tee command is to split the output and write it to both a file and stdout
The solution that i think is,
just write the command without 'tee' which serves the purpose
and append ' | tee ' to it. simple

Here are some of the ways to do it,
( who ; who | wc -l ) | tee
(who | tee ) ; (who | wc -l) | tee

However the outlet to file in ' T ' should be made dummy...
Mahee
Mahee

Posts : 29
Points : 233
Join date : 2010-03-03
Location : Haldia

Back to top Go down

tee command doubt Empty Re: tee command doubt

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum