Linux commands, Bash scripts, and the notes I come back to.
This is the Linux and Bash side of my Java/Spring Boot backend work: working with files, running an application, reading its logs, and automating repeated tasks. I started it during my Operating Systems lab at UBIT, University of Karachi, and keep the useful notes and scripts here for revision.
Recorded work: 8 Linux chapters · 4 Bash chapters · 12 Bash practice scripts
Learning map · Practical work · Use the lab · Connected labs
The Linux and Bash topics I want for backend development. Linked topics open recorded notes, exercises, or project code. Plain text is coverage still to add.
01 · Files, paths, and permissions
- Navigation and paths —
pwd,ls,cd, absolute and relative paths. - Files and directories —
mkdir,touch,file,stat,tree. - Copying, moving, and deleting — source and destination paths, overwrites, and practice copies.
- Permissions and ownership —
rwx,chmod,chown,chgrp,id,umask. - Users, groups, service accounts, and when
sudois needed. - Symbolic links and resolved paths —
ln -sandreadlinkin the release-switching code. - Archives and disk space —
tar,zip,unzip,df,du.
02 · Logs and text processing
- Reading files and following logs —
cat,less,head,tail. - Searching text and finding files —
grep,find, literal text, and patterns. - Text processing —
wc,cut,sort,uniq,tr, basicsedandawk. - Pipes and redirection — stdin, stdout, stderr,
|,>,>>,2>,tee. - Service logs and journal filters —
journalctl.
03 · Processes and the Java runtime
- Process inspection —
ps,pgrep,top, process IDs, and resource use. - Foreground and background jobs —
jobs,fg,bg,&. - Signals and graceful termination —
kill, SIGTERM, and SIGKILL. - Environment variables —
export,printenv,PATH,JAVA_HOME, and inheritance. - Packages and JDK selection —
apt,command -v,java -version,javac -version. - Running an executable JAR —
java -jar, arguments, and process exit status.
04 · Networking and remote access
- HTTP requests —
curl, headers, response bodies, status codes, timeouts, and failed requests. - Listening ports and binding addresses —
ss, localhost, and port conflicts. - Basic connectivity and name resolution —
ping,hostname, DNS, and hostnames. - SSH access — keys, host verification, and
~/.ssh/config. - File transfer —
scpand basicrsync.
05 · Bash fundamentals
- Shell and script basics — shebangs, execution order, working directories, and executable permissions.
- Variables and expansion — quoting,
${name},$(command), arithmetic, splitting, and globbing. - Input and output —
IFS= read -r,printf, fixed formats, and failed reads. - Operators and exit statuses — numeric and string tests,
$?,&&,||. - Conditions and menus —
if,else,case. - Loops —
for,while,break,continue. - Arrays — indexed and associative arrays, iteration, lookup, and
"${items[@]}". - Arguments and defaults —
$1,$#,"$@",shift,${name:-default}, and usage messages. - Functions and scope — parameters,
local, return statuses, and reusable operations.
06 · Bash reliability and debugging
- Input validation — numeric formats, decimal conversion, ranges, and retry loops.
- Syntax checks and tracing —
bash -nandbash -x. - Static analysis and edge cases — ShellCheck, invalid input, EOF, whitespace, and duplicates.
- Failure handling — explicit status checks,
exit, stderr,set -e,set -u,pipefail, and their limits. - Cleanup —
trap, temporary files, andmktemp. - Repeatable runs — checking dependencies, guarding file changes, and handling existing output.
07 · Practical backend workflows
- Build and test a Java project with its Maven Wrapper.
- Run a Spring Boot JAR outside the IDE with the intended profile and environment.
- Test an API and write a health check with a clear HTTP success condition.
- Diagnose startup failures, occupied ports, and database connection errors.
- Deploy and recover a Java service — versioned releases, health and version checks, and rollback.
- Run Java under systemd — service configuration and restart behaviour.
- Write a build/test/run helper and reuse its build and test steps in CI.
- Archive sample configuration and logs, restore them elsewhere, and verify the contents.
Docker and Compose come with a later application exercise. Deep administration, advanced networking, Kubernetes, Terraform, and Ansible sit outside this lab's current scope.
Applied · DeployLatch
For my OS project, I built a Bash tool that deploys a Java service on Ubuntu and verifies its health and version. I tested a working update and recovery from a failed one. It made one distinction clear: a running process can still be unhealthy or running the wrong release.
Deployment script · Update and rollback demo
Browse the practice scripts and their expected behaviour →
Ubuntu · Bash · Git · VS Code
Learn a topic, try it, change the input, check the result, and commit the useful part. Short notes and corrections stay with the code so I can return to them later.
Setup and first run
Use a Linux terminal with Bash and Git installed. Ubuntu in WSL or a VM works for the exercises.
git clone https://github.com/codewithmahad/LINUX_LAB.git
cd LINUX_LAB
bash learning/bash-scripting/01-shell-and-script-basics/hello.shThe greeting is Hello From Bash. Use bash -n path/to/script.sh to check a script's syntax without running it.
Notes and chapter examples live in learning/; standalone exercises in practice/; illustrations and their credits in assets/.
References
- Bash and command options: GNU Bash manual, local
manpages,command --help, and Bash'shelpbuiltin. - Spring Boot: Running an application · External configuration.
- Application command reference: Build, run, and inspect a separate Spring Boot project.
- Builds and HTTP: Maven Wrapper · curl manual.
- Services and logs: systemctl · journalctl.
Found a mistake? Open an issue with the file, command, and result.
This lab keeps my Linux and Bash coursework: files, processes, logs, and scripts. My main programming practice is in the other three labs: Java for the language, DSA for problem solving, and SQL for queries and relational design.
Outside this coursework, I keep my coding practice here.
Maintained by Shaikh Mahad · Portfolio · MIT License · Artwork credits · Back to top ↑
