Inspect TXT records of a domain

 host -t txt google.com 

Create a database

When all the servers installed above, it’s now time to begin setting up WordPress environment. First, run the steps below to create a blank database for WordPress to use.

Logon to MariaDB database console using the commands below:

sudo mysql -u root -p

Then create a database called wpdb

CREATE DATABASE wpdb;

Next, create a database user called wpdbuser and set password

CREATE USER 'wpdbuser'@'localhost' IDENTIFIED BY 'new_password_here';

Then grant the user full access to the database.

GRANT ALL ON wpdb.* TO 'wpdbuser'@'localhost' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES;
EXIT;

List all mysql users

login into mysql:

sudo mysql -u root -p


list all users:

SELECT User,Host FROM mysql.user;

Importing the database

From the normal command line, you can import the dump file with the following command:

mysql -u username -p new_database < data-dump.sql

Export all database to one file

mysqldump -u root -p --all-databases > alldb.sql

Import all databases

mysql -u root -p < alldb.sql

cp command syntax

Use the following syntax:
cp -a {/path/to/source} {/path/to/destination}

For example copy all files including subdirectories from /mnt/dvd/data to /home/tom/data, enter:

 cp -a /mnt/dvd/data/* /home/tom/data


OR

 cp -av /mnt/dvd/data/* /home/tom/data

Copy all files include with dot at beginning.

cp -Rdfp $source/. $dest

Remove a PPA from the source list in terminal

Alternatively, you can remove the PPA from sources list where these PPAs are stored. PPAs are store in the form of PPA_Name.list. Use the following command to see all the PPAs added in your system:

sudo ls /etc/apt/sources.list.d

Look for your desire PPA here and then remove the PPA using the following command:

sudo rm -i /etc/apt/sources.list.d/PPA_Name.list

Copy all files by extension to single directory

Execute the next: 

cp -R *.tif /yourfolder

Inspect txt records of a domain

host -t txt google.com

Installing screen package

Keep it running in backend

first, install screen: 
sudo apt-get install sudo screen

run a new session with any name. e.g. mycustomsession

screen -S mycustomsession


then start any comment. e.g. code-server

code-server

Press Ctrl+a and immediately z to disconnect from the session and leave it running as a background process.
In the future, to return, let’s see the list of running sessions and connect to the desired one:

screen -ls
screen -r mycustomsession

 

Extract .tar.gz/.tgz archive to specific folder

To extract a foo.tar.gz (.tgz extension file) tarball to /tmp/bar, enter:

mkdir /tmp/foo
tar -zxvf foo.tar.gz -C /tmp/foo

install Yarn

sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn


yarn install

# Result/output of above command
yarn install v1.3.2
warning You are using Node “6.0.0” which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: “^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0”
info No lockfile found.
[1/4] Resolving packages…
[2/4] Fetching packages…
[3/4] Linking dependencies…
[4/4] Building fresh packages…

info Lockfile not saved, no dependencies.
Done in 0.20s.

install composer

Before installing Composer, ensure that you have all the necessary requirements installed on your system:

sudo apt update
sudo apt install wget php-cli php-zip unzip

Composer offers an installer written in PHP that we’ll use to install Composer. Use wget to download the installer:

wget -O composer-setup.php https://getcomposer.org/installer

The command above will save the file as composer-setup.php in the current working directory .

Composer is a single file CLI application and can be installed either globally or as part of the project. The global installation requires sudo privileges .

  • To install Composer globally as a system-wide command that will be available for all users, simply place the file in a directory that is in the system PATH . Run the following command to install Composer in the /usr/local/bin directory:

    sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
    All settings correct for using Composer
    Downloading...
    
    Composer (version 1.10.7) successfully installed to: /usr/local/bin/composer
    Use it: php /usr/local/bin/composer

    You can now use Composer by running composer in your terminal.

  • To install composer locally enter:

    sudo php composer-setup.php --install-dir=/path/to/project

    This will download a file named composer.phar in your project root directory. To use Composer navigate to the project directory and run php composer.phar

When a new Composer version is available, you can update your installation using the following command:

sudo composer self-update  

Switch php versions

sudo update-alternatives --config php

Downgrade or Upgrade composer

Assuming a regular windows installation, to rollback to version 1 of composer, you simply execute:

composer self-update --1

When you want to go back to version 2 (which you should, after updating or removing the incompatible plugins):

composer self-update --2

Get List of all PHP modules installed

dpkg --get-selections | grep php

Uninstall PHP from the system

If you want to remove PHP and all its related modules, you can run the following command:

sudo apt-get purge php7.* php-common

(Enter Y when asked for confirmation)

This will remove PHP and all its related modules from your system


Instead of removing PHP and all its related modules you can uninstall the unrequired package using the following command:

sudo apt-get purge [package_name]

For example, to remove the PHP ZIP package run the following command:

sudo apt-get purge php7.4-zip

This will uninstall the PHP-zip package from your Ubuntu 20.04 system.