Today I will introduce you to some basic network and file transfer commands in Linux.
Basic Network Commands in Linux
The ‘ping’ command stands for Packet Internet Groper. It is used to test the network connection between two computers and see if the server is reachable.
How does the ping command work? Well, the ‘ping’ command uses something called ICMP, which stands for Internet Control Message Protocol. It will send an ICMP echo request message to the IP address you provided. If the connection is successful, it will respond with an ICMP message. You will know the server is reachable if you get an ICMP response.
dig . command
The ‘dig’ command can be used to view the DNS information of a website. It stands for “Domain Information Groper”. Besides the server name, you can also view information about the address of the server that hosts and exchanges mail. Although this command can be used by anyone, it is mainly used by System Administrators.
The ‘whois’ command is another basic command used to look up information. In this case, using whois will give you detailed information about the domain, such as owner information.
The command hostname
As the command name says, this command tells you hostname.
Command ip a
The ‘ip a’ command is used to find your IP address. Knowing what your IP address is, of course, is important. You can read this article to know what hackers can do if they know your ip address.
You can also use the IP command to view certain things. For example ‘ip link’, this command will display the information of the link class.
The ‘finger’ command shows you the details of all logged in users. This is a great command for sysadmins as they can see things like exact login times and even user emails. To use this command, you may need to install it with the command ‘sudo apt-get install finger’.
command netstat -a
Another useful command is ‘netstat’. In this case, I’m using ‘netstat -a’ to list all the ports that are listening.
A listening port is when your machine is ready to accept connections on that port. You can close and open the gates at any time.
The ‘traceroute’ command shows the route that a packet took to the server. If you look at the image below you can see how many ‘hops’ it took to get to the server you wanted. A hop occurs when a packet is passed from one network hardware to the next.
Basic File Transfer Commands in Linux
These are the most basic commands for beginners. In addition, there are many more commands that you can learn more about.
ftp . command
‘ftp’ stands for ‘file transfer protocol’. You can use this command, but this is an insecure way to transfer files because when you enter your username and password, it travels over the network as plain text.
sftp . command
‘sftp’ stands for ‘secure file transfer protocol’. Here’s how to safely transfer files. Using stfp will provide a higher level of protection.
‘scp’ copies files safely.
This order is considered obsolete by some people and companies. It still works, but using it or not is up to you.
‘rsync’ is used to synchronize files and folders between two machines via a remote shell.
‘ssh’ is used to securely login to the remote server. You can ‘ssh’ into a remote system using SSH keys or password authentication.
This isn’t technically a file transfer command, but I believe it’s important when it comes to transferring files. Alternatively, you can also learn more about ssh here.