Linux for Cybersecurity Beginners
Essential Commands and Exercises
Practice essential Linux commands in a small local exercise. Learn paths, file permissions, text inspection, and how to verify what changed.
By Starting Byte Team
Linux is useful in cybersecurity because many tools and services expose their behavior through files, processes, permissions, and logs. The goal is to understand those objects, not to memorize a long list of commands.
You can start with a normal user account in a Linux environment you control. The following exercise uses only fictional data in a new folder. It does not require administrator privileges.
Create a small practice workspace
Open a terminal and enter the commands below one at a time. Use a fresh directory name if a folder called security-practice already exists.
mkdir security-practice
cd security-practice
printf 'account=demo\nresult=failed\n' > sample.log
pwd
ls -l
mkdir creates the directory. cd changes your current location. printf writes two lines to sample.log. The greater-than operator replaces the contents of the destination file, which is why using a dedicated practice folder matters.
pwd shows where you are. ls -l displays information about the files there. Before running any command that changes files, establish the current directory and intended target.
Read a file before interpreting it
Use cat sample.log to display the small example. Use grep 'result=' sample.log to select the line containing that text. You should see result=failed.
That observation does not establish a security incident. The record is fictional, contains no timestamp, and does not explain what operation failed. Good analysis distinguishes the content of a record from conclusions that require more context.
For larger files, use a paging tool such as less rather than flooding the terminal. Keep an unchanged copy of evidence before experimenting with transformations.
Understand the permission display
In ls -l output, the permission string describes file type and access for owner, group, and others. For regular files, read, write, and execute are separate permissions.
You can make the fictional log readable and writable by its owner only:
chmod 600 sample.log
ls -l sample.log
The expected permission pattern is -rw-------. The numeric setting expresses owner read and write permissions, with no permissions for group or others.
This is a narrowly scoped exercise. Choosing correct permissions for a real service requires understanding which account runs it and which collaborators need access. Applying restrictive permissions everywhere can break legitimate work.
Verify a change instead of trusting the command
A command completing without an error is useful evidence, but it is not the whole result. Inspect the target again and compare it with the intended outcome.