Many aspiring ethical hackers skip Linux basics and jump straight to hacking tools.
Without understanding the command line, users struggle to analyze logs, manage systems, or investigate incidents effectively.
HackAndBuild.dev bridges that gap by teaching Linux in a cybersecurity-first way — hands-on, concise, and practical.
Security Angle: Recognize where attackers hide scripts or modify configs.
/etc: System configuration files (passwords, service configs)./var: Variable data, like logs (/var/log) and web content (/var/www)./usr: User-installed software and binaries./home: User's personal directories./tmp:
Temporary files (often world-writable, a common target for attackers).pwd: Print Working Directory (shows where you are).cd: Change Directory (cd .. to go up, cd ~ for home).ls: List directory contents.
ls -la: List all files (including hidden) in long format (shows permissions, owner, size).ls -lR: Recursively list all files in subdirectories.ls -lt: Sort by modification time (shows newest files first).tree: View directory structure as a tree (may need to be installed).
Security Angle: Recognize where attackers hide scripts (e.g., hidden files in /tmp) or modify configs in /etc.
cat: Concatenate and print files. Use cat -n to show line numbers.less: View large files page by page (press 'q' to quit, '/' to search).head / tail: Show the top or bottom 10 lines of a file.
tail -n 50: Show the last 50 lines.tail -f /var/log/auth.log: "Follow" a log file in real-time. (Crucial for SOC analysis).grep: Search for patterns in text.
grep "Failed password" /var/log/auth.log: Find all failed login attempts.grep -iR "password" /etc: Recursively search (-R) for "password", ignoring case (-i), in the /etc directory.nano: A simple, beginner-friendly text editor.vi / vim: A powerful, modal text editor. Essential for servers.mkdir: Make directories. Use mkdir -p "parent/child" to create nested directories.rmdir: Remove *empty* directories.cp: Copy files/directories. Use cp -r for recursive copy (directories).mv: Move or rename files/directories.rm: Remove files. Use rm -r to remove directories and rm -f to force removal. (Use with caution!)find: Search for files.
find /tmp -user hacker: Find files in /tmp owned by user 'hacker'.find / -mmin -60: Find files modified in the last 60 minutes.|: Sends the output of one command as the input to another. Ex: cat /var/log/syslog | grep "error".>: Overwrites a file with command output.>>: Appends command output to the end of a file.
Security Angle: Learn how analysts use grep, tail, and find to hunt for indicators of compromise (IOCs), monitor live logs, and find attacker tools.
useradd hacker: Creates a new user named 'hacker'.passwd hacker: Set (or change) the password for 'hacker'.usermod -aG sudo hacker: Add user 'hacker' to the 'sudo' group (grant admin rights).userdel -r hacker: Remove user 'hacker' and their home directory.groupadd analysts: Create a new group 'analysts'.gpasswd -a user1 analysts: Add 'user1' to the 'analysts' group.gpasswd -d user1 analysts: Remove 'user1' from the 'analysts' group.sudo [command]: Run a command with root (admin) privileges.visudo or nano /etc/sudoers: Edit the file that defines who can use sudo. (Very sensitive!)Security Angle: Understand how attackers add rogue users or add themselves to the 'sudo' group to maintain persistent access and escalate privileges.
cd).chmod u+x script.sh (adds execute for user). chmod o-w file.txt (removes write for other).chmod 644 web.config (User=rw-, Group=r--, Other=r--). Common for web files.chmod 600 key.pem (User=rw-, Group=---, Other=---). This is secure for private keys.chown -R www-data:www-data /var/www: Recursively set web server user/group for a web directory.umask: Sets the default permissions for newly created files (e.g., 022 is a common default).-rwsr-xr-x).passwd command uses SUID to let a normal user change their own password in the root-owned /etc/shadow file.find / -perm -u=s -type f 2>/dev/null (find files with SUID bit set, ignore errors).
Security Angle: Attackers hunt for world-writable files (chmod 777) to inject malware. Misconfigured SUID bits are a classic and powerful privilege escalation vector.
Process management, services, and essential networking tools for defenders.
Go to Module 2Tools and references to support your learning.
HackAndBuild.dev is a practical cybersecurity learning initiative by Tharaka Mahabage,
Director – SL CERT | Enterprise Cybersecurity Architect | Lecturer in Cybersecurity
To empower learners in Sri Lanka and beyond to build cybersecurity skills through hands-on, short-format learning — from Linux and networking to ethical hacking and red teaming.