Linux fundamentals
The terminal, the file system, file operations, redirection and pipes.
Level 101 · 18 lessons · 21 practice labs
Lessons
Getting started
- What Linux is and why security teams use it: What Linux is, where it runs (phones, servers, the cloud) and why security teams choose it. Learned from zero.
- The terminal and the shell: your first commands: Talking to the computer by typing: what the prompt waits for and how it answers. You type your first commands.
- Getting help: man, info, --help: What to do when you do not know a command: use the built-in manual (man) and --help.
- Short task: work out an unfamiliar command using only its manual
The file system
- The directory tree and moving around: Files are laid out like a tree. You see where you are in it and learn to go to any folder.
- Knowing your files: ls, hidden files, types: What is in a folder? You learn to see hidden files, file types and sizes.
- Creating, copying, moving, deleting and wildcards: Creating, copying, moving and deleting files and folders, and picking many files at once with wildcards like * and ?.
- Links and finding files: Giving a file a second shortcut, and finding a lost file on the disk with find.
- Reading contents: cat, less, head, tail -f: Reading a long file page by page, seeing its start and end, and watching a growing log live.
- Short task: tidy a messy project folder and find the missing file
Combining commands
- Redirection, stdout and stderr, and pipes: Writing a command's output to a file or handing it to the next command (a pipe); the difference between normal output and error messages.
- Filtering and counting: grep, sort, uniq, wc, cut: You will use grep to pull the lines you want out of a large text, then sort and count repeats, which is the basis of log analysis.
- Exit status and chaining commands: How do you know a command succeeded? How do you chain commands as "continue only if the previous one worked"?
- Variables, PATH and .bashrc: Values the shell remembers, where commands are looked up (PATH) and making your settings permanent (.bashrc).
- Aliases, command substitution and history: Giving long commands short names, using one command's output inside another, and going back to earlier commands.
- Editing files: first steps with nano and vim: Opening and editing a config file in the terminal: easy nano and a first step with vim, which is on every server.
- Short task: build a daily summary with a one-liner
Wrap-up
- Capstone: investigate an incident folder and find the suspicious IP: Like a real incident: examine a company's log folder, find the suspicious IP address and report it.
Practice labs
- Look up an unknown option in the manual: Find in the man page what an option used in a script does and explain it in one sentence in the answer file.
- Find the right command with apropos: Use apropos and man sections to find a command whose name you do not know, then use it to produce the requested output.
- Learn a file format from section 5 and fix it: Learn the broken config file's format from its section 5 man page and correct the faulty lines.
- Find the hidden file in a home directory: Find the dot file hidden in a user's home directory and submit the note inside it.
- Catch the file with a lying extension: Use file to find the item in the pictures folder that is really a script or archive and submit its name.
- Repair broken symbolic links: Find the broken links in the application directory, recreate those with a valid target and delete the rest.
- Change a port value in a config with nano: Use nano to change the port line in the application config to the requested value and save the file.
- Search and fix several lines in nano: In a long config file use nano's search and replace to change every occurrence of the old server name to the new one and save without touching any other line.
- Rescue an edit to a file you cannot write in nano: Without leaving nano, write the change you made to a system file opened without rights to a temporary file, put it in place with sudo and leave a backup of the original.
- Count the files changed in the last day: Use find -mtime to locate the files in the project directory changed in the last 24 hours and submit how many there are.
- Find files changed in the last hour: Find the files under the web root modified within the last hour and save the list to the answer file.
- Pick out the files changed between two moments: Using two marker files for the start and end of the maintenance window, find only the files changed in between with find -newer and save the list sorted newest first.
- Run the second command only if the first succeeds: Write a one-line command with && that creates the report directory and, only if that succeeds, puts an empty file named after the date inside it.
- Fall back when a command fails: Write a command that shows the custom config file if it exists and otherwise falls back with || to the default one, and record the value of $? in both cases.
- Chain commands that stop on failure: Chain the backup steps with && and || so a failing step prints an error and stops the rest.
- Send errors to a separate file: Run the scan and redirect normal output to one file and error messages to another.
- Find the IP with the most requests: Use sort and uniq on the access log to find the IP address that sent the most requests and submit it.
- Build a daily summary with a one-liner: Use a single pipeline to write today's error count, most common error message and affected services to a summary file.
- Fix a PATH that runs the wrong command: Find the PATH setting that makes ls run a fake script and fix it in .bashrc.
- Remove a malicious alias: Find the alias in the user's shell files that imitates sudo, remove it and submit where it was defined.
- Reconstruct an attacker's steps from history: Review the compromised account's history and report the download URL and the change made for persistence.
About this course
Linux fundamentals is a detailed course for people who want to really understand the command line. It starts with the difference between the kernel and a distribution, shows how the shell reads a command, and moves on to the file system, redirection, pipes, filtering tools, variables and editing files.
Most lessons are built with a security eye: you recognise a file with a fake extension, find the address with the most requests in an access log, and spot a command hijacked through PATH and a malicious alias. In the last lesson you examine an incident folder on your own, find the attacker’s IP address and the persistence left behind, and write a report.
What you will learn
- Tell the kernel, a distribution and the shell apart; read the structure of a command
- Learn an unknown command on your own with man, info and --help
- Move with absolute and relative paths; read file types, inodes and timestamps
- Find and manage files with wildcards, links and find
- Separate stdout from stderr and connect commands with redirection and pipes
- Get results out of log files with grep, sort, uniq, wc, cut and tr
- Chain commands with exit status, && and ||; variables, PATH and .bashrc
- Edit files with nano and vim
Who this course is for
For students who will use Linux at work, newcomers to systems and security, and people who use commands by rote and want to learn why they work.
Prerequisites
No prior knowledge is needed. Finishing Linux quick start first makes it easier, but it is not required.
Lab environment
Lessons run in your own Kali Linux terminal that opens in the browser. Nothing to install; the lab starts clean in every lesson.
Frequently asked questions
- How is it different from Linux quick start?
- Quick start gets you through the most needed commands the short way. This course is slower and deeper: how the shell works, redirection, pipes and filtering tools in detail.
- How long are the lessons?
- Each lesson takes 35 to 60 minutes, with 8 to 10 steps and a short quiz. The whole course is about 11.5 hours.
- I have no security background. Will I follow the examples?
- Yes. The security examples (fake extensions, a changed PATH, log review) are explained from zero, with everyday comparisons.
- Is there anything to install?
- No. You work in a Kali Linux terminal that opens in your browser.