Unix Fundamentals
itOperating systems
Unix Fundamentals
Unix is a family of operating systems and interfaces built around a small set of durable ideas: files, processes, permissions, text streams, and composable utilities. Linux, the BSD systems, and macOS inherit much of this model. They are not identical products, so treat a Unix command as a contract to check, not a promise that every option exists everywhere.
POSIX is the shared standard that makes much of this environment portable. It specifies a shell command language, utility behavior, pathname rules, and system interfaces. The standard does not make every Unix-like system the same. It gives you a useful common floor.
The model: a process connected to files
A process is a running program. It runs with an identity, a current working directory, an environment, and open file descriptors. In Unix, a file descriptor is a small number that identifies an open input or output channel for that process.
By convention, standard input is descriptor zero, standard output is descriptor one, and standard error is descriptor two. A terminal, a regular file, a pipe, or a socket can sit behind one of those descriptors. This is why one program can read another program's output without either program knowing the other exists.
The shell is the command language interpreter that creates this wiring. It reads a command, recognizes words and operators, expands words, applies redirections, starts the command, and observes its exit status. An exit status is the result code a command returns to its caller. Zero conventionally means success; a nonzero status asks the caller to handle a failure or a different result.
Filesystem: one hierarchy, many file types
Unix presents a rooted directory hierarchy. An absolute pathname starts at the root directory, written as /. A relative pathname starts from your current working directory. A directory maps names to filesystem objects, so a pathname is a route through directories rather than a label stored inside a file.
Regular files hold byte sequences. Directories organize names. Symbolic links point to another pathname. Devices, pipes, and sockets also appear as filesystem objects. The uniform naming model is useful, but it does not mean every object behaves like a regular file.
Ownership and permission bits control ordinary access checks. Each object has an owning user, an owning group, and permissions for owner, group, and other users. Read, write, and execute mean different things for files and directories. On a directory, execute permits pathname traversal; read permits listing names; write permits creating, removing, or renaming entries when the other rules also allow it.
Shell: compose instead of monoliths
The shell is both an interactive command interpreter and a programming language. You use it to start utilities, connect them with a pipeline, redirect files, and make decisions from exit statuses.
find . -type f -name '*.log' -print | sort > log-files.txt
This pipeline asks find for matching pathnames, sends them through sort, and writes the sorted result to a file. The pipe carries standard output from the command on its left to standard input of the command on its right. Redirection changes where a descriptor reads or writes.
Quoting is a safety boundary. The shell gives special meaning to spaces, wildcard characters, dollar signs, quotes, and control operators. Quote data when you mean data. In particular, use double quotes around variable expansions unless you deliberately want word splitting and pathname expansion.
rm -- "$file"
The -- convention tells many utilities that later values are operands, even if a filename begins with a dash. It is a practical defense when processing untrusted filenames, though you must check the utility's documentation before relying on it for portability.
Processes, jobs, and signals
When you run a command, the shell starts a process and normally waits for it. Add & to run a job in the background in an interactive shell. Job control is a shell-and-terminal feature for stopping and resuming process groups; it is not a replacement for service supervision.
A signal is an asynchronous notification to a process. Programs can handle some signals, ignore some, or accept the default action. SIGTERM requests orderly termination. SIGKILL cannot be caught or ignored, so it ends a process without giving it cleanup time. Start with SIGTERM; reserve SIGKILL for a process that will not stop.
What Unix fundamentals does and does not cover
This course gives you the vocabulary to inspect a Unix host, understand shell commands, and read system documentation. It does not make shell syntax identical across shells, make GNU options portable, or replace a security model based on least privilege and review.
Next, learn the sh and POSIX utility contracts. Then practice on one target system and learn its own manuals. After that, move into shell scripting, process management, filesystems, networking, and access control.
