Useful Linux commands

Linux commands – relates to Debian where applicable


ping [ip] – check if a service or device is up

ifconfig – check current network information such as IP address

hostname – show your hostname

traceroute – trace the path a packet takes to its destination

netstat – active internet connections & domain sockets (displays protocol, port, )

netstat -r – display routing table information

lsof -i – find open ports or for finding which process is using a port (list open files)

lsof -i tcp – list all the opened TCP ports

lsof -i :[port number] – find which process is using a specific port, you can provide the port number

/etc/NetworkManager/system-connections – find out stored network connections, then type

ls – to list the files, then

sudo cat ‘SSID – to reveal the password (place the SSID inside single quotes as shown)

Package managers

sudo apt-get update && sudo apt-get upgrade -y – single command to update your repository 

apt-get install [package name] – install a package from repository

dpkg -i [package.deb] – Install from file

apt remove or apt-get remove [package name] – remove/uninstall

apt search [package name you think] – search the correct name of the package required

apt show [package name] – View existing package info

apt-get update – Update existing package repository

apt-get upgrade – upgrade packages after the above command has been executed