Solved

Shell script to finger every users

Posted on 1997-12-04
5
480 Views
Last Modified: 2013-12-26
How to write a sh shell script to finger every users(including root, nobody, nobodyV, daemon, bin,.....) in the passwd file ONCE !!!
0
Comment
Question by:clo1
  • 2
  • 2
5 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1295742
for user in `cut -f1 -d: /etc/passwd` ;do
finger $user
done
0
 
LVL 2

Author Comment

by:clo1
ID: 1295743
If I do cat /etc/passwd | wc -l I can get 142 from the command. But if I run the script that ozo given to me. And I will get 146. See what's the different. So there maybe have some duplicated user name
0
 
LVL 84

Expert Comment

by:ozo
ID: 1295744
Or finger may have returned more than one line for some users
maybe you want
finger -sbqpfhm $user

0
 
LVL 2

Author Comment

by:clo1
ID: 1295745
Actually just -m option is good enough for my answer !
0
 
LVL 5

Accepted Solution

by:
n0thing earned 20 total points
ID: 1295746
Hi,

   A simple
     
     cat /etc/passwd | awk -F ':' '{print $1}' | xargs finger

would do.

Regards,
Minh Lai
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to match SAS datasets by multiple key variables and then rename and create new variables? 2 98
move a line in eclipse 3 107
MaxSpan challenge 9 109
firstChar challenge 13 122
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question