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
foldersdirectory and inside, build 10 new directories with the incremented name ofdir. We should get something like./folders/dir1,./folders/dir2and so forth. - Create a
projectsdirectory in./folders/dir1and build aREADME.mdfile 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.mdin./folders/dir1/projects/. - Build a
notesdirectory in thetmpdirectory located in your root. - Change the ownership of
notesdir 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.loglocated 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.logfile and display only lines that have a404HTTP status code. - Append all discovered lines into a
tmp.nginx.logfile in your HOME directory. - Evaluate the first 50 lines of
auth.logand display only the lines have "Connection closed". - Append all discovered lines into a
tmp.auth.logfile in your HOME directory.