Unix/Linux Shell Programming Concepts
For Beginners
Introduces users to basic Unix/Linux usage with a terminal interface, focusing on simple commands
and hands-on experience.
Home
User's home directory, typically /home/username or ~, where personal files and settings are stored.
Getting Started
Basics like logging in, terminal usage, command syntax, and navigating the file system.
File Management
Includes commands like cp, mv, rm, touch, cat, head, tail to manage files.
Directories
Commands like mkdir, rmdir, cd, ls to handle directories.
File Permission
Controls read, write, execute rights for user, group, others. Commands: chmod, chown, chgrp.
Environment
Shell environment includes variables (e.g., PATH, HOME), set/export commands, and config files
like .bashrc.
Basic Utilities
Useful commands like echo, date, cal, who, uname, man, sort, cut, wc, diff.
Pipes & Filters
Use of | to connect commands. Filters include grep, awk, sed, sort, uniq.
Processes
Managing processes using ps, top, kill, bg, fg, &, nice.
Communication
Multi-user communication commands like write, wall, mail, talk.
The vi Editor
Text editor with command, insert, and ex modes. Commands: i, :w, :q, dd, yy, p.
Shell Programming
Writing shell scripts with variables, control structures, and automation logic.
Shell Scripting
Scripts with #!, logic, input/output, and automation for tasks.
What is Shell?
A command-line interface to interact with the OS. Examples: bash, sh, zsh.
Using Variables
Assign and reference variables: name='Ullas'; echo $name.
Special Variables
Predefined like $0, $1, $#, $@, $?, $$ for script parameters and metadata.
Using Arrays
Bash supports indexed arrays: arr=(one two); echo ${arr[0]}.
Basic Operators
Arithmetic (+ - * / %), comparison (-eq -ne -gt), logical (&& ||).
Decision Making
if-else, elif, case used for conditional logic in scripts.
Shell Loops
Looping using for, while, until to repeat commands.
Loop Control
Control flow using break and continue inside loops.
Shell Substitutions
Command: $(cmd); Arithmetic: $((expr)).
Quoting Mechanisms
Single ('), double ("), and escape (\) for controlling interpretation.
IO Redirections
Redirect output (> >>), input (<), and error (2>).
Shell Functions
Reusable script blocks defined using name() { ... }.
Manpage Help
Use man command to read documentation: man ls.
Regular Expressions
Pattern matching with grep, sed, awk. Symbols: ^ $ . * [a-z].
File System Basics
Hierarchical layout: /bin, /etc, /home, /usr, /var, /tmp, /dev.
User Administration
Manage users/groups with adduser, passwd, usermod; config files in /etc.
System Performance
Monitor system with top, htop, vmstat, iostat, uptime.
System Logging
Logs in /var/log; tools include tail, logger, logrotate.
Signals and Traps
Signals like SIGINT, SIGKILL; trap used to handle these in scripts.