Skip to content

Instantly share code, notes, and snippets.

View tankibaj's full-sized avatar

Naim tankibaj

  • Berlin, Germany
  • 11:18 (UTC +02:00)
View GitHub Profile

Attach USB to System

Insert a USB drive into your system and identify your USB drive correctly. This is the step you need to take care, because you may format the wrong disk if not correctly identify your disk.

lsblk

Output:

Attach USB to System

Insert a USB drive into your system and identify your USB drive correctly. This is the step you need to take care, because you may format the wrong disk if not correctly identify your disk.

lsblk

Output:

echo "mysql-server mysql-server/root_password password pwd" | sudo debconf-set-selections
echo "mysql-server mysql-server/root_password_again password pwd" | sudo debconf-set-selections
sudo apt-get -y install mysql-server

IP ADDRESS :

ip addr show |grep -w inet |grep -v 127.0.0.1|awk '{ print $2}'| cut -d "/" -f 1
Output : 192.168.16.30

Laptop running as a server

I am running an old Dell Laptop as a server with Ubuntu 18.04 on it. Installing Ubuntu on the system was straight forward, but at a certain point you want to close the lid of the laptop. This puts your laptop in sleep, which for a server is not the intended result.

Disable Sleep on Lid Close

Debians Suspend Wiki page had the right solution for this

grep + echo should suffice:

grep -qxF 'include "/configs/projectname.conf"' foo.bar || echo 'include "/configs/projectname.conf"' >> foo.bar
sudo sh -c 'echo GRUB_RECORDFAIL_TIMEOUT=0 >> /etc/default/grub';
sudo update-grub;

This setting is done in the /etc/sudoers file, which drives sudoers to use default security policy plugin for the sudo command under the user privilege specification section.

To allow a user (naim in the example below) to run all commands using sudo without a password, open the sudoers file:

echo 'naim ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

You must be the root user.

cat /dev/null > ~/.bash_history && history -c && >/var/log/lastlog && >/var/log/wtmp && >/var/log/btmp && exit

Libvirt allows you to expose any USB device attached to your physical machine to the guest VMs. To do it, first, you have to get the vendor id and product id.

Run lsusb on terminal:

Qg8kPL8

Create a hostdev xml with vendor and product nano usb.xml