Skip to content

Linux Fundamentals for Cybersecurity

According to the Linux Foundation’s 2024 Annual Report, Linux powers over 90% of the world’s top supercomputers, the majority of cloud infrastructure, and the vast majority of web servers worldwide. NIST SP 800-123 (Guide to General Server Security) recommends Linux as a server platform with robust built-in security controls including mandatory access control, comprehensive logging, and granular file permissions.

Linux is the operating system that runs the majority of web servers, cloud infrastructure, security tools, and hacking platforms. If you want to work in cybersecurity, you need to be comfortable in a Linux terminal.

This page covers the Linux fundamentals that security professionals use daily — explained from the beginning for people who have spent their computing lives on Windows or Mac.

Legal notice: Practice all commands and techniques only on systems you own or have explicit written permission to access. Unauthorized access to computer systems is illegal in most jurisdictions and carries serious consequences.

Security tools are built for Linux. Kali Linux is the dominant platform for penetration testing. Most SIEM platforms, log analysis tools, and server environments run on Linux. Knowing Linux is not optional for most security roles.

The command line gives you control. Graphical interfaces hide what is actually happening. The command line exposes it. Security work involves understanding system internals, and the Linux terminal is the best environment for that.

It is free. Linux distributions cost nothing. You can install Ubuntu or Kali Linux in a virtual machine today without spending anything. The CompTIA A+ exam covers Linux basics, so learning these fundamentals also prepares you for your first certification.

The first time I opened a Linux terminal, I genuinely thought I’d made a mistake choosing this career path. I’d spent my entire life on Windows and Mac — point, click, done. Staring at that blank command prompt with its blinking cursor felt like arriving in a country where I couldn’t read the signs. I typed ls and hit enter, and when a list of files appeared, I felt a tiny rush of accomplishment that seems ridiculous now. But that’s how it starts. Each small command builds on the last, and within a few weeks I was navigating the file system, reading logs, and wondering why I’d ever been afraid of it.

Which Linux Distribution Should You Start With?

Section titled “Which Linux Distribution Should You Start With?”

The Linux Foundation maintains over 600 active Linux distributions, but for cybersecurity beginners, the choice comes down to two: a general-purpose distribution for learning fundamentals, and a security-focused distribution for professional tooling.

A Linux distribution (distro) is a packaged version of Linux with specific software included.

Ubuntu is the recommended starting point for most beginners. It is stable, widely supported, and has a large community. The user interface is approachable, documentation is abundant, and it runs well as a virtual machine.

Start with Ubuntu if you want to learn Linux fundamentals without the distraction of security-specific tooling.

Kali is a Debian-based distribution built specifically for penetration testing and security work. It comes pre-installed with hundreds of security tools including Nmap, Wireshark, Metasploit, and Burp Suite.

Kali is not a daily-driver operating system — it is a professional tool. Use it once you understand basic Linux operations and are ready to learn specific security tools. The Home Lab Setup guide covers installing Kali in a virtual machine.

Here is a side-by-side comparison to help you decide which distribution to start with:

Ubuntu vs Kali Linux

Ubuntu
  • General purposeGreat for learning Linux basics
  • Beginner-friendlyLarge community, easy setup
  • Daily driverSuitable as primary OS
  • Package ecosystemInstall security tools as needed
VS
Kali Linux
  • Security-focused600+ pre-installed security tools
  • Pen testing readyBuilt for offensive security work
  • Lab use onlyNot designed as daily driver
  • Pre-configuredTools ready immediately on install
Verdict: Start with Ubuntu to learn Linux fundamentals. Use Kali in your lab for security-specific practice.
Use case
Use Ubuntu for daily computing and learning commands. Use Kali Linux in a VM for hands-on security exercises.

The terminal (also called the command line, shell, or console) is where you interact with Linux by typing commands. The shell is the program that interprets those commands — the most common shell is Bash (Bourne Again Shell).

When you open a terminal, you see a prompt that typically looks like:

username@hostname:~$

The ~ means you are in your home directory. The $ indicates you are a regular user (not root). A # prompt means you are root.

Terminal window
pwd # Print working directory — shows where you are
ls # List files in current directory
ls -la # List all files including hidden, with permissions
cd /home # Change directory to /home
cd ~ # Go to your home directory
cd .. # Go up one directory level
Terminal window
cat filename.txt # Display file contents
less filename.txt # View file contents with scrolling (q to quit)
cp source dest # Copy a file
mv source dest # Move or rename a file
rm filename # Delete a file
rm -r directory # Delete a directory and its contents
mkdir newdir # Create a new directory
touch newfile.txt # Create an empty file
Terminal window
grep "searchterm" filename # Search for text in a file
grep -r "searchterm" /path/ # Search recursively in a directory
grep -i "searchterm" filename # Case-insensitive search
find /path -name "filename" # Find a file by name
find /path -type f -name "*.log" # Find all .log files

