Linux std directory structure
77 selected linux command summaries
Linux alias command

Linux users often need to use one command over and over again. Typing or copying the same command again and again reduces your productivity and distracts you from what you are actually doing. You can save yourself some time by creating aliases for your most used commands. Aliases are like custom shortcuts used to represent a command (or set of commands) executed with or without custom options. Chances are you are already using aliases on your Linux system.

Linux Productivity Tools (pdf)

Linux Networking Commands

(Labnol.org)
What is my IP address?
curl https://checkip.amazonaws.com

Make a curl or wget request to the checkip.amazonaws.com and it prints the public IP address of your computer. You can also connect to Akamai’s whatismyip.akamai.com domain get your external IP address.

What is my Private IP address?
ifconfig en0 | grep inet

Your computer has a private IP address that only work within the local network. For older Macs with a wired Ethernet port, use en0 for Ethernet interface or en1 for the WiFi interface.

Print a list all network interfaces available on your machine.
networksetup -listnetworkserviceorder
Find the Location of IP address
curl https://ip2c.org/?ip=8.8.8.8

The free ‘ip2c’ service resolves an IP address to the country. Or, use ipapi to get more details of an IP address including the city name, timezone and even the latitude and longitude associated with an IP address.

curl https://ipapi.co/8.8.8.8/json
DNS Records: Find the IP address of a website
dig +short www.labnol.org
DNS Records: Find the Mail Server of Domain
host -t MX labnol.org

The Mail Exchange (MX) records specify the incoming mail servers that used for delivering email messages sent to your domain name.

Print all DNS Records of a Domain
dig +nocmd amazon.com any +noall +answer

Get a list of all DNS records of a domain including TXT records, MX records and name servers. The name servers handle queries regarding the location of the domain’s website, email and other services.

Who is hosting a website?
dig +short netflix.com A | tail -1

Use dig to find the IP address of a website. Use the dig command to perform a reverse lookup to find the host of that IP address.

Find the owner of the website
whois dictation.io

Use whois to reveal information about any web domain including the date when it was first registered, the contact details of the owner, the expiration date of the domain, the name of the domain registrar and so on.

dig +nocmd -x 52.11.104.17 +noall +answer

Use that IP address in the next command to get the hostname.

Test Network Connectivity
ping -c 5 -i 2 labnol.org

The ping command helps you test if a remote host is reachable and whether your machine can connect to it properly. The above command pings the host 5 time and there’s a 2 second wait between pings.

Where’s the fault?
traceroute labnol.org

If your Internet connection is working but you are unable to reach a website, there could be an issue with an intermediate router that the packets have to pass through to reach the server. Traceroute prints the network path from your local computer to the website that the traffic must pass through.