OphirCloud Academy

The shell is the classroom

Linux fundamentals

Five ideas carry almost everything you will do on a Linux box: everything is a file, paths are absolute or relative, permissions are bits, services are supervised processes, and text is data you can interrogate.

Watch the video
Complete Linuxon YouTube
One tree, absolute paths/├─ etc/│ └─ hostname├─ var/log/│ └─ syslog└─ opt/app/ └─ deploy.shchmod 755 deploy.shownerrwxgroupr-xotherr-x4 = read · 2 = write · 1 = execute
On a directory, execute means “may enter” — remove it and the files inside become unreachable even if they are readable.

Everything is a file

Devices, processes and sockets all appear as paths: /dev/sda is a disk, /proc/self/status is a process, /etc/hostname is a string. That is why the same handful of tools — cat, grep, find — work on almost anything.

It also means permissions are the same conversation everywhere. If a program cannot read a socket, it is the same failure as not being able to read a config file, and the same command diagnoses it.

Paths and permissions

An absolute path starts at / and means the same thing from anywhere. A relative path is resolved against your current directory, which is why a script that works by hand fails from cron: cron starts somewhere else.

Permissions are three sets of three bits — owner, group, other — read, write, execute. On a directory, execute means 'may enter', which is why a folder without it hides its contents even when the files inside are readable.

Processes, services and text

A service is a process something else supervises. `start` runs it now, `enable` makes it come back after a reboot; confusing the two is the most common reason a fix does not survive the night.

Logs are text, so diagnosis is usually a filter: grep for the status code, count the matches, find the file that names it. That is the whole method — read the machine's own account before guessing.

Commands in this lesson

Every one of these runs in the sandbox — no real account, no real bill.

CommandWhy
mkdir -p /opt/app`-p` creates parents and does not fail if it already exists — safe to re-run.
cp -r /opt/src /opt/backup`-r` for directories. Without it cp refuses, which is a feature.
chmod 755 /opt/app/deploy.shOwner rwx, group and others r-x. The script becomes runnable without being editable.
chown root:root /opt/app/deploy.shOwnership decides who may change the modes in the first place.
systemctl start nginxRuns it now. Not the same as enabling it at boot.
systemctl enable nginxSurvives a reboot. Do both if the service should be running either way.
systemctl status nginx > /opt/status.txtExit state, captured to a file so it can be graded or read later.
grep -r "error" /var/logRecursive search: the fastest way to find out which component is complaining.
find / -name "*.conf"Locate by name when you know the shape but not the path.

Now do it

Reading the model makes the first attempt faster. Only the lab makes you able to do it.

  • Linux Basics: Files & Directories

    Beginner · 15 min · free

    Open the lab
  • Navigation: Moving Around the Filesystem

    Beginner · 12 min · free

    Open the lab
  • Linux Permissions

    Intermediate · 20 min · free

    Open the lab
  • Services: Managing systemd Units

    Intermediate · 20 min · free

    Open the lab
  • Searching Inside Files with grep

    Intermediate · 18 min · free

    Open the lab

Linux fundamentals · OphirCloud Academy · all lessons