grep is one of the most used commands in security work. Log analysis is largely reading output and filtering it with grep.

Terminal window
whoami # Show current user
id # Show user ID and group memberships
uname -a # Show kernel and system information
ps aux # Show all running processes
top # Live process viewer (q to quit)
df -h # Show disk usage in human-readable format
free -h # Show memory usage
ifconfig # Show network interfaces (older systems)
ip addr # Show network interfaces (modern systems)
Terminal window
cat /var/log/syslog # System log (Ubuntu)
cat /var/log/auth.log # Authentication log (login attempts)
tail -f /var/log/syslog # Follow log in real time (Ctrl+C to stop)
journalctl -u ssh # View SSH service logs (systemd systems)

Logs are central to security work. Knowing how to navigate to them and read them efficiently is a core skill.

The Filesystem Hierarchy Standard (FHS), maintained by the Linux Foundation, defines a standardised directory layout used across virtually all Linux distributions — ensuring that security professionals can navigate any Linux system using the same mental model.

Linux organizes everything in a single directory tree starting at / (root). Key directories:

DirectoryContents
/Root of the entire file system
/homeUser home directories (/home/username)
/rootHome directory for the root user
/etcSystem configuration files
/var/logSystem and application log files
/binEssential user binaries (commands)
/usr/binMost user-installed programs
/tmpTemporary files (cleared on reboot)
/procVirtual filesystem: running process info
/devDevice files

In security contexts, /etc/passwd (user accounts), /etc/shadow (password hashes), and /var/log/ are particularly important.

Linux File System Hierarchy

Key directories from root to optional software

/ (Root)
Top of the file system tree
/home
User home directories
/etc
System configuration files
/var
Variable data — logs, mail, temp files
/usr
User programs and utilities
/tmp
Temporary files (cleared on reboot)
/opt
Optional/third-party software
Idle

NIST SP 800-123 identifies misconfigured file permissions as one of the most common server security vulnerabilities. Linux uses a discretionary access control (DAC) permission system that controls who can read, write, or execute each file — and understanding this is essential for security work.

Linux uses a permission system that controls who can read, write, or execute each file. Understanding this is essential for security work.

When you run ls -la, you see output like:

-rwxr-xr-- 1 alice developers 4096 Mar 11 10:00 script.sh

Breaking down -rwxr-xr--:

  • First character: file type (- = regular file, d = directory, l = symbolic link)
  • Next three characters: owner permissions (rwx = read, write, execute)
  • Next three: group permissions (r-x = read, no write, execute)
  • Final three: others permissions (r-- = read only)
Terminal window
chmod 755 script.sh # Owner: rwx, Group: r-x, Others: r-x
chmod +x script.sh # Add execute permission for everyone
chmod 600 private.key # Owner: rw, no access for anyone else
chown alice:developers file # Change owner and group

In security, misconfigured permissions are a common vulnerability. Files with world-writable permissions (chmod 777) or sensitive files readable by all users are findings in security audits. Permissions tie directly to the principle of least privilege covered in the Security Concepts page.

Terminal window
sudo command # Run command as root
sudo su # Switch to root shell (use carefully)
su username # Switch to another user
adduser newuser # Add a new user
passwd username # Change a user's password
groups username # Show what groups a user belongs to
cat /etc/passwd # View all user accounts

sudo (Superuser Do) allows specific users to run commands with elevated privileges without logging in as root. Understanding sudo configuration is important for both hardening systems and for privilege escalation concepts in penetration testing.

Package managers handle software installation, updates, and removal.

Terminal window
sudo apt update # Refresh package list
sudo apt upgrade # Upgrade installed packages
sudo apt install packagename # Install a package
sudo apt remove packagename # Remove a package
sudo apt search keyword # Search for a package

Most security tools in the Kali repositories can be installed with apt. For example:

Terminal window
sudo apt install nmap # Network scanner
sudo apt install wireshark # Packet analyzer (see the [Wireshark guide](/tools/wireshark/))
sudo apt install gobuster # Directory brute-forcer

Exercise 1: Navigate the file system Open a terminal and explore these directories: /etc, /var/log, /home. Use ls -la in each. Notice file permissions and ownership.

Exercise 2: Search log files Run grep "Failed" /var/log/auth.log to see failed login attempts on your system. If the file is empty, try journalctl -u sshd on systemd systems.

Exercise 3: Understand your user context Run whoami, id, and groups. Understand what your user can and cannot do.

Exercise 4: View running processes Run ps aux and look at what is running on your system. Try ps aux | grep ssh to filter for SSH-related processes.

