What does the following command line produce? Explain each
aspect of this line.

$ (date ; ps -ef | awk {print $1}' | sort | uniq | wc -l )
>> Activity.log

Answer Posted / vijay

There is a syntactical error in the question
The Actual command should be like

$(date;ps -ef | awk '{print $1}' | sort | uniq | wc -l ) >>
Activity.log

Answer::
"date" command gives the date

"ps -ef" -- gives all the process informations

awk '{print $1}'--- cuts the first column in the processes
(which is the usernames)

sort-- sorts all the usernames

uniq-- gives unique usernames
"wc -l" -- gives the total number of users running process

In compact--- The command displays the date and the number
of users(not repeated) who are executing some process.

The result when Activitylog is viwed after the execution
should be like

>>Fri Apr 3 12:48:21 IST 2009
>>38

Is This Answer Correct ?    16 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does mkdir mean?

626


What is tty in linux command?

506


What is unix finger command?

504


How do I run bash on windows?

495


What is tail command in linux?

533






How do I clear bash history in linux?

523


How can I delete a file in linux?

533


What is the difference between rmdir and rm r?

611


Brief about finger username?

556


How do I find hostname in linux?

562


How do I check my system performance?

552


What is command to check ports running/used over local machine

639


Explain about document formatting?

576


Which command is used to uncompress gzip files?

583


How do I run a shell script?

495