top of page
book of spells.webp

Start your journey towards mastering the CLI with our FREE Command Line Book of Spells.

By entering your email address you agree to receive emails from Command Line Wizardry. We'll respect your privacy and you can unsubscribe at any time.

  • Writer's pictureCybersecurity Ops with bash

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


Answer


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.


Answer


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


721 views0 comments

Recent Posts

See All
bottom of page