ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Operating Systems  >>  Linux  >>  Linux Commands
 
 


 

 
 Linux Commands interview questions  Linux Commands Interview Questions
 Linux Threads interview questions  Linux Threads Interview Questions
 Linux IPC interview questions  Linux IPC Interview Questions
 Linux Socket Programming interview questions  Linux Socket Programming Interview Questions
 Linux System Calls interview questions  Linux System Calls Interview Questions
 Linux AllOther interview questions  Linux AllOther Interview Questions
Question
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
 Question Submitted By :: Daniel
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
First let's dissect the line: The date gives the date and
time as the first command of the line, this is followed by
the a list of all running processes in long form with UIDs
listed first, this is the ps -ef. These are fed into the awk
which filters out all but the UIDs; these UIDs are piped
into sort for no discernible reason and then onto uniq (now
we see the reason for the sort - uniq only works on sorted
data - if the list is A, B, A, then A, B, A will be the
output of uniq, but if it's A, A, B then A, B is the output)
which produces only one copy of each UID. These UIDs are fed
into wc -l which counts the lines - in this case the number
of distinct UIDs running processes on the system. Finally
the results of these two commands, the date and the wc -l,
are appended to the file "Activity.log". Now to answer the
question as to what this command line produces. This writes
the date and time into the file Activity.log together with
the number of distinct users who have processes running on
the system at that time. If the file already exists, then
these items are appended to the file, otherwise the file is
created.
 
Is This Answer Correct ?    0 Yes 0 No
Daniel
 
  Re: 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
# 2
It's retarded. The idea is clearly to post the number of
users (the first field of ps -ef), but they are going to
capture the  title line. Also, just use 'who'!
 
Is This Answer Correct ?    0 Yes 0 No
Liam
 
 
 

 
 
 
Other Linux Commands Interview Questions
 
  Question Asked @ Answers
 
what is the command to check network interfaces in our system? how to set etho to 10 full duplex speed?  1
in unix how to change old name to new name Google3
How do display error messages instantly when command fails? Satyam1
How to schedule cron backup to run on 4th saturday of month?? HCL3
Display the Disk Usage of file sizes under each directory in currentDirectory ?  4
How you will uncompress the file? Linux3
My machine is running half duplex mode how to change half duplex to full duplex? Oracle1
find out what file systems supported by kernel?  3
what is a superblock ?  1
tell me command for" to create more than one name to a file". Google2
what is Bourne shell. Google1
What would you do when all the processess hangs and there is no other option in unix? HP1
what is major and minor? IBM1
I have Laptop. I want to assign DHCP ip address, but in my Laptop having Wireless and with wire NIC cards, it is possible to assign reserve ip address for both NIC card, but same host name? AOL1
How can you find configuration on linux?  2
Did you work with linux? What flavors and versions? HP1
Set the Display automatically for the current new user ?  2
When is it better to use the more command rather than cat command?  2
have you ever got warning message from unix admin that file system running out of space or not enough disk space?what will u do? HP3
what is command like " #(cd unixos; pwd) " tell me OUTPUT Google4
 
For more Linux Commands Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com