Knowledge Bank
  • 🔭About Us
    • 👋Welcome to Securescape!
  • 👶Fundamentals
    • 🖥️Operating Systems (WIP)
      • Introduction to Operating Systems
      • Processes and Process Management
        • 📠Processes
        • 🧵Threads
        • 📅Scheduling
      • Memory Management
        • Virtual Memory Management
      • Storage Management
      • I/O Management
    • 🐧Linux (WIP)
      • Introduction to Linux
      • Linux System Management
    • ⚡Programming (WIP)
      • 🔗Assembly
      • 💪C(++/#)
      • 🐍Python
      • 👑Nim
      • 🔨Bash
        • Introduction to Bash Scripting
        • Variables, Loops, and Port Scanner
    • 🚩Networking (WIP)
      • 📶Networking 101
        • 🕸️Networking Basics
        • 🛑Protocols
        • 🧓IPv4
        • 🧒IPv6
      • 🪡Packet Tracer
        • Interface
        • Connections
        • Creating Networks
        • Virtual LANS & Trunks
      • 🕸️Subnetting
      • 🕵️Network Security
    • ✍️Report Writing (WIP)
      • 🔍Research Skills
      • 🏗️Structuring a Report
      • 🗃️Creating Templates
  • 🦂General Security
    • 🗒️Methodologies
      • 🇭🇰OSSTMM
      • 🐝OWASP
        • Web Security Testing Guide
        • Mobile Security Testing Guide
      • 🦅NIST
      • 🥢PTES
      • ⛓️Cyber Killchain
    • 🍔Binary Exploitation
      • ir0nstone's Binary Exploitation Notes
    • 🎩Cheat Sheets
      • Enumeration
        • Network Scan
        • Vulnerability Scan
        • Web Scan
      • Exploitation
        • Page 1
        • Payloads & Shells
      • Post Exploitation
        • Lay of The Land
        • Persistence
        • Data Exfiltration
        • Pivoting
      • Command & Control
      • Disassembly
        • ☢️Radare2
        • 🥜GDB
      • CEH Cheatsheet
  • ⚔️Offensive Security
    • 💡Hardware Exploitation
      • Intro to Hardware
    • 🥷Red Team
      • 🦠Malware Development
        • Crow Malware Development
        • 🪡C# Malware
      • 🏭Offensive Development
        • 🔧Offensive DevOps
          • 🏷️GitLab
            • GitLab Setup
            • Simple Calculator Project
            • Making our CI/CD Pipeline
            • Build Artifacts
          • 🌆TeamCity
            • TeamCity Setup
            • Creating TeamCity Projects
            • Obfuscating Payloads
          • 🍷Jenkins (WIP)
            • Jenkins Setup
            • Creating Pipelines
            • Managing Projects
            • API Interaction
        • 🏗️Infrastructure Development (WIP)
          • 🎮Command & Control Infrastructure
            • 🤖Command & Control Anatomy
              • Command & Control Frameworks
              • Ⓜ️Metasploit Framework
                • Installing Metasploit
                • Metasploit Basics
                • Advanced Features
                • Metasploit Documentation
              • 🐲Mythic Framework
                • Installing Mythic
                • Malleable Command & Control
                • All About Agents
                • Services
                • Mythic Documentation
            • 🚥Traffic Redirection
              • Nginx
              • Amazon Web Services
              • Microsoft Azure
              • Google Cloud Platform
              • Cloudflare Workers
            • 🥷Covert Infrastructure
              • Ensuring Resiliency
              • Traffic Masking
              • Network Rules
          • 🎣Phishing Infrastructure
            • 📧Email Anatomy
            • 🐟Phishing Infrastructure Setup
            • 🚚Payload Delivery
            • 🚩Removing Red Flags
          • 🪄Infrastructure as Code
            • 🏝️Terraform
              • Interacting with Docker
              • Going to the Cloud
              • Hybrid Deployment
            • 🧊Pulumi
            • 🎼Ansible
          • ⚙️Infrastructure Automation
            • 🦴Structuring our Project
            • 🏭Automating Server Setups
            • 🎼Orchestrating our Infrastructure
            • 🔧CI/CD Integration
      • 🏙️Active Directory (WIP)
        • Active Directory Overview
        • Authentication
        • AD Lab
      • Red Team Operations - Joas Santos
  • 🛡️Defensive Security
  • 📻Software Defined Radios
    • ⚠️Disclaimer
    • 📡Baofeng
      • Programming
  • 🧑‍🔬Home Lab
    • 💨Virtualisation
      • 🔸Proxmox
  • 🏁Capture The Flag
    • 🧊HackTheBox
      • 👾Cyber Apocalypse
        • Cyber Apocalypse 2023
    • 🐤TryHackMe
      • 🎄Advent of Code
      • 🚪Rooms
        • 🐥Basic Pentesting
        • 👨‍💻Blog
      • 👟Paths
    • 🏳️Competitions
      • Nahamcon
        • Nahamcon 2023
          • Binary Exploitation
            • Open Sesame
      • 👁️Iris CTF
  • 🦺DRAFTS
    • GS
      • 📱Mobile Application Security
      • 👨‍🔬Reverse Engineering
      • 🌐Web Application Security
      • 📌Information Security
      • 🔒Cryptography
      • 🤫Operational Security
    • DS
      • 🧠Threat Intelligence
        • 🦌ELK Stack
          • 🤸Elasticsearch
          • 🏕️Kibana
          • 🦤SELKS
        • 🚓Yara
      • 🏹Threat Hunting
      • 🧬Malware Analysis
        • Fundamentals
      • 🔬Forensics
        • 📶Network Forensics
          • 🦈Wireshark
          • 🥟TCP Dump
        • 💾Memory Forensics
          • ⚡Volatility
        • 💽Disk Forensics
          • 🐕Autopsy
        • 🪟Windows Forensics
        • 🐧Linux Forensics
      • 🌲Security Operations
        • Intrusion Detection & Prevention
          • 🐛Splunk
            • Splunk Basics
            • Integrating Suricata with Splunk
          • 🐗Suricata
            • Intro to Suricata
          • 🐽Snort
            • Snort Basics
        • Security Information and Event Management (SIEM)
        • Security Orchestration, Automation and Response (SOAR)
    • HL
      • 🖥️Hardware
    • OS
      • 📶Network Exploitation
      • 🌩️Cloud Exploitation
Powered by GitBook
On this page
  • Using Linux
  • File Systems
  • Navigating your terminal
  • Exercises

Was this helpful?

Edit on GitHub
  1. Fundamentals
  2. Linux (WIP)

Introduction to Linux

PreviousLinux (WIP)NextLinux System Management

Last updated 2 years ago

Was this helpful?

"Linux is an open source Unix-Like operating system based on the linux kernal..." yeah this blog isn't about a lecture on linux but how to use the system and utilise it for cyber security. What you need to know is that:

  • Linux is an operating system

  • It has things called "Distributions" which are: Ubuntu, Debian, Arch, Fedora, etc.

  • You have a lot of control over everything and linux won't warn you - wanna delete your root directory? Go for it!

This amount of customisation and control over your system makes linux an ideal system to master.

Using Linux

We will go into:

  • Linux File Systems

  • Linux Commands

  • Exercises

File Systems

Files in linux operate on a hierarchy type model for its files and directories:

Linux FHS

The top part of the 'tree' is called the root - it houses all of your directories, while everything else is called a 'node'. Each 'parent' node can have a 'child' node, which is to say, a folder inside of another folder.

Content Types

There are 4 major types of content stored in a file system:

  1. Persistent: Contents that will be persistent after a system reboot. (Systems and Application configuration settings)

  2. Runtime: Content generated by a running process (Usually deleted by a reboot)

  3. Variable/Dynamic: The content of these can be appended or modified by processes running on the system

  4. Static Content: Content that remains unchanged unless edited or configured

System Directories
Purpose

/etc

Contains configuration files used by system services

/root

This is a home directory for the Linux superuser account, root

/boot

Contains all the files needed to start the boot process.

/home

This is where standard users store their personal configurations and data such as Documents, Videos, Music etc

/var

Has variable data that is required to persist between boots – databases, log files, mails, cache directories, Web data etc

/tmp

Stores temporary files. All Linux users can write to this directory. Files older than 10 days are deleted automatically.

/usr

This directory contains shared libraries, installed software, and read-only program data. Some of the important subdirectories include: /usr/bin: Mostly user commands are located here. /usr/sbin: Hosts System administrative commands that required privilege escalation to run. /usr/local: For locally customized software.

/dev

This contains special device files used by the system to access hardware.

/run

The processes started since the last boot stores their runtime data here, e.g. process ID files and lock files. These contents are recreated on reboot.

Shortcuts

Some helpful shortcuts:

root - '/'
home - '~' OR 'cd [ENTER]'
previous - '-'

Navigating your terminal

The terminal is the most essential part of your linux system (other than the root, boot, uhh everything else) learning how to use it will make you much faster in navigating, programming, and hacking. Skipping this step will only bring you pain trust me.

Basic Commands

# Help
man - Manual - man [command] - man ls

# Utility
echo - Echoes user input (Functions as print) - echo "Hello"
cat  - Concatinate, append or replace text / display file contents - cat "Hello" > file.txt, cat file.txt

# Navigation
cd - Change Directory - cd [directory] - cd /
ls - List Directory Contents - ls [OPTIONS] - ls OR ls /[folder]

# Creating Files & Folders
mkdir - Make Directory - mkdir [NAME] - mkdir testfolder
touch - Create File - touch [NAME][.EXT] - touch script.sh
cp    - Copy File - cp [ORIG] [COPY] - cp original.txt new.txt
mv    - Move / Rename - mv [file/folder] [location] OR mv [filename1] [filename2]

# Deleting Files & Folders
rm - Remove - rm [FILE] - rm script.sh
rmdir - Remove Directory - rmdir [FOLDER] - rmdir testfolder (Empty folders)

# Network Commands
ifconfig - Interface Configuration - shows your IP addresses, and other network info - ifconfig [INTERFACE] - ifconfig eth0
ip	 - Same as ifconfig - ip a 
netstat  - Network Statistics - netstat [FLAGS]
ping 	 - Sends packets to check destination response - ping [URL] OR ping [IP]

There are many more commands that we will come across but we will get to them later. For now, let's look at flags and wildcards.

Flags

# Flags [Find list of a commands' flag using man]

## Navigation

ls -l > Long list
ls -a > Display All (Hidden included)
ls -R > List recursively (Current directory + any directory that is inside it)
# You can chain flags together too (Usually)

ls -la > List everything + long listed
ls -laR > Everything + Recursive + Long

## Nested folders
mkdir -p > create folders + parent folders if they are not present - mkdir -p folder1/folder2/folder3

## Remove
rm -r > remove recursively
rm -f > force remove
rm -rf > recursive force (! Careful with this, you can delete your entire file system as well)

Wildcards

Wildcards are special characters that do specific things or target specific items based on the users' input

* - Matches any number of chars or a set of chars. Example:

file1.txt
file2.txt

To select file2.txt using *: *2.txt
it will target a pattern that matches with whatever ends in 2.txt

? - Matches a set number of chars depends on how many ? you use. Example:

Seer
Seen
Soon

To select everything that starts with S, has 2 chars in the middle, and ends with n - S??n


[] # - Matches a range of characters between the brackets. Example:

 S[on]n # will match Son and Snn (Range from on)
# If we do S[a-d]n, we will match San, Sbn, Scn, Sdn (Range from a to d)

Exercises

Solve these exercises to get you comfortable with using Linux. You can always refer to the man page or back here for references.

[+]

[+]

👶
🐧
Source
OverTheWire Bandit
Linux Full Course Video