Lab Assignment

25 points total. You can get tonight's datafile from http://ccis2161.linux-classes.com/awk-mk2/secure

  1. Write an awk script which will display just names and comments (GECOS) from /etc/passwd
  2. Write an awk script to display only groupnames from /etc/group
  3. Write an awk script to show only filenames and sizes from the output of ls -al
  4. Write an awk script to display only the filename and number of hardlinks (in that order) from the output of an ls -al
  5. Write an awk script to display the only the username of any users which have /sbin/nologin as their shell
  6. Use awk to display only lines which contain "refused connect" from the provided 'secure' logfile
  7. Alter the above command to show only Month, date, time, and one instance of the IP address that attempted to connect
  8. Using a pipe, and sed, take the result of the last command, and delete all instances of '::ffff:'
  9. Use awk to show only a list of invalid users from the datafile
  10. Use awk to produce a list of usernames which successfully authenticated with publickey or password
  11. Now, take the previous question, and pipe the results to uniq, such that duplicates are removed
  12. Using nothing but awk, show only the first ten lines of /etc/passwd
  13. Using nothing but awk, show the seventh, eighth and ninth lines of the /etc/passwd file
  14. Using awk, show all lines from /etc/passwd which have a UID with a value less than 50
  15. Alter the previous question so that only usernames are displayed.