Getting detailed information about your Linux distribution

To be able to get a more detailed information about your current linux distribution, including the code names use the following:

BASH<br>

Using strace for analyzing performance

There is a very nice example on the O’reilly ‘Linux Under The Hood’ training about using strace to compare performance of two commands that provide the same output but with different calls. The two different commands were: ls and echo *, that they both provide the listing of the current directory.

First using the strace with ls:

SHELL

And using the same with echo *

SHELL

So the difference in time is 0.00000 for the echo and 0.000601 for the ls.

Similarly the number of calls for the echo is 33, but ls is using 100.

Get a list of your Route53 subdomains using aws cli docker image

Problem

You would like to have a list of your subdomains for a specific domain (hosted zone), that are hosted in Amazon’s Route 53.

Solution

You can install the aws cli docker image from here https://github.com/cgswong/docker-aws if you don’t want to install the aws cli in your computer.

You can afterwards start the container with:

docker run -it cgswong/aws:latest

Then configure it by running the following and adding your credentials and zone:

efe9881d4fd:/tmp# aws configure
 AWS Access Key ID [None]: aws_access_key_id
 AWS Secret Access Key [None]: aws_secret_access_key
 Default region name [None]: eu-central-1
 Default output format [None]:

Then run the first command to get a list of the hosted zones and get the id of the hosted zone you want to find the subdomains for:

3efe9881d4fd:/tmp# aws route53 list-hosted-zones
{
    "HostedZones": [
        {
            "ResourceRecordSetCount": 2, 
            "CallerReference": "RISWorkflow-RD:xxxxx", 
            "Config": {
                "Comment": "HostedZone created by Route53 Registrar", 
                "PrivateZone": false
            }, 
            "Id": "/hostedzone/HOSTEDZONEID", 
            "Name": "domain.net."
        }, 

Then pick the HOSTEDZONEID and run the following to get a list of subdomains for that domain:

3efe9881d4fd:/tmp# aws route53 list-resource-record-sets --hosted-zone="HOSTEDZONEID" | grep "Name" | uniq

   "Name": "alpah.domain.com.",                                                                                                                                                                                                                                             
   "Name": "beta.domain.com.",                                                                                                                                                                                                                                       
   "Name": "lamda.domain.com.",
......

Find your public IP address from linux command line

Problem

You would like to find out your public IP from the command line without using an online service

Solution

Use dig like the following line (taken from https://www.cyberciti.biz/faq/how-to-find-my-public-ip-address-from-command-line-on-a-linux/):

dig +short myip.opendns.com @resolver1.opendns.com

you could also add it as an alias:

alias myip=”dig +short myip.opendns.com @resolver1.opendns.com”