© 2019 by Paul Troncone and Carl Albing

Cybersecurity Ops with bash - Chapter 1 Solutions

Updated: Mar 24, 2019

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


Question 1


Write a command that executes ifconfig and redirects standard output to a file named ipaddress.txt.


Answer


To redirect stdout use the > character.



Question 3


Write a command that copies all of the files in the directory /etc/a to the directory /etc/b and redirects standard error to the file copyerror.log.


Answer


To copy a file use the cp command. Standard error can be redirected using file descriptor 2.



Question 5


Write a command that executes the script mytask and sends it to the background.


Answer


Commands and scripts can be sent to the background using the ampersand (&) character.



Question 6


Given the following job list, write the command that brings the Amazon ping task to the foreground.


[1] Running ping www.google.com > /dev/null &

[2]- Running ping www.amazon.com > /dev/null &

[3]+ Running ping www.oreilly.com > /dev/null &


Answer


Background tasks can be brought to the foreground using the fg command and the corresponding task number.




241 views