Author Archives: Daniel Sobrinho

Replace text/string/chars in multiple files in a folder

To identify text/strings in multiple files and replace them in multiple files simultaneously use the following command:

~$ find ./ -type f -exec sed -i 's/text/text2/g' {} ;

Note that the path of the files is determined in the second block in: ./

The searched and replaced text will be placed in place of the word: text

The text to be added in place will be placed in place of the word: text2

Remember to preserve all other attributes of the command by observing the position of quotation marks, bars, etc.

Picking up information from the USB port

With the lsusb command you will see the path to the device:

~$ lsusb

Bus 00x Device 00y: ID ……………….

By adding the attributes to the command you will have detailed information:

~$ lsusb -v -s 00x:00y

Bus 001 Device 005: ID 22b8:2e83 Motorola PCS 
 Device Descriptor:
   bLength 18
   bDescriptorType 1
   2.00 bcdUSB
   bDeviceClass 0 (Defined at Interface level)
   bDeviceSubClass 0 
   bDeviceProtocol 0 
   bMaxPacketSize0 64
   idVendor 0x22b8 Motorola PCS
   idProduct 0x2e83 
   ff.ff bcdDevice
   motorola iManufacturer 1
   motog3 iProduct 2
   iSerial 3 0016903665
   bNumConfigurations 1
   Configuration Descriptor:
     bLength 9
     bDescriptorType 2
     totallength 39 w
     bNumInterfaces 1
     bConfigurationValue 1
     iConfiguration 0 
     bm 0x80 Attributes
       (Bus Powered)
     MaxPower 500mA
     Descriptor Interface:
       bLength 9
       bDescriptorType 4
       bInterfaceNumber 0
       bAlternateSetting 0
       bNumEndpoints 3
       bInterfaceClass 6 Imaging
       bInterfaceSubClass 1 Still Image Capture
       bInterfaceProtocol 1 Picture Transfer Protocol (PIMA 15470)
       iInterface 5 PTP
       Endpoint Descriptor:
         bLength 7
         bDescriptorType 5
         bEndpointAddress 0x81 EP 1 IN
         bmAttributes 2
           Transfer Type Bulk
           Synch Type None
           Usage Type Data
         wMaxPacketSize 0x0200 1x 512 bytes
         bInterval 0
       Endpoint Descriptor:
         bLength 7
         bDescriptorType 5
         bEndpointAddress 0x01 EP 1 OUT
         bmAttributes 2
           Transfer Type Bulk
           Synch Type None
           Usage Type Data
         wMaxPacketSize 0x0200 1x 512 bytes
         bInterval 0
       Endpoint Descriptor:
         bLength 7
         bDescriptorType 5
         bEndpointAddress 0x82 EP 2 IN
         bmAttributes 3
           Transfer Type Interrupt
           Synch Type None
           Usage Type Data
         wMaxPacketSize 0x001c 1x 28 bytes
         bInterval 6
 Device Qualifier (for other device speed):
   bLength 10
   bDescriptorType 6
   2.00 bcdUSB
   bDeviceClass 0 (Defined at Interface level)
   bDeviceSubClass 0 
   bDeviceProtocol 0 
   bMaxPacketSize0 64
   bNumConfigurations 1
 Device Status: 0x0000
   (Bus Powered)

For example, you will see the maximum current (amperage/energy) on the door, remembering that the voltage is 5 volts by default. Information relevant to validate whether the port supports a device.

PHP7.4 in Debian

How to install php7.4 and php7.4-fpm in Debian, Deepin, Ubuntu, Mint, etc.

Install the repository
: ~$ apt install gnupg2 –
y ~$ wget -qO – https://packages.sury.org/php/apt.gpg | sudo apt-key add
– ~$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.x.li

st Update:
~$ apt update
~$ apt upgrade

Install:
~$ apt install php7.4

Install with most commonly used extensions:
~$ sudo apt install php libapache2-mod-php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline libphp7.4-embed php7.4-bz2 php7.4-common php7.4-curl php7.4-dba php7.4-fpm php7.4-gd php7.4-interbase php7.4-intl php7.4-ldap php7.4-mbstring php 7.4-mysql php7.4-pgsql php7.4-phpdbg php7.4-soap php7.4-sqlite3 php7.4-tidy php7.4-xml php7.4-xsl php7.4-zip

Exchanging php version:
~$ update-alternatives –set php /usr/bin/php7.4
~$ update-alternatives –set phar /usr/bin/phar7.4
~$ update-alternatives –set phar.phar /usr/bin/phar.phar7.4

Activating php7.4-fpm:
~$ systemctl disable php*-fpm (swap * for the version of the currently act
ive)~$ systemctl stop php*-
fpm~$ systemctl enable php7.4-f
pm~$ systemctl start php7.4-fp
m~$ systemctl restart apache2