Skip to content

Instantly share code, notes, and snippets.

@datlife
Last active February 4, 2020 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save datlife/4998d1f4a67297682eee6fde864ebf33 to your computer and use it in GitHub Desktop.
Save datlife/4998d1f4a67297682eee6fde864ebf33 to your computer and use it in GitHub Desktop.
UNIX Tricks

Format /etc/passwd file

tail -n +11 /etc/passwd| sort -t$':' -k3 -n | awk -F":" \
'
 BEGIN {
    printf "GID | Name        | User_dir          | Bash_Access        | Description      \n"
    printf "--- | ----------- | ----------------- | ------------------ | -----------------\n"
 }
 {
    printf "%s | %s | %s | %s | %s\n",$3, $1, $6, $7, $5 
 }' |\
 column -t -s "|"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment