Linux Commands

This operating system is essential if you want to learn cybersecurity.

Among the preferred distributions for hacking, two stand out above the rest.

  1. Kali Linux
  2. Parrot OS

Now let’s look at the main commands used in Linux.

SUDO

This is the quintessential command in Linux to execute commands as an administrator.

sudo [command]

Packages

Linux uses packages which would be the equivalent of applications / programs in Windows. When we want to install a program we have to install it using its package name.

  • To install packages
sudo apt install [package]
  • To remove the package
sudo apt remove [package]
  • To remove residual files
sudo apt autoremove [package]

Files

It is VERY IMPORTANT to learn how to deal with files and directories (folders) in Linux.

  • To create a file
touch [file]
  • To write text directly to a file
echo 'Write text' > [file] ```bash touch [file]
  • To delete a file
sudo rm [file]
  • To delete a directory and the files inside it
sudo rm -r [directory]
  • To locate a file *gets the directory where it is located
locate [file]

Ports

The most important and most used are:

PortServiceDescription
21FTPUpload files to the computer
22SSHRemote access via another computer
80HTTPWeb Service (NOT secure)
443HTTPSWeb Service (MOST secure)

| SSH

ssh -22 user@telefonica.com
ssh user@192.168.0.0

Networking

  • Displays a list of all active network connections and the ports and ports that are connected to the network.
netstat -tuln
  • Displays the computers connected to the network
ifconfig

KALI

Screenshot in Kali Linux

  • Ctrl + ImprPant *whole

  • Shift + Ctrl + ImprPant *part

nmap

Recognition of open ports. Dumps to the file

sudo nmap -p- -sVC -sC --open -sS -vvv -n -Pn [IP] -oN scan.txt

Text editors

Among some of the prominent ones are VIM and Nano

VIM

Text editor for Linux

Command to open a file

vi test.txt

Commands

  • Insert: “I **Move:** **I Move: **I` Move: **Move

  • Move: **Left

    • Left H

    • Down J

    • Up L

    • Right K

  • Delete line:** press D twice

  • Save:** :w Save: :w

  • Save and exit:** :wq Save and exit: :wq

  • Save and rename: :w name.txt Exit and NO Save: :w name.txt Exit and NO Save: `:w name.txt

  • Exit and NOT Save:** :q!

Connect with me

Feel free to reach out to me for any inquiries or just to say hi!