Linux Basics for DBAs
What Linux is, why DBAs need it, how it's built from the kernel up, how its filesystem is organized, and how to connect to a Linux server.
What's Linux
Linux is a free, open-source, Unix-like operating system (OS). Linus Torvalds released the first version of its kernel in 1991.
- Open source: the source code is freely available, and anyone may study, modify, and redistribute it.
- Unix-like: Linux behaves and feels like the Unix operating system. It shares Unix's core design ideas and its command-line interface.
- Distributions: a Linux distribution (also called a distro or flavor) packages the Linux kernel with tools, a package manager, and other software into a complete operating system. Popular distros include Red Hat Enterprise Linux (RHEL), Oracle Linux, Ubuntu, Debian, SUSE Linux Enterprise, Fedora, and Kali Linux.
Why DBAs need Linux
Most production databases run on Linux. Oracle Database, MySQL, and PostgreSQL are built and tested on Linux first. Microsoft SQL Server is the main exception: it started on Windows, though it has also run on Linux since SQL Server 2017.
- Linux gives DBAs more control over system resources such as memory, storage, and processes.
- It delivers strong, stable performance for database workloads.
- Modern automation tools, such as Ansible, Terraform, and shell scripts, run naturally on Linux.
- It can cost less: many distributions are free, and enterprise distributions sell support subscriptions instead of per-server licenses.
How Linux is built
Linux is built in layers, and each layer has a clear job. Together they keep the system running smoothly.
- Kernel
- Manages the hardware and shares it between programs.
- Shell
- The command-line interface (CLI) you type commands into.
- Apps and utilities
- The software you install and the tools that come with the OS.
The kernel
The kernel is the core of the Linux operating system. It:
- Communicates directly with the computer's hardware.
- Acts as the middleman between hardware and software.
- Handles complex tasks, such as memory and process management, so applications don't have to.
The shell
The shell is a command-line interface that lets you communicate with Linux. Think of it as the translator between you and the system.
What happens when you type a command
- YouType a command
- ShellPasses it to the kernel
- KernelDoes the work
- ShellShows you the result
Types of shells
There's more than one shell, and each has its strengths. Bash is the one you'll use most.
| Shell | What to know |
|---|---|
| Bourne shell (sh) | Written by Stephen Bourne at Bell Labs and released in 1979. It became the standard Unix shell and the foundation for many modern shells. |
| Bash (Bourne Again Shell) | Released in 1989. The most widely used shell and the default on most Linux distributions. |
| C shell (csh) | Written by Bill Joy in the late 1970s. It introduced interactive features such as command history. |
| tcsh | An enhanced C shell that adds command-line editing and completion. |
| KornShell (ksh) | Written by David Korn at Bell Labs and released in 1983. It combines Bourne shell compatibility with C shell features and strong scripting. Common on AIX and older Unix systems. |
| Z shell (zsh) | Released in 1990. Highly customizable, and the default shell on macOS since 2019. |
To see which shell you're using, run:
$ echo $SHELL
/bin/bash
CLI vs GUI
| CLI (command-line interface) | GUI (graphical user interface) | |
|---|---|---|
| How you work | Type commands | Point and click |
| Strengths | Fast, scriptable, and works over remote connections | Easy to discover and learn |
| Where you'll see it | Linux servers | Desktops and Windows servers |
Most Linux database servers have no GUI installed at all, so DBAs work almost entirely in the CLI.
The Linux filesystem
The Filesystem Hierarchy Standard (FHS) is a set of guidelines, maintained by the Linux Foundation, that defines the directory structure of Linux and other Unix-like systems. It keeps directories consistent across distributions. Everything starts at the root directory, written as a single slash: /.
Key directories
| Path | What it holds |
|---|---|
/ | The root: the top of the entire directory tree. |
/bin, /usr/bin | Command programs (binaries), such as ls. On most modern distributions, /bin is just a link to /usr/bin. |
/etc | System configuration files. |
/home | Users' home directories, such as /home/kofi. |
/var | Data that changes while the system runs, such as logs in /var/log. |
/usr | Installed programs, libraries, and documentation. |
/opt | Optional add-on software. Some database software is installed here. |
/dev | Device files that represent hardware, such as disks and USB drives. |
/lib, /usr/lib | Shared libraries that programs need to run. |
/tmp | Temporary files, often cleared when the system restarts. |
Windows paths vs Linux paths
Windows uses its own directory structure, defined by Microsoft. The same folder is written differently on each system:
Windows and Linux terms
| Windows | Linux |
|---|---|
| Owned by Microsoft (closed source) | Open source |
| Folder | Directory |
| Administrator is the superuser | root is the superuser |
Drive letters, such as C: and D: | Mount points: disks are attached somewhere in the one tree, such as /home |
| GUI first | CLI first |
| PowerShell and Command Prompt | Shells such as bash |
| Windows directory structure | FHS (Filesystem Hierarchy Standard) |
| File names aren't case-sensitive | File names are case-sensitive: Report.txt and report.txt are different files |
Backslash in paths: C:\Users\kofi | Forward slash in paths: /home/kofi |
Connecting to servers remotely
You'll rarely sit in front of a database server. Instead, you connect to it over the network.
- SSH (Secure Shell)
- Opens an encrypted command-line session on a remote Linux server. It uses port 22.
- RDP (Remote Desktop Protocol)
- Opens the full graphical desktop of a remote Windows machine. It uses port 3389.
To connect over SSH, give your username and the server's name or IP address:
$ ssh username@server-address
$ ssh kofi@10.1.149.123 # example
Key takeaways
- Linux is a free, open-source, Unix-like OS, and most production databases run on it.
- It's built in layers: hardware, the kernel, and the shell and programs on top.
- Bash is the shell you'll use most.
- Everything lives in one directory tree starting at
/, organized by the FHS. - Linux is case-sensitive and uses forward slashes in paths.
- Connect to Linux servers with SSH (port 22) and to Windows servers with RDP (port 3389).