Exercise 5: Change file permissions Create a test file with touch testfile.txt. View its permissions with ls -la testfile.txt. Change permissions with chmod 600 testfile.txt and observe the difference.

  • TryHackMe — “Linux Fundamentals” learning path (three rooms, browser-based, free)
  • OverTheWire: Bandit — Wargame that teaches Linux by asking you to solve progressively harder challenges over SSH
  • Hack The Box — More advanced, but the starting machines have good Linux practice

TryHackMe’s Linux Fundamentals path is the recommended next step after reading this page.

Career Roadmap & Study TrackerAvailable Now

Step-by-step roadmap with study tracker worksheets and certification decision framework.

Get the Guide → $27

With Linux basics covered, you are ready to start using security tools in a controlled environment. The Home Lab Setup guide walks you through installing Kali Linux and setting up a practice environment where you can apply these skills without risk.


Linux distributions and command syntax evolve. Commands shown are verified for Ubuntu 22.04 LTS and Kali Linux 2024.x as of March 2026. Verify command syntax for your specific distribution and version.

Legal reminder: Only practice penetration testing techniques on systems you own or have explicit written authorization to test. Unauthorized access is illegal.

Linux is heavily used across Australian Government and defence systems. The Australian Signals Directorate (ASD) and the Department of Defence operate a range of classified and unclassified environments where Linux proficiency is expected. Many of Australia’s critical infrastructure operators — in energy, telecommunications, and finance — also run Linux-based server environments, meaning that Linux skills are relevant across both public and private sector security roles in Australia.

Two of the ASD Essential Eight mitigation strategies — application control and patching operating systems — directly require Linux administration knowledge in environments where Linux is deployed. Application control on Linux involves configuring tools such as AppArmor or SELinux, while patch management requires familiarity with package managers (apt, yum) and update scheduling. Candidates who can demonstrate practical Linux hardening skills aligned to the Essential Eight stand out in Australian job interviews.

Australia’s leading cybersecurity consulting firms, including CyberCX, Tesserent, and the Big Four (Deloitte, PwC, EY, KPMG), expect penetration testers and security consultants to be proficient with Linux. Offensive security assessments in Australia follow methodologies that rely heavily on Linux-based tools — Kali Linux, Nmap, Metasploit, and Burp Suite are standard. SOC analysts working in Australian managed security service providers (MSSPs) also need Linux log analysis skills, as many SIEM deployments ingest syslog and journald data from Linux endpoints and servers.

Australian privacy legislation adds practical relevance to Linux logging knowledge. The Privacy Act 1988 (Cth) and the Notifiable Data Breaches (NDB) scheme require organisations to detect and report eligible data breaches. Security professionals who understand Linux system logging — syslog, journald, auditd — are better positioned to support breach detection and investigation obligations. Familiarity with log retention, integrity, and forwarding on Linux systems is a practical skill that Australian employers value, particularly in regulated industries such as finance and healthcare.

Frequently Asked Questions

Do I need to learn Linux for cybersecurity?

Yes. The majority of security tools, servers, and cloud infrastructure run on Linux. Most cybersecurity roles require you to be comfortable navigating the Linux terminal, reading logs, and managing file permissions.

Which Linux distro should I start with?

Start with Ubuntu for learning Linux fundamentals. It is stable, well-documented, and beginner-friendly. Move to Kali Linux once you are comfortable with basic commands and ready to use security-specific tools.

How long does it take to learn Linux?

You can learn the essential commands and concepts in 2 to 4 weeks of consistent practice. Becoming truly comfortable in the terminal takes a few months of regular use, especially through hands-on labs and exercises.

What are the most important Linux commands for cybersecurity?

Focus on grep (log searching), chmod and chown (permissions), ps and top (process monitoring), netstat and ss (network connections), and find (locating files). These are used daily in security operations.

What is the difference between root and sudo?

Root is the superuser account with unrestricted access to the entire system. Sudo allows specific users to run individual commands with root privileges without logging in as root, which is safer and provides an audit trail.

Is Kali Linux good for beginners?

Kali Linux is not recommended as your first Linux experience. It is a professional penetration testing platform designed for experienced users. Learn basic Linux on Ubuntu first, then transition to Kali when you are ready for security tools.

How do Linux file permissions work?

Linux assigns read (r), write (w), and execute (x) permissions to three groups: the file owner, the group, and all other users. Misconfigured permissions are a common security vulnerability found during audits.

Where are log files stored in Linux?

Most system logs are in /var/log/. Key security-relevant logs include auth.log (login attempts), syslog (system events), and application-specific logs. SOC analysts spend significant time reading and filtering these logs.

Can I practice Linux without installing it?

Yes. TryHackMe provides browser-based Linux terminals for free. You can also run Linux in a virtual machine using VirtualBox or VMware, which keeps it separate from your main operating system.

What Linux topics appear on CompTIA Security+?

Security+ tests your knowledge of Linux file permissions, log analysis, command-line tools, user management, and system hardening. The exam expects you to recognize common commands and understand their security implications.