The ping command is one that exists on all operating systems that support TCP/IP, it is based on the ICMP protocol and used for detecting devices on a network and for troubleshooting network problems.
Ping sends ICMP (Internet Control Message Protocol) Echo Request packets to a target host and waits for Echo Reply packets.
ping www.google.com
ping www.google.com
ping 216.58.208.68
ping 127.0.0.1
ping 127.0.0.1
If the test is successful, it indicates that the installation of the network card, TCP/IP protocol, IP address, and subnet mask settings are normal. If the test is unsuccessful, it indicates that there is a problem with the installation or setup of TCP/IP.
Ping local IP address
If the test is unsuccessful, it indicates that there is a problem with the local configuration or installation, and network devices and communication media should be tested, checked, and eliminated.
Ping other IPs within the local area network
If the test is successful, it indicates that the network card and carrier in the local network are running correctly. But if 0 echo responses are received, it indicates that the subnet mask is incorrect, the network card configuration is incorrect, or there is a problem with the cable system
Ping gateway IP
If this command responds correctly, it indicates that the gateway router in the local area network is running and able to respond
Ping remote IP
If a correct response is received, it indicates that the default gateway has been successfully used. For dial-up internet users, it means they can successfully access the Internet.
If all the ping commands listed above can run normally, then there is basically no problem for the computer to communicate locally and remotely
1.1 Continuously execute ping commands until interrupted by the user using Ctrl+C
ping IP -t
1.2 Execute a specific number of times (here 20)
ping IP -n
1.3 Specify a specific data length (2000 bytes) instead of the default 32 bytes
ping IP -l 2000
2 ipconfig(ifconfig on Linux), hostname, getmac, whoami, whois(need install)
2 ipconfig(ifconfig on Linux), hostname, getmac, whoami, whois(need install)
2.1 ipconfig is used to finding network information about your local machine like IP addresses, DNS addresses etc.
2.1.1 Display Detailed Information
ipconfig /all
2.1.2 Release/Renew IP Address from the DHCP server
ipconfig /release
ipconfig /displaydns
2.1.3 Display DNS Resolver Cache
ipconfig /displaydns
2.1.4 clear the DNS resolver cache
ipconfig /flushdns
2.1.5 refresh DHCP and re-register DNS names
ipconfig /registerdns
2.2 hostname displays the host name of your machine.
2.2.1 Display the Current Hostname
hostname
2.2.2 Change the Hostname (requires admin rights)
hostname NewComputerName
2.3 getmac shows the MAC address of your network interfaces
2.3.1 Display MAC Addresses with Additional Information
getmac /v
2.3.2 Display the output in a specific format (e.g., table, list, or CSV)
getmac /fo table
2.4 whoami
A simple yet useful command-line utility in Windows and Unix-like operating systems that displays the username of the currently logged-in user
2.4.1 Display Current User Name
whoami
2.4.2 Display User Information
whoami /user
2.4.3 Display User Groups
whoami /groups
2.5 whois network command is used to query data domains
3 tracert, pathping, route
3 tracert, pathping, route
3.1 tracert is to know the travelling path of a package through our network.
It sends a series of ICMP Echo Request packets, incrementing the TTL (Time-to-Live) value with each set of packets.
Each router along the path decrements the TTL value by 1. When TTL reaches 0, the router returns an ICMP "Time Exceeded" message to the sender.
The tool then displays the address of each hop and the round-trip time to that hop.
raceroute –n (on Unix / Linux)
tracert google.com (on Windows)
tracert google.com (on Windows)
3.2 pathping is a tool that combines the functionality of both ping and tracert. It provides detailed information about network performance, combining the route tracing feature of tracert with the packet loss and latency measurements of ping.
pathping google.com
3.3 route is to display or modify the IP routing table on a computer. The routing table is used by the operating system to determine how data packets should be forwarded to their destination through various networks.
3.3.1 display the routing table
route print 10.* (Display IP routing table with 10 Starting route)
route print (on Windows)
route -n (on Linux or macOS)
3.3.2 Add a Route
route add destination_network mask subnet_mask gateway (on Windows)
Add a permanent route with target 10.41.0.0, subnet mask 255.255.0.0, and next hop address 10.27.0.1
route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1
To add a route with a target of 10.41.0.0, subnet mask of 255.255.0.0, next hop address of 10.27.0.1, and hop count of 7
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7
Add a route with a target of 10.41.0.0, subnet mask of 255.255.0.0, next hop address of 10.27.0.1, and interface index of 0x3
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3
sudo route add -net destination_network netmask subnet_mask gateway (on Linux or macOS)
sudo route add -net 192.168.2.0 netmask 255.255.255.0 192.168.1.1
3.3.3 Delete a Route
route delete 10.*(Delete 10 from the IP routing table All routes started)
route delete 192.168.2.0 (on Windows)
sudo route delete 192.168.2.0 (on Linux or macOS)
3.3.4 Change a Route
To change the next hop address of the route with target 10.41.0.0 and subnet mask 255.255.0.0 from 10.27.0.1 to 10.27.0.25
route change 10.41.0.0 mask 255.255.0.0 10.27.0.25 (on Windows)
sudo route change -net 10.41.0.0/16 10.27.0.25 (on Linux or macOS)
3.3.5 Default Route (Gateway)
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1 (on Windows)
sudo route add default 192.168.1.1 (on Linux or macOS)
4 arp
The arp command is a network utility used to display and manipulate the ARP (Address Resolution Protocol) cache on a computer. ARP is a protocol used for mapping an IP address to a MAC (Media Access Control) address in a local network. The ARP cache stores these mappings, which helps the computer efficiently find the MAC addresses of devices on the local network.
4.1 Display the ARP table
arp -a
4.2. Add a Static ARP Entry
arp -s <IP address> <MAC address> (on Windows)
sudo arp -s <IP address> <MAC address> (on Linux or macOS)
add a static ARP entry for IP 192.168.1.10 with MAC address 00-1A-2B-3C-4D-5E
arp -s 192.168.1.10 00-1A-2B-3C-4D-5E
sudo arp -s 192.168.1.10 00:1A:2B:3C:4D:5E
4.3 Delete an ARP Entry
arp -d <IP address> (on Windows)
arp -d 192.168.1.10
sudo arp -d <IP address> (on Linux or macOS)
sudo arp -d 192.168.1.10
4.4 Clear the ARP Cache
arp -d (on Windows)
sudo ip -s -s neigh flush all (on Linux or macOS)
4.5 View Specific ARP Entry
arp -a 192.168.1.10
5 netstat
The netstat command is a network utility used to display network connections, routing tables, interface statistics, and other related information about the networking subsystem in a computer. It's commonly used for diagnosing network issues, monitoring network activity, and checking the status of network interfaces and connections.
The netstat command is a network utility used to display network connections, routing tables, interface statistics, and other related information about the networking subsystem in a computer. It's commonly used for diagnosing network issues, monitoring network activity, and checking the status of network interfaces and connections.
display a detailed list of network connections, including the associated process IDs (PIDs), in a numerical format.
netstat -aon
6 net
Used for managing users(net user), service(net start & net stop), shares(net view & net use) etc.
6 net
Used for managing users(net user), service(net start & net stop), shares(net view & net use) etc.
6.1 net use
Connects, disconnects, or displays network connections.
6.1.1 list all network connections
net use
6.1.2 maps a network share to the Z: drive
net use Z: \\ComputerName\SharedFolder
6.1.3 Connect with Credentials
net use Z: \\ServerName\SharedFolder /user:Domain\UserName Password
6.1.4 disconnect a mapped drive
net use Z: /delete
6.1.5 Disconnect All Connections
net use * /delete
6.1.6 persistent connection that remains after a reboot
net use Z: \\ServerName\SharedFolder /persistent:yes
6.1.7 Remove a Persistent Connection
net use Z: /delete /persistent
6.2 net user
Adds, modifies, or deletes user accounts.
6.2.1 Display User Accounts
net user
6.2.2 Show User Account Details
net user Administrator
6.2.3 Create a New User
net user JohnDoe MyPassword123 /add
6.2.4 Delete a User
net user JohnDoe /delete
6.2.5 Change a User's Password
net user JohnDoe NewPassword456
6.2.6 Set User Account Properties
net user <Username> /expires:<mm/dd/yyyy>
6.2.7 Enable or Disable a User Account
net user JohnDoe /active:no
net user JohnDoe /active:yes
6.2.8 Set a User as an Administrator (in local accounts)
net localgroup Administrators <Username> /add
6.3 net share
Creates, deletes, or displays shared resources
6.3.1 Display All Shares
net share
6.3.2 Create a New Share
net share ShareName=C:\Path\To\Folder
6.3.3 Delete a Share
net share ShareName /delete
6.3.4 Grant Permissions
net share MyShare=C:\SharedFolder /grant:UserName,read
6.3.5 Set a Remark
net share ShareName=C:\Path\To\Folder /remark:"This is my shared folder"
6.3.6 Set User Limit
net share ShareName=C:\Path\To\Folder /users:5
6.4 net view
view shared resources on a network. It can be used to list shared folders, printers, and other networked devices.
6.4.1 View All Shares on Local Computer
net view
6.4.2 View Shares on a Specific Computer
net view \\192.168.1.10
6.4.3 View Shares with Cache Option
net view /cache
6.5 net localgroup
manage local groups on a computer.
6.5.1 Display All Local Groups
net localgroup
6.5.2 Show Members of a Group
net localgroup Administrators
6.5.3 Create a New Local Group
net localgroup MyGroup /add
6.5.4 Delete a Local Group
net localgroup MyGroup /delete
6.5.5 Add a User to a Group
net localgroup MyGroup UserName /add
6.5.6 Remove a User from a Group
net localgroup MyGroup UserName /delete
6.6 net config
displays network configuration settings for the computer. It is primarily used to view and configure settings related to network services.
6.6.1 View Server/Workstation Configuration
net config server
net config workstation
6.7 net start / net stop
manage services on a computer
6.7.1 List Running Services
net start
6.7.2 Start a Service
net start W32Time
6.7.3 Stop a Service
net stop W32Time
7 nbtstat
Diagnostic tool for troubleshooting netBIOS problems.
8 nslookup
query the Domain Name System (DNS) to obtain domain name or IP address mapping. It is mainly used for troubleshooting DNS-related issues.
8.1 DNS lookup for a domain
Diagnostic tool for troubleshooting netBIOS problems.
7.1 Display Local NetBIOS Names
nbtstat -n
7.2 Display Remote NetBIOS Name Table
nbtstat -A <IPAddress>
nbtstat -a <ComputerName>
7.3 Display Current Connections
nbtstat -s
7.4 Clear the NetBIOS Name Cache
nbtstat -R
7.5 Display NetBIOS Name Cache
nbtstat -c
8 nslookup
query the Domain Name System (DNS) to obtain domain name or IP address mapping. It is mainly used for troubleshooting DNS-related issues.
8.1 DNS lookup for a domain
nslookup baidu.com
9.1 List All Running Tasks
8.2 DNS lookup for specific DNS server
nslookup example.com 8.8.8.8
8.3 DNS Reverse Lookup to find the domain name associated with an IP address
nslookup 192.0.2.1
8.4 retrieve all DNS records for a domain
nslookup -type=ANY baidu.com
9 tasklist
list the tasks (or processes) currently running on a Windows computer9.1 List All Running Tasks
tasklist
9.2 Display Services
tasklist /svc
9.3 Display Memory Usage
tasklist /fo table /nh
9.4 Filter by Image Name
tasklist /fi "imagename eq notepad.exe"
9.5 Export the List to a File
tasklist > C:\path\to\output.txt
10 taskkill
View a list of running tasks using the tasklist command and kill them by name or processor ID10.1 forcefully terminate a process
taskkill /f /im <ImageName>
taskkill /f /pid <ProcessID>
10.3 Terminate a Process on a Remote Computer
10.2 Terminate a Process and All Child Processes
taskkill /pid 1234 /t
10.3 Terminate a Process on a Remote Computer
taskkill /s <ComputerName> /u <Username> /p <Password> /im <ImageName>
11 schtasks (at)
create, delete, configure, or display scheduled tasks. It provides more features and flexibility compared to the older at command, which is also used for scheduling tasks but is less commonly used in modern Windows versions.11.1 Create a Daily Task
schtasks /create /tn "DailyBackup" /tr "C:\Backup\backup.exe" /sc daily /st 02:00
14 curl
11.2 Delete a Task
schtasks /delete /tn "DailyBackup"
11.3 Run a Task Immediately
schtasks /run /tn "DailyBackup"
11.4 Stop a Task Immediately
schtasks /stop /tn "DailyBackup"
11.5 List All Scheduled Tasks
schtasks /query /fo table
12 netsh (Network Shell)
view, configure, and troubleshoot the network settings of your system. It is often used by network administrators for advanced network configuration tasks.
12.1 View Network Configuration
12.1.1 Display IP Configuration
netsh interface ip show config
12.1.2 Display Network Interfaces
netsh interface show interface
12.2 Configure IP Settings
12.2.1 Set Static IP Address
sets a static IP address (192.168.1.100), subnet mask (255.255.255.0), and default gateway (192.168.1.1) on the "Ethernet" interface
netsh interface ip set address name="Ethernet" static 192.168.1.100 255.255.255.0 192.168.1.1
12.2.2 Set Dynamic IP (DHCP)
Configures the interface to obtain an IP address dynamically via DHCP
netsh interface ip set address name="Ethernet" source=dhcp
12.3 Enable/Disable Network Interface
netsh interface set interface "Ethernet" admin=disable
netsh interface set interface "Ethernet" admin=enable
12.4 Configure Wireless Settings
12.4.1 Show Wireless Network Profiles
netsh wlan show profiles
12.4.2 Connect to a Wireless Network
netsh wlan connect name="WiFiNetworkName"
12.4.3 Show Wireless Network Information
netsh wlan show interfaces
12.5 Firewall Configuration
12.5.1 View Firewall Status
netsh advfirewall show allprofiles
12.5.2 Enable/Disable Firewall
netsh advfirewall set allprofiles state on
netsh advfirewall set allprofiles state off
12.6 Network Diagnostics
12.6.1 Reset TCP/IP Stack
Resets the TCP/IP stack to its default settings. This is often used to resolve network connectivity issues
netsh int ip reset
12.6.2 Release and Renew IP Address (DHCP)
This releases the current IP address and obtains a new one from the DHCP server
netsh interface ip set address "Ethernet"
dhcp netsh interface ip set dns "Ethernet" dhcp
12.7 Proxy Settings
12.7.1 Configure Proxy
sets a proxy server for HTTP traffic and specifies exceptions for certain domains
netsh winhttp set proxy proxy-server="http=proxy.example.com:8080" bypass-list="*.example.com"
12.7.2 Reset Proxy
Resets the proxy settings to default.
netsh winhttp reset proxy
12.8 Routing and Remote Access Configuration
12.8.1 Enable Routing
Enables IP routing on the system, allowing the computer to function as a router
netsh routing ip enable
12.8.2 Enable Remote Access
Adds a remote access router with the specified name
netsh ras add router name=Router1
12.9 View and Configure VPN Settings
12.9.1 Adds a VPN connection named "MyVPN" with the specified server address
netsh ras add vpn entryname="MyVPN" serveraddress="vpn.example.com"
12.10 Miscellaneous Commands
12.10.1 Show Network Statistics
Displays IPv4 statistics for network interfaces, such as the number of bytes sent/received
netsh interface ipv4 show subinterfaces
12.10.2 Reset Network Settings
Resets the Winsock catalog, which can fix networking issues related to corruption in the Winsock settings.
netsh winsock reset
13 msg
send messages to other users on the same network or to specific sessions
13.1 Send a Message to a User
msg John "Hello, this is a test message!"
13.2 Send a Message to all Users
msg * "This is a message to all users."
13.3 Send a Message to a Specific Session
msg /session:1 "This is a message to session 1."
transferring data to and from a server using various protocols, including HTTP, HTTPS, FTP, and more. It is widely used for testing APIs, downloading files, and interacting with web services.
14.1 fetch the content of a URL
curl https://www.baidu.com
14.2 Save Output to a File
curl -o filename.html http://example.com
14.3 Follow Redirects
curl -L http://example.com
14.4 send data using a POST request
curl -X POST -d "param1=value1¶m2=value2" http://example.com/api
14.5 send JSON data in a POST request
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' http://example.com/api
14.6 Include HTTP Headers in Output
curl -i http://example.com
14.7 add custom headers to a request
curl -H "Authorization: Bearer token" http://example.com/api
14.8 download a file from a URL
curl -O http://example.com/file.zip
14.9 Use Basic Authentication
curl -u username:password http://example.com
14.10 Verbose Output
curl -v http://example.com
15 wget
downloading files from the web. It supports various protocols, including HTTP, HTTPS, and FTP. wget is particularly useful for downloading large files or entire websites, and it can run in the background, allowing for easy automation
downloading files from the web. It supports various protocols, including HTTP, HTTPS, and FTP. wget is particularly useful for downloading large files or entire websites, and it can run in the background, allowing for easy automation
15.1 Download a File
wget http://example.com/file.zip
15.2 Download in the Background
wget -b http://example.com/file.zip
15.3 Continue an Incomplete Download
wget -c http://example.com/file.zip
15.4 Download a Whole Website
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent http://example.com
15.5 Limit Download Speed
wget --limit-rate=200k http://example.com/file.zip
15.6 Download with a Different User-Agent
wget --user-agent="Mozilla/5.0" http://example.com
15.7 Download Files in a Recursive Fashion
wget -r http://example.com/directory/
15.8 Save Files with a Specific Name
wget -O newfilename.zip http://example.com/file.zip
15.9 Download with Authentication
wget --user=username --password=password http://example.com/protectedfile.zip
16 ssh
a protocol used to securely connect to a remote server or computer over a network. It provides a secure channel for communication and is commonly used for remote administration of servers, file transfers, and executing commands on remote machines.
16.1 Connect to a Remote Server
ssh user@192.168.1.1
16.2 connect using a specific port (default is 22)
ssh -p 2222 user@hostname
16.3 Execute a Command on the Remote Server
ssh user@hostname 'command'
16.4 Use SSH Key Authentication
ssh -i /path/to/private_key user@hostname
16.5 Enable Verbose Mode
ssh -v user@hostname
16.6 forward a local port to a remote server
ssh -L local_port:remote_host:remote_port user@hostname
16.7 Copy Files Using SCP
16.7.1 Copying a Local File to a Remote Server
scp myfile.txt user@192.168.1.10/home/user/
16.7.2 Copying a Remote File to a Local Machine
scp user@192.168.1.10/home/user/myfile.txt /home/localuser/
16.7.3 Copying a Directory Recursively (With -r Option)
scp -r /home/user/mydir user@192.168.1.10:/home/remoteuser/
16.7.4 Copying Between Two Remote Hosts
scp user1@192.168.1.10/home/user1/myfile.txt user2@192.168.1.20:/home/user2/
16.7.5 Using a Specific Port (With -P Option)
scp -P 2222 myfile.txt user@192.168.1.10/home/user/
16.7.6 Using -C Option for Compression
scp -C largefile.tar.gz user@192.168.1.10/home/user/