List all user linux


SUBMITTED BY: Guest

DATE: Feb. 2, 2015, 4:23 p.m.

FORMAT: Bash

SIZE: 344 Bytes

HITS: 610

  1. #/bin/bash
  2. #Script show all user Linux
  3. abc=`awk -F':' '{ print $1}' /etc/passwd`
  4. array=($abc)
  5. len=${#array[*]}
  6. y=0
  7. while [ $y -le $[len -1] ]; do
  8. userid=`id -u ${array[$y]}`
  9. groupid=`id -g ${array[$y]}`
  10. echo "$[y+1]) user: ${array[$y]} - user id: $userid - group id: $groupid"
  11. let y++
  12. done

comments powered by Disqus