Activity - shell pipelines
Assignment
Let’s use the /etc/passwd file as an example to practice the use of shell pipelines. The passwd file stores basic information of each user account on a Linux/Unix machine.
I have an example passwd file stored at the shared workspace for our activity today. Once you log into the plank server, take a further look at the file to see what information is stored and familiarize yourself with the file format:
$ less /thayerfs/courses/22fall/cosc050/workspace/passwd
Press q
to quit the viewing of the less
command.
Write pipelines to:
- output the list of user full names, sorted alphabetically (remove duplicated occurrences of identical names)
- count the number of users with ‘James’ as the first name.
- count the number of different shells used by all users.
- output the number of users using each type of shell in the descending order.