June 2020

Linux ping a port using netcat

To check if a port is reachable on Linux This is tested using nc version 7.50 (package nmap-ncat) on Amazon Linux. nc -vz localhost 22Connection read more

Use watch to monitor a command at some frequency on Linux

Use watch with -n to watch a command ever 2 seconds. e.g. To watch top command with first 12 lines every 2 seconds:watch -n 2  read more

Linux what package provides a file

Using rpm We can use rpm on Centos/RHEL/Amazon Linux based system to file which package provides a specific file. e.g. rpm -q -f /usr/bin/watchprocps-3.2.8-45.16.amzn1.x86_64 Alternatively read more

csvkit – parse csv file and data on Linux command line

csvkit can be used to extract and process fields from a csv file on Linux or Mac. Install python3 if not installed already. The command read more

Linux replace comma with newline

To replace comma of any other character with newline on Linux or Mac, the following tr command can be used tr ‘,’ ‘\n’ filename or read more

mysql – how to enable query logs

The steps to enable mysql query logs on Mysql 5.7 (should work on other versions also) on Linux Edit /etc/my.cnf and add the followinggeneral_log=1general_log_file=/var/log/mysqlquery.log Ensure read more

mysql find recently created-tables

The query to find recently created tables in mysql select table_schema, table_name, create_timefrom information_schema.TABLESwhere table_schema not in (‘information_schema’, ‘mysql’)order by CREATE_TIME desc

Install php 7 on Amazon Linux 2

Steps to install php 7.3 or higher versions on Amazon Linux 3 Install many remi repos remi-php74, remi-php74, etc. (but keep them disabled)sudo yum install read more

Amazon Linux 2 install apache 2.4

Steps to install and enable httpd/apache 2.4 on Amazon Linux 2. sudo yum install httpd sudo systemctl start httpd sudo systemctl enable httpd

Linux yum quick tutorial

Linux Yum handy commands for Amazon Linux, Centos, RHEL Linux Show Repository listsudo yum repolistsudo yum repolist all (includes disabled also) List all packages from read more

Mysql 5.7 root password after installation

A random root password is generated and logged in log /var/log/mysqld.log sudo cat /var/log/mysqld.log | grep -i password2020-06-02T17:39:23.434297Z 1 [Note] A temporary password is generated read more

How to install mysql 5.7 on Amazon Linux 2

Steps to install mysql 5.7 on Amazon Linux 2 Install Extra Packages for Enterprise Linux (EPEL)sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm(you can alternatively use sudo amazon-linux-extras install read more