Skip to main content

Basics

hostname, ifconfig, ping, curl, wget

CommandDescription
hostnameDisplay the system's hostname
hostname -iDisplay the machine's IP address
sudo hostnamectl hostname newnameChange the hostname to "newname"
ifconfigDisplay network interface information
ifconfig eth0Display details for a specific network interface (e.g., eth0)
ifconfig -sDisplay a short list of interfaces with basic information
netstat -nrDisplay routing table information
netstat -naDisplay all active network connections
ping google.comPing Google's servers to check network connectivity
ping -c 4 8.8.8.8Send 4 ping requests to Google's DNS server (8.8.8.8)
ping -i 2 1.1.1.1Ping 1.1.1.1 with a 2-second interval between requests
ping -s 100 1.1.1.1Send larger packets of 100 bytes while pinging
curl https://example.comRetrieve the content of a website (example.com)
curl -o newfile.txt https://example.com/fileDownload a file and save it with a different name
curl -O https://example.com/file.zipDownload a file (e.g., file.zip) from a URL
curl -X POST -d "data" https://api.example.comSend POST data to an API endpoint
curl -I https://example.comFetch only the headers of a web page
wget https://example.com/file.txtDownload a file (e.g., file.txt) from a URL
wget -c https://example.com/largefile.zipResume a partially downloaded file
host domainDisplay the IP addresses of a domain