Usando comm
, awk
, users
e /etc/passwd
comm -23 <(awk -F: '/\/home/ && ($3 >= 1000) {print $1}' /etc/passwd | sort ) <(users | tr ' ' '\n' | sort | uniq)
Discriminação
% awk -F: '/\/home/ && ($3 >= 1000) {print $1}' /etc/passwd
user1
user2
% users | tr ' ' '\n' | sort | uniq
user1
% comm -23 <(awk -F: '/\/home/ && ($3 >= 1000) {print $1}' /etc/passwd | sort ) <(users | tr ' ' '\n' | sort | uniq)
user2