UNIX Fundamentals : Shell Scripting Basics

 Unix Shell Scripting Demonstration

Labs

1. Introduction to the lab environment and using the shell

2. Using, navigating, and searching man pages. Using the Linux info command.

3. Explore different file types: files, directories, devices, and links. Use basic commands to navigate and explore files and directories (cd, 1s, pwd, cat, and date).

4. Explore top-level directories. Use shortcut names to navigate and view directories. Use the file and od commands to view file and directory details. Use the 1s -1 command to view file attributes. Use the cd command with relative and absolute pathnames.

5. Use the touch command to create files and modify timestamps. Use the chon command to change file ownership. Use the 1n command to create a link to a file.

6. Use the chmod command to modify file permissions. Use the umask command to set the default permissions.

7. Copy, move, and remove files. Use tar to archive files. Use gzip to compress files.

8. Perform basic editing and navigation in vi. Operate effectively in both command and insert modes.

9. Explore processes using the ps, pstree, and pgrep commands.

10. Perform globbing with different commands. Quote special characters in the shell. Use command-line shortcuts, such as file completion, command completion, command history, and repeating commands, to more efficiently work in the UNIX shell.

11. Modify your UNIX profile, including your unmask, setting your path, setting your own variables, setting aliases, setting options, and defining functions. Edit the .forward file.

12. Create a shell script using a text editor, such as vi. Include comments, white space, and the shbang line. Include the echo and read commands in the script. Give yourself execution permission for the script. Run the script to make sure that it works. Address any problems that prevent the script from running correctly.

13. Redirect the output of standard out and standard error to files. Implement noclobber to prevent file destruction. Use piping to send the standard out of one command to the standard in of another command.

14. Use the four methods for performing conditional testing (|| and &&, test command, [ ], and [[ ]]) to write conditional statements into a script. Use if, then, if and elif statements.

15. Introduce various types of loops (for, while, until) into your script. Use the seq command. Implement abnormal loop termination.

16. Use find and locate to find files based on partial information. Use the du and df commands to monitor disk usage.

17. Use various regular expressions to force a command to display only a specific portion of its full output.

18. Use grep and egrep to find regular expressions within a file. Use wc to return word count. Sort files. Use sed and awk to manipulate the data within a file.