# Linux In a Week

## syllabus

* **Basics**: File system, commands, permissions.
* **Users**: Management, groups, sudo.
* **Processes**: Monitoring, control, logs.
* **Networking**: Config, SSH, firewall.
* **Storage**: Disks, LVM, mounts, swap.
* **Services**: Systemd, cron, logrotate.
* **Security**: Firewall, backups, permissions.
* **Troubleshooting**: Logs, recovery, monitoring

## Day 0 : Linux Fundamentals & Initial Setup

**Topics**:

* What is Linux? (Kernel, distros: Ubuntu, CentOS, etc.).
* Installation: Setting up a VM (Ubuntu 22.04 LTS recommended).
* File system hierarchy: /, /etc, /var, /home, /usr, /bin.
* Basic commands: ls, cd, pwd, mkdir, touch, cat, whoami.
* Permissions: chmod, chown, ls -l.

**Hands-On**:

* Install Ubuntu VM.
* Create a project directory: /var/www/myweb.
* Set permissions for a web user

```sh
```

## Day 1 : User Management & File Operations

**Topics**:

* User management: useradd, passwd, usermod, deluser, id.
* Group management: groupadd, gpasswd, groups.
* File operations: cp, mv, rm, find, tar, ln.
* Text editors: nano, vim (basic usage).
* Sudo privileges: /etc/sudoers.

**Hands-On**:

* Add a backup user and configure sudo.
* Copy and archive web files

```sh
```

## Day 2 : Processes, Resource Monitoring & Logs

**Topics**:

* Process management: ps, top, htop, kill, pkill, nice, renice.
* Resource monitoring: df, du, free, uptime, iostat (install sysstat).
* Background jobs: &, jobs, bg, fg, nohup.
* System logs: /var/log, dmesg, journalctl.

**Hands-On**:

* Install Apache and monitor its process.
* Check logs for startup errors

## Day 3 : Networking & Security

**Topics**:

* Networking: ifconfig, ip, ping, netstat, ss, curl.
* DNS: /etc/hosts, /etc/resolv.conf.
* SSH: ssh, scp, keygen (ssh-keygen), sshd\_config.
* Firewall: ufw, iptables basics.
* Package management: apt, dpkg, snap.

**Hands-On**:

* Secure Apache with a firewall and SSH keys.
* Test the web server locally

```sh
```

## Day 4 : Volume Management & Storage

**Topics**:

* Disk basics: fdisk, lsblk, parted, df.
* Mounting: mount, umount, /etc/fstab.
* Logical Volume Manager (LVM): pvcreate, vgcreate, lvcreate.
* File systems: mkfs, fsck.
* Swap space: swapon, swapoff.

**Hands-On**:

* Add a new disk, create an LVM volume, and mount it for web backups

```sh
```

## Day 5 : Services, Backups & Advanced Admin

**Topics**:

* Service management: systemctl, service, init.d.
* Backups: rsync, tar, cron for scheduling.
* Log rotation: logrotate.
* Kernel params: /etc/sysctl.conf, sysctl.
* Performance tuning: ulimit, nice.

**Hands-On**:

* Configure Apache as a service and set up a backup routine

```sh
```

## Day 6 : Real-Time Project & Recap

**Topics**:

* Tie all concepts together: web server, security, storage, backups.
* Monitoring: Install and configure htop or nmon.
* Troubleshooting: Common issues (e.g., disk full, service down).
* Bonus: Intro to containers (Docker) or cloud (optional).

**Hands-On**:

* Test the full system: web server running, backups working, logs rotating.
* Simulate a failure (e.g., stop Apache) and recover

```sh
```

## Interview Preparation

1. Explain why /var is used for web content and how permissions secure it
2. Discuss privilege escalation and why sudo is safer than root
3. Explain how journalctl helps debug service failures
4. Discuss how to troubleshoot "Connection refused" errors
5. Explain LVM advantages (e.g., resizing volumes on the fly)
6. Discuss how to recover a server from a failed disk using backups
7. "How do you secure a server?" (Firewall, SSH keys, permissions)
8. "How do you handle disk space issues?" (LVM, df, du)
9. Suggest showcasing this project in a portfolio


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://charan-techjourney.gitbook.io/charan-techjournal/50-days-of-devops-ecommerce-microservices/weekly-devops/linux-in-a-week.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
