cat /etc/passwd | cut -d: -f 1,3,6 | grep "[5-9][0-9][0-9]" | grep "/home" | cut -d: -f1
awk -F: '$6 ~ /\/home/ && $3 >= 500 {print $1}' /etc/passwd
2) Count the results with the pipe wc -l
Above commands can be rewritten as following
cat /etc/passwd | cut -d: -f 1,3,6 | grep "[5-9][0-9][0-9]" | grep "/home" | cut -d: -f1 | wc -l
awk -F: '$6 ~ /\/home/ && $3 >= 500 {print $1}' /etc/passwd | wc -l
3) Grep command
Recursively search "some_string" only in python files in home directory
grep -r --include="*.py" "some_string" /homeDisplay the process containing "some_string"
ps aux | grep "some_string"
No comments:
Post a Comment