Linux Programmer | RHCE | RHCSA

Search This Blog

Saturday, 8 June 2019

Switch between multiple PHP version in Ubuntu

If you have two php versions (e.g. PHP7.2 and PHP 5.6 ) installed in your ubuntu system.


Switch from PHP 5.6 to PHP 7.2 =====>

Apache:-
sudo a2dismod php5.6
sudo a2enmod php7.2
sudo service apache2 restart
 
Command Line:-
sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set phar /usr/bin/phar7.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2
sudo update-alternatives --set phpize /usr/bin/phpize7.2
sudo update-alternatives --set php-config /usr/bin/php-config7.2  

Switch from PHP 7.2 to PHP 5.6 =====>
 
Apache:-
sudo a2dismod php7.2
sudo a2enmod php5.6
sudo service apache2 restart

Command Line:-
sudo update-alternatives --set php /usr/bin/php5.6
sudo update-alternatives --set phar /usr/bin/phar5.6
sudo update-alternatives --set phar.phar /usr/bin/phar.phar5.6
sudo update-alternatives --set phpize /usr/bin/phpize5.6
sudo update-alternatives --set php-config /usr/bin/php-config5.6
 


Tuesday, 21 May 2019

Record SSH terminal of some user in Linux


Record you terminal's stdin/stdout to a server.

You can use script command to record all the activity on terminal.

Consider using script command
 
$ script <output_filename>
 
and then ssh to your server, once you are done close your ssh connection and 
$ exit
 
to stop the screen recording.
You could make sure your recordings are always named uniquely by using the following convention,

$ script filename_(date +"%Y-%m-%d%H%M%S")

you can add this line in users .bashrc.
or you can create bash script for this,

for e.g.

create one bash script named, recording.sh
 
#!/bin/bash
_ck=`ps -ef | grep -i script | grep -v grep | grep -i filename`
if [ ! -n "$_ck" ]; then
        echo "running" >>/tmp/.purval
        script filename_$(date  +"%Y-%m-%d%H%M")
fi
 
 
for e.g. script is located in users home folder. i.e. $HOME/recording.sh
you can call the script into .bashrc.

Tuesday, 8 January 2019

How to run executable scripts in Nautilus?

when i am trying to open executable scripts (e.g. .sh) from nautilus then it will directly open scripts into text editor.


Solution:
1. open Nautilus
2. Open this from menu bar.
           settings -> Preferences
3. Select the 'Behavior' tab.
4. Select "Ask each time" under "Executable Text Files".
5. Close the window.

enter image description here

And it works.

MIG - NVIDIA

The new Multi-Instance GPU (MIG) feature allows GPUs (starting with NVIDIA Ampere architecture) to be securely partitioned into up to seven ...