This exercise can be performed in Bash, CMD, or Powershell
Build a bash-exercise.sh
file in your HOME directory.
Do your work in the scripts.sh
file. Make sure your bash-exercise.sh
is executable. You may comment out lines respective to each task to avoid overwriting/errors.
- Build a
folders
directory and inside, build 10 new directories with the incremented name ofdir
. We should get something like./folders/dir1
,./folders/dir2
and so forth. - Create a
projects
directory in./folders/dir1
and build aREADME.md
file in the projects dir. - Write a command to append the string "Hello World" in your README.md located at:
./folders/dir1/projects/README.md
. - Read the contents of the
README.md
in./folders/dir1/projects/
. - Build a
notes
directory in thetmp
directory located in your root. - Change the ownership of
notes
dir created to be owned by admin and the permissionsdrwxr--r--
. - Build 3 incremented markdown files in
/tmp/notes/
dir asnote1.md
,note2.md
, andnote3.md
. - Append strings "foo", "bar", and "baz" on separate lines in each of the 3 markdown files in the notes directory of tmp root.
- Ensure that the three note files have the permissions of
-r--r--r--
. - Read the contents of all three markdown files.
- Use the word count commmand to print out how many lines are in the
nginx.log
located in the logs directory. Write the value in your script. - How many lines are in the
syslog
? - In
ufw.log
? - in
auth.log
? - Evaluate the last 100 lines of the
nginx.log
file and display only lines that have a404
HTTP status code. - Append all discovered lines into a
tmp.nginx.log
file in your HOME directory. - Evaluate the first 50 lines of
auth.log
and display only the lines have "Connection closed". - Append all discovered lines into a
tmp.auth.log
file in your HOME directory.