Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

Shell script to finger every users

How to write a sh shell script to finger every users(including root, nobody, nobodyV, daemon, bin,.....) in the passwd file ONCE !!!
0
clo1
Asked:
clo1
  • 2
  • 2
1 Solution
 
ozoCommented:
for user in `cut -f1 -d: /etc/passwd` ;do
finger $user
done
0
 
clo1Author Commented:
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
 
ozoCommented:
Or finger may have returned more than one line for some users
maybe you want
finger -sbqpfhm $user

0
 
clo1Author Commented:
Actually just -m option is good enough for my answer !
0
 
n0thingCommented:
Hi,

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

would do.

Regards,
Minh Lai
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now