linux

$ cp /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.orig   $ vi /etc/netplan/01-netcfg.yaml   Find current IP address $ ifconfig Replace the content with the following # This file describes the network interfaces available on your system # For more information, see netplan(5). network: version: 2 renderer: networkd ethernets: ens160: dhcp4: no addresses: [192.168.1.45/24 ] gateway4: 192.168.1.1 nameservers: search: [static01.skayal.com] addresses: [192.168.1.1]   Generate the required configuration for the renderers. $ netplan generate   Apply all configuration and restart renderers. $ netplan apply    ...

Read More
cli

There are two ways to make this happen. The first is using the semicolon like so: sudo apt-get update; sudo apt-get upgrade -y  The only problem with that method is that the second command will run, even if the first command fails. In those cases, you'd run the command: sudo apt-get update && sudo apt-get upgrade -y Both versions of the command will run, but the second form will only run...

Read More
phpmyadmin

  Edit file /usr/share/phpmyadmin/libraries/sql.lib.php using this command: sudo nano +613 /usr/share/phpmyadmin/libraries/sql.lib.php On line 613 the count function always evaluates to true since there is no closing parenthesis after $analyzed_sql_results['select_expr']. Making the below replacements resolves this, then you will need to delete the last closing parenthesis on line 614, as it's now an extra parenthesis. Replace: ((empty($analyzed_sql_results['select_expr'])) || (count($analyzed_sql_results['select_expr'] == 1) ...

Read More
phpmyadmin

MySQL 5.7 and above Creating a Superuser for phpMyAdmin In terminal, log in to MySQL as root. sudo mysql -p -u root CREATE USER 'pmauser'@'localhost' IDENTIFIED BY 'password_here'; Now we will grant superuser privilege to our new user pmauser. GRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'localhost' WITH GRANT OPTION; You should now be able to access phpMyAdmin using this new user account....

Read More
cli

Login to your server as root. As the root user, edit the sshd_config file found in /etc/ssh/sshd_config: vi /etc/ssh/sshd_config Add the following line to the file, you can add it anywhere but it’s good practice to find the block about authentication and add it there. PermitRootLogin yes Save and exit the file. Restart the SSH server: systemctl restart sshd or service sshd restart  ...

Read More
linux

What is a LAMP Stack? A LAMP (Linux, Apache, MySQL, PHP) stack is a common, free, and open-source web stack used for hosting web content in a Linux environment. Many consider it the platform of choice on which to develop and deploy high-performance web apps. Before You Begin Update your system: sudo apt update && sudo apt upgrade Install Using Tasksel Instead of installing Apache, MySQL, and PHP separately, Tasksel...

Read More
cli

Let’s take an plain text file, input.txt, that looks like this PATTERN-1 First line of unimportant text Second line of unimportant text PATTERN-2 Some more texts (may/ mayn't be important!) We want to delete some of the lines from the file using the command line stream editor, sed. 1. Use the following command to delete the lines lying between PATTERN-1 and PATTERN-2 , excluding the lines containing these patterns: sed '/PATTERN-1/,/PATTERN-2/{//!d}' input.txt If you...

Read More
cli

Here are two ways to delete the blank lines in a text file opened with vim: 1. Delete all the blank lines with NO white spaces other than new lines: :g/^$/d 2. Delete the blank lines containing any type of white spaces: :g/^\s*$/d BONUS: Remove only multi blank lines (reduce them to a single blank line) and leaving single blank lines intact: :g/^\_$\n\_^$/d Reference: Stack Overflow....

Read More