Thursday, April 8, 2021

How to change python default version in ubuntu?

 In ubuntu By default python version was 2.7. We need to use python3 to run the python files with the latest version.


Steps to change the default python version to 3


Check the current version 


#python --version

Python 2.7.17



Execute this command to switch to python 3.6. 


#sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1


Output:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1

update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode


Check python version


python --version

Python 3.6.9



Tuesday, April 6, 2021

How to Install innotop in linux?

Innotop is an efficient command-line monitoring tool for local and remote MySQL servers running under Innodb. It helps to monitoring several operations like MySQL replication status, user statistics, query list, InnoDB buffers, InnoDB I/O information etc.



To Install Innotop


Run the following command to install Innotop


In RedHat


yum install innotop


In Ubuntu


Fetch innotop from its GIT repository:


Install Perl dependency:


sudo apt install libterm-readkey-perl libclass-dbi-perl libclass-dbi-mysql-perl make 


sudo apt-get install git

git clone https://github.com/innotop/innotop.git


Or 



wget https://github.com/innotop/innotop/archive/refs/heads/master.zip




cd innotop/

perl Makefile.PL


Note:If there no warnings and errors (in case you have to fix other dependencies), proceed with the installation of this good MySQL InnoDB real-time monitor:



sudo make install


Innotop can be launched in several ways, the easiest is to provide, on the command line, username and password (with -u [user] and -p [password]) of a privileged user.


Syntax:


sudo innotop -uuser -ppassword


Now the terminal will be logged in.



Press " ?" help symbol to view the various option available.


To Monitor the remote mysql server


If you want to monitor the remote mysql server, run the below command. Login the remote mysql server enter the mysql username, password and hostname.


sudo innotop -uuser -ppassword -hip_address


Wednesday, March 24, 2021

How to find the file size of a remote HTTP object?


There are times when you need to know the file size of an HTTP object without actually downloading the file. This little trick comes in very handy when web servers respond with the Content-Length of an object in the HEAD request itself.


Using curl command:


Example:


curl -sI https://releases.ubuntu.com/20.04.2.0/ubuntu-20.04.2.0-desktop-amd64.iso | grep Content-Length


Content-Length: 2877227008


Let’s try and make this human-friendly:


curl -sI https://releases.ubuntu.com/20.04.2.0/ubuntu-20.04.2.0-desktop-amd64.iso | grep Content-Length | sed 's/[^0-9]//g' | numfmt --to=si

2.9G



Where The Numfmt command will convert the numbers to/from human-readable format.