Bash: Networking Commands

less than 1 minute read


These commands have to do with networking in Linux distros.

Networking Commands

To check your IP address

ifconfig -a

To test connections to another network node

ping (ip)

To see a path a packet takes to its destination


To query a DNS server

dig -a

To connect to a SSH server

ssh (username@hostname) [command]

To download from any site


To check open ports on a remote server without telnet (Used often!):

# this will check if port 22 is open on
curl -v telnet://

To transfer files between linux boxes or Windows running WSL and a linux box (Used often!):

# transfer foo.txt from current directory to remote /root/ location
scp foo.txt  root@remotehost:/root/

# transfer foo.txt from Windows c:\scripts to remote /root/ location
scp /mnt/c/scripts/foo.txt  root@remotehost:/root/foo.txt

# this also works in reverse! Transfer files from remote location locally
scp root@remotehost:/root/foo.txt /mnt/c/scripts

To view a list of ports that are listening

netstat -a

# Checks to see if ssh is running
netstat -antp | grep sshd