Cybersecurity Ops with bash - Chapter 6 Solutions

Below are selected solutions for the Chapter 6 workshop questions from Cybersecurity Ops with bash.

Question 1

Given the following file tasks.txt, use the cut command to extract columns 1 (Image Name), 2 (PID), and 5 (Mem Usage).

Image Name;PID;Session Name;Session#;Mem Usage

System Idle Process;0;Services;0;4 K

System;4;Services;0;2,140 K

smss.exe;340;Services;0;1,060 K

csrss.exe;528;Services;0;4,756 K


You can use the cut command's -d option to specify the semicolon for the delimiter, and the -f option to specify the fields (columns) to extract:

Question 3

Use the tr command to replace all of the semicolon characters in tasks.txt with the tab character and print the file to the screen.


Note that the tr command does not read a file directly, but rather accepts input from stdin.


© 2020 by Paul Troncone and Carl Albing