Skip to main content

Linux commands - Network related

 Linux commands - Network related

This write up is a collection of some of the most commonly used linux commands used in the network related work. This is a short note and not a complete reference.

1. ifconfig / ip 

This command is used to find the network IP related information of the server.
'ip' is the latest update or the current command to be used on the latest version of the OS.

2. ping destination_host 

This is used to ping the destination server. Bacially, it will simply check the connection to the target.
You can interrupt the command with 'ctrl+c'.

3. telnet host port 

This command is used to connect to a specific port on the destination server.
This works better than the ping command as this will attemp to connect to the specified port. You can interrupt the command with 'ctrl+c'.

In some cases, when 'crtl+c' is not closing the telnet session, please use 'ctrl+]' and then enter 'close'.

4. nslookup google.com 

This is the short for Name server lookup.
This command can be used to check the DNS functionality of the network. This command will return you the details of the DNS server it is connecting to and the IP to which the queried domain name is resolved to.
To interpret the command result, the top 2 lines are normally for the DNS server and the below lines will tell you about the IP details of the queried host.

nslookup can also be used to do a reverse DNS lookup by querying the IP address.

5. host 

This is used to find the domain name given to any IP or the IP of a known domain name.
host 123.3.4.5
host mysubdomain.xyz.com

6. hostname 

This is used to find the hostname assigned to the current machine. You can use this command to set the hostname by passing the new name as an argument(sudo needed).

7. traceroute <destination> 

This is used to trace the network nodes through which the traffic flows on the way to the target. This will help identify where the latency is added the most in the network connection.

8. tcpdump 

This is used to collect the data and command packets sent through the  network interface. This collectes immence amount of data. So make sure you have enough storage to save the logs and you dont run this for a long time.

9. curl  

This is used to get the response from a web address.
you can use it to test the APIs. etc
The below option will save the response to a text file.
curl http://domain.com/test/ > /opt/mysoft/file2save.txt
To download files using curl
curl -o http://domain.com/test/file.txt
To set http methods and pass on http header parameters, use the options below. 
curl -X PUT -d header_param_1=value1 -d header_param_2=value2 http://domain.com/test/

10. wget 

This is used to download files from the destination.
wget http://domain.com/test/file.txt -O newTargetfile.txt


Comments

Popular posts from this blog

Public private key based login to Unix computer

Public private key based login to Unix computer We know that we can login to a Unix system in several ways. One drawback with username password mode is that there will be requirement to update the password frequently. In such cases, we go for the public key based login.  Required software 1. Putty and puttygen Putty can be downloaded from the download page of  https://www.putty.org/ The downloaded zip contains both putty and puttygen. 2. Winscp This is an optional software which gives a window when dealing with ssh, ftp, sftp connections. This can be downloaded from their official site. https://winscp.net/eng/download.php How it works In the public key based login, we will generate a public key and corresponding private key pair. We can optionally protect the private key using a password so that if someone gets your private key, they wont be able to put it into real use [The secret would be needed for loading your private key to the ssh client]. Process Create the publ...

Java Keystore - Certificate management

 Java Keystore - Certificate Management Dealing with the Java keystore is not new for the software developers working with Java. But many a times, developers who work with several other technology stack come across the necessity of dealing with java keystoe(jks). A simple, easy way to deal with it is given below. The software The software I am working with is KeyStore Explorer.  This software can be used on Windows, Linux and MacOS. Installable can be downloaded separately. If you are fan of portable apps, you can download the zip version that will work with all the operating systems. This software can be downloaded from the link below  https://keystore-explorer.org/downloads.html Setup Install as per your operating system. For portable version, simply unzip to the desired folder. The Keystore explorer needs a JRE to run. If your laptop has a pre-installed JRE, please make sure the JAVA_HOME environment variable is set. If you already have a portable JRE, you can copy ...

CR-2032 Batteries- Where are they used

 Batteries, CR2032. What is CR2032 (also written CR-2032)? CR2032 is a non rechargeable 3V lithium battery which is used in many electronic devices. It resembles a coin and hence it is also called a coin cell or coin battery.  A Panasonic CR2032 cell What are it's main applications and lifetime in each cases? 1. Car keyfobs . (Lifetime - Normally works for several years, 3-8 years) 2. Apple Airtag. (Lifetime - 1 to 1.5 years) 3. Temperature and humidity sensors. (Around 1-2 years) 4. Toys.(Will run out very soon 😜) 5. Smart home sensors. 6. Calculators. 7. Remote controls for garages etc.