This tutorial is a continuation of Basic Linux Network Commands, despite the fact that it starts with easy commands for DNS lookup, all the network commands expressed here are essential in diagnosing problems that might be encountered in the Linux experience.The nslookup and host commands to query DNS recordsThe nslookup is a network administration command-line tool available in many computers operating systems for querying the Domain Name System (DNS) to obtain domain name or IP address mapping, or other DNS records.In the following example, the command nslookup is used to resolve the IP address of putorius.netnslookup putorius.netmcherisi@putorius:/$ nslookup putorius.netServer: 8.8.8.8Address: 8.8.8.8#53Non-authoritative answer:Name: putorius.netAddress: 64.91.238.144mcherisi@putorius.net:/$The following example shows the mx records for putorius.net by applying the option -type=mx.nslookup -type=mx putorius.netmcherisi@putorius:/$ nslookup -type=mx putorius.netServer: 8.8.8.8Address: 8.8.8.8#53Non-authoritative answer:putorius.net mail exchanger = 5 ALT2.ASPMX.L.GOOGLE.com.putorius.net mail exchanger = 5 ALT1.ASPMX.L.GOOGLE.com.putorius.net mail exchanger = 1 ASPMX.L.GOOGLE.com.putorius.net mail exchanger = 10 ALT4.ASPMX.L.GOOGLE.com.putorius.net mail exchanger = 10 ALT3.ASPMX.L.GOOGLE.com.Authoritative answers can be found from:mcherisi@putorius.net:/$Alternatively, you could use the command host to get both lookup resolution and mx records:host putorius.netmcherisi@putorius:/$ host putorius.netputorius.net has address 64.91.238.144putorius.net is handled by 10 ALT3.ASPMX.L.GOOGLE.com.putorius.net is handled by 5 ALT1.ASPMX.L.GOOGLE.com.putorius.net is handled by 10 ALT4.ASPMX.L.GOOGLE.com.putorius.net is handled by 1 ASPMX.L.GOOGLE.com.putorius.net is handled by 5 ALT2.ASPMX.L.GOOGLE.com.mcherisi@putorius:/$The dig command to query DNS recordsThe dig command is an acronym for (Domain Information Groper). It is a utility that allows you to query DNS servers for information. This information is really advantageous when troubleshooting. Below we will show you basic usage and how to understand the output. For a deeper dive, you can read our Using Dig for DNS Troubleshooting article.dig putorius.netmcherisi@putorius:/$ dig putorius.net; DIG 9.11.5-P4-5.1-Debian putorius.net;; global options: +cmd;; Got answer:;; ->>HEADERHEADERHEADER putoriusOn the sending computer execute:nc 192.168.0.14 22 < putoriousmcherisi@putorius:/home/putorius$ nc 192.168.0.14 22 < putoriousSSH-2.0-OpenSSH_7.9p1 Debian-10mcherisi@putorius.net:/$The file is checked by running “ls“mcherisi@putorius:/ncfile$ lsputoriusmcherisi@putorius.net:/$The following example shows how nc is used to scan the range port 22-80 on putorius.netnc -z -v putorius.net 22-80mcherisi@putorius:/$ nc -z -v putorius.net 22-80putorius.net [64.91.238.144] 80 (http) openputorius.net [64.91.238.144] 25 (smtp) openputorius.net [64.91.238.144] 22 (ssh) openmcherisi@putorius.net:/$The rsync command to clone and files directories between devicesThe rsync command is a great tool to clone files and directories from a device to another, it can be useful to keep real-time synchronization between devices, you can keep updated back up, create a script for Continuous Data Protection and more. The following 2 examples show how to synchronize files and directories from and to a server.The syntax to copy a file from a server to a directory is:rsync @:In the following example, the file named putorius is copied to the current or working directory (.)rsync putorius@192.168.0.3:/home/putorius/putoriusmcherisi@putorius22:/rsync$ rsync putorius@192.168.0.3:/home/putorius/putoriusputorius@192.168.0.3's password:mcherisi@putorius.net:/rsync$The file transference is checked by running ls on the working directorymcherisi@putorius:/rsync$ rsync putorius@192.168.0.3:/home/putorius/putoriusputorius@192.168.0.3's password:mcherisi@putorius:/rsync$ lsputoriusmcherisi@putorius:/rsync$The following example shows how to clone a local directory to a remote server, the syntax is:rsync -avz @:In this practical example, a directory named rsync is cloned to the Desktop directory of the putorius user at the remote server.rsync -avz rsync/ putorius@192.168.0.3:/home/putorius/Desktopmcherisi@putorius:/$ rsync -avz rsync/ putorius@192.168.0.3:/home/putorius/Desktopputorius@192.168.0.3's password:sending incremental file list./putoriussent 109 bytes received 41 bytes 40.57 bytes/sectotal size is 0 speedup is 0.00Where:a = archive z = compress v = verbosityThese are just some advanced network tools for Linux. If you want to learn more about these commands or any other network tools please let us know in the comments.The post Advanced Linux Network Commands for Linux Beginners appeared first on Putorius.