Another really useful utility from the Linux command line arsenal is cut. With this we are able to extract data by using the:
- field -f
- character -c
- byte -b
Most useful will be the -f option to display one or more fields, this would be combined with the -d switch to designate the field separator.
To show just the user-name and UID, fields 1 and 3 from the /etc/passwd file we could use the syntax:
cut -f1,3 -d”:” /etc/passwd
We can see this and partial output from the following screenshot:
Like all of these tools the key is practice and thinking about your work and how you can use these tools to streamline the process.