will output a nicely formatted list of all users to “users_all.txt” but also print on screen (tee)

(for whatever reason the current date-time is at the very top)

cut -d: -f1 /etc/passwd|sort|pr -1 |grep -v '^$'|tee users_all.txt

what has been done?

cut -d: -f1 /etc/passwd # get first column (-f1) from the semicolon:(-d:):separated:file /etc/passwd
sort # sort alphabetically
pr -2 # display as two columns list, also responsible for printing the current date-and-time
grep -v ‘^$’ # remove all empty lines
tee userliste # output the result to file and screen

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin