πŸ•ΈοΈ
Th4ntis CyberSec
  • πŸ•·οΈ>whoami_
  • πŸ–₯️General Info
    • CyberSec News
    • Getting Started and other Resources
      • CompTIA Certs
        • Security+
        • Pentest+
    • MITRE ATT&CK
    • Cyber Kill Chain
    • Docker
  • πŸ’»Networking
    • General Networking
    • Common Ports and Protocols
    • TCP/IP Model
    • OSI Model
    • Subnetting
    • Wireshark
    • NMap
    • Wireless
      • Wardriving/WiFi Sniffing
    • 3-Way Handshake
  • 🐧Linux
    • Common commands
    • Sudo
    • Files and File contents
    • Sed Awk and Grep
    • Permissions
  • πŸͺŸWindows
    • Event Codes
    • Powershell
    • Internals
    • Active Directory
  • πŸ”ŽOSINT
    • OSINT Tools
    • IP/Domain OSINT
    • Email/Username OSINT
    • URL OSINT and Sandboxing
    • Social Media OSINT
    • Website OSINT
    • Password OSINT
    • Physical Location OSINT
    • Image OSINT
    • People OSINT
    • Phone Number OSINT
    • Shodan
    • Google Dorking
  • πŸ› οΈTools
    • Brute Force
      • Hydra
    • Credential Dumping
      • Mimikatz
    • Enumeration
      • Bloodhound
      • Certipy
      • Dirb/Dirbuster
      • Enum4Linux
      • GoBuster
    • Exploitation Framework
      • Metasploit
      • Sliver
      • Cobalt Strike
    • Hash Cracking
      • Hashcat
      • JohnTheRipper
    • Methods
      • Powershell Obfuscation
      • Privilege Escalation
      • Pass-The-Hash
      • Kerberos and Kerberoasting
    • Vulnerability Scanners
      • Nessus
      • OpenVAS
    • Web App
      • BurpSuite
      • OWASP Zap
    • Wireless
      • Aircrack-ng
      • Kismet
      • Bettercap
      • HCXDumptool
      • Wifite
    • Impacket
    • Social-Engineer Toolkit (SET)
  • πŸ“”Guides and How-To's
    • Lab Setup
      • Ubuntu VM
      • Kali VM
      • Windows User VM
      • Windows Server VM
    • Wardriving
      • Pwnagotchi
    • Wireless Pentesting
      • WiFi Pineapple Basics
      • Evil-Twin Attack
    • Over The Wire
      • Bandit
      • Natas
      • Leviathan
      • Krypton
      • Narnia
      • Behemoth
      • Utumno
      • Maze
      • Vortex
      • Manpage
    • Docker and Kali Linux
    • Staying Private and goin Dark Online
  • πŸ“•Quick References
    • Tools
      • Tmux
      • NMap
      • Ffuf
      • NetExec
      • CrackMapExec
      • Proxychains
      • OneDriveUser Enum
      • Hashcat
    • One-liners
    • Reverse Shells
    • Post Exploitation
    • Enumeration
      • Google
      • Sublist3r
      • NMap
      • DNSDumpster
    • Hashcracking
    • Wireless
  • πŸ““Courses
    • PNPT
      • Practical Ethical Hacking
      • Windows Privilege Escalation
      • Linux Privilege Escalation
      • OSINT Fundamentals
      • External Pentest Playbook
  • ☁️TryHackMe
    • Attacking Kerberos
    • Hacking with Powershell
    • Powershell for Pentesters
    • Linux PrivEsc
    • Windows PrivEsc
    • Blue
    • Kenobi
  • πŸ“¦HackTheBox
    • Starting Point
      • Tier 0
        • Meow
        • Fawn
        • Dancing
        • Redeemer
        • Explosion
        • Preignition
        • Mongod
        • Synced
      • Tier 1
        • Appointment
        • Sequel
        • Crocodile
        • Responder
        • Three
        • Ignition
        • Bike
        • Funnel
        • Pennyworth
        • Tactics
      • Tier 2
        • Archetype
        • Oopsie
        • Vaccine
        • Unified
        • Included
        • Markup
        • Base
    • Walkthroughs
      • Lame
      • Analytics
      • Manager
      • Codify
Powered by GitBook
On this page
  • Built in
  • Networking
  • Services
  • Installing/Updating/Upgrading
  • Debian/Ubuntu/Kali
  • Arch
  • Fedora
  • Alias
