Skip to content

Instantly share code, notes, and snippets.

@royki
Last active July 11, 2023 03:38
Show Gist options
  • Save royki/2a4ef64d8e5063e9af052a84676fd626 to your computer and use it in GitHub Desktop.
Save royki/2a4ef64d8e5063e9af052a84676fd626 to your computer and use it in GitHub Desktop.
Linux Administration
  • Users are on the system are listed in an alphabetical order - cut /etc/passwrd -d":" -f1 | sort
  • User has shell access - cat /etc/passwd | cut -d":" -f4,5,6,7 | grep "^0" or count - cat /etc/passwd | cut -d":" -f4 | grep "^0" | wc -l
  • Export the Users' list to a file - cut /etc/passwd -d ":" -f1 > system_users.txt
  • Count the number of Users - cat ./system_users.txt | sort | wc –l
  • Compare - cat ./system_users.txt - cut /etc/passwd -d ":" -f1 > system_users002.txt && cat system_users002.txt | sort | wc -l
  • Diff - diff ./system_users.txt ./system_users002.txt
  • how many words begin with the letter a from the main user dictionary - egrep '^a.*$' /usr/share/dict/words | wc -l
  • tee to both view and write files and directories in /etc - ls -d /etc/a* | tee ./etc_report_a.txt
  • Kernel Info - lsb_release -a or uname -a or hostnamectl or cat /proc/os-release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment