Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I need a shell script which lists all users listed in /etc/passwd file. This script should show all the users created. Is it possible to extract only users with ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    1

    Wink All users in /etc/passwd file

    Hi,

    I need a shell script which lists all users listed in /etc/passwd file. This script should show all the users created.

    Is it possible to extract only users with different shells? Please reply..

  2. #2
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Well, you could use cat, or grep can select lines based on specific patterns. If you want to pick out certain fields you could do something with awk:
    Code:
    awk -F: '{print $5, "(" $1, "-", $7 ")"}' /etc/passwd
    which will list the GECOS field followed by the userid and login shell.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...