Edit on GitHub
  1. Linux

Common commands

Built in

Some of the most common and used linux commands are listed below. all of these commands and be followed by --help for more information and additional arguments.

  • ls - Lists files and folders in current or specified directory.

    • ls or ls Downloads or ls /usr/share/

  • cd - changes into specified directory.

    • cd Downloads or cd /usr/share

  • touch - Creates a file.

    • touch hello-world.txt

  • mkdir - Makes a folder.

    • mkdir HelloFolder

  • mv - Moves a file/folder, also used to rename a file/folder.

    • mv Hello.txt Documents/Hello.txt # moves the file Hello.txt into the Documents folder

    • mv Hello.txt Goodbye.txt # renames the Hello.txt file to Goodbye.txt

  • cp - Copies a file to a specified file/folder.

    • cp Hello.txt Documents/ # copies the Hello.txt file into the Documents folder

    • cp Hello.txt Hello.txt.bak # copies the Hello.txt file to a Hello.txt.bak file

  • cp -r - Copies a folder

    • cp -r MyFolder Documents/ # copies the MyFolder folder into Documents

  • locate - Searches for files/folders

    • locate Hello.txt

  • rm - Removes a file.

    • rm Hello.txt

  • rmdir - Removes a directory.

    • rmdir MyFolder

  • >- Redirects the output of a command to a file and overwrites the file if it already exists.

    • echo "Hello" > Hello.txt

  • >> - Appends output of a commend to the specified file

    • echo "Hello" >> Hello.txt

  • grep - Search file(s) for specified keyword(s). usually piped into another command.

    • cat hell-world.txt | grep dog

  • cat - Concatenate file(s) to standard output.

    • cat hello-world.txt

Networking

  • ifconfig - Interface config, shows interface options, such as IP address, name, MAC address, and more. This command is slowly being phased out for IP.

  • iwconfig - Similar to ifconfig but focuses on wireless interfaces.

  • ip - used to show or manipulate routing, devices, and tunnels. Similar to ifconfig but is much more powerful with more functions and facilities.

  • ssh - secure shell - remotely connect to another machine

    • ssh user@ip

  • route - Displays or manipulates the IP routing table.

  • arp - Displays the ARP cache.

Services

  • sudo service (service) start - Start the specified service

    • sudo service pcscd start

  • sudo service (service) stop - Stops the specified service

    • sudo service pcscd stop

  • sudo systemctl enable (service) - Enables the service to started on system boot.

    • sudo systemctl enable pcscd

  • sudo systemctl disable (service) - Disables the service to started on system boot.

    • sudo systemctl disable pcscd

Installing/Updating/Upgrading

There's various ways to install/update/upgrade system tools/applications depending which flavor of linux you're using.

Debian/Ubuntu/Kali

  • sudo apt update - Updates all current repositories

  • sudo apt upgrade - Upgrades(updates) installed software

  • sudo apt install (package) - Installs specified package

    • sudo apt install git

  • sudo apt remove (package) - Removes/Uninstalls specified package

    • sudo apt remove git

Arch

  • sudo pacman -S (package) - Installs specified package

    • sudo pacman -S git

  • sudo pacman -Syu - Then will be prompted to install updates

  • sudo pacman -R (package) - Uninstalls/removes specified package

    • sudo pacman -R git

Fedora

dnf can also be used instead of yum.

  • sudo yum upgrade - Upgrades installed packages

  • sudo yum install (package) - Installs specified package.

    • sudo yum install git

  • sudo yum remove (package) - Removes/Uninstalls specified package.

    • sudo yum remove git

Alias

Setting alias can be simple but can get more complicated. Aliases are basically shortcuts to other commands, but can also replace commands. These can go into 2 places, your shell(ZSH or bash usually but there are plenty others out there) or into an alias file(like .bash_alias)

Some examples are:

  • alias upd='sudo apt update && sudo apt upgrade -y' This will make it so when you type 'upd' it will run the command to update the repositories and upgrade the currently installed applications,\ automatically without asking if you want to continue.

  • alias ffs='sudo $(fc -l -n -1)' this one is for if you type a command that needs sudo permissions, will run the last command as sudo.

  • alias ..='cd ..' will go up one directory.

  • alias ...='cd ../..' will go up two directories.

Last updated 1 year ago

🐧