USER
How to ADD,DELETE user
-
ADD
$ sudo adduser <username>
-
DELETE
$ sudo deluser <username>
- IF YOU WANT to remove the user files
$ sudo deluser --remove-home <username>
- IF YOU WANT to remove the user files
To give sudo privilge
$ sudo usermod -aG sudo <username>
run a command with sudo privileges without entering the password
$ EDITOR=vim visudo
adding a line below to ~end of file~. replace username with yours
username ALL=(ALL) NOPASSWD: ALL
Connect AirPods
Enabling Airpods as earbuds and microphone
LVM (file system)
how to resize the default LVM volume
About LVM and how to manage
managing packages using apt
ls /etc/apt/sources.list.d/
sudo add-apt-repository --remove ppa:whatever/ppa
apt-key
- apt-key is deprecated .. so if you got warning about it, see here
setting Firewall
with ufw
with iptables
If you installed AlgoVPN, you cannot use other firewall tools including ufw
.
Please check this page, if you want to more.
Furthermore, if you want to save the rules, you should save the rules in /etc/iptables/rules.v4
and /etc/iptables/rules.v6
after installing the apt package iptables-persistent
.
When network does not work
I’ve experienced the Internet connection wasn’t established
after inserting gpu on my computer.
The reason was the settings about PCI devices. My LAN Card and GPU used PCI bus.
but when I used before, I didn’t use GPU.
So my computer set LAN Card using PCI bus, named enp2s0.
However, after setting gpu, I don’t know why exactly, but LAN Card got enp3s0.
I might think the gpu get second PCI device name.
Long prefaces. I solved problem using below try.
Reference 4
sudo lshw -C network
- outputs are the LAN Cards that computer can use.
- I had gotten
*-network DISABLED
about my mainboard LAN card.
sudo ip link set enp3s0 up
- change PCI devices name on
/etc/netplan/*.yaml
- the exact file name is different. find your mainboard(or something you want) LAN card setting.
- example
network: version: 2 renderer: NetworkManager ethernets: enp3s0: dhcp4: true
- sudo netplan apply
- sudo systemctl restart NetworkManager.service
- and I don’t use this, but it could be useful maybe..
Setting the default editor for all programs
export VISUAL=vim
export EDITOR='$VISUAL'
- Setting both is not necessarily needed, but some programs may be required.
How to keep turning on the laptop when it closes
Using GUI
sudo apt install gnome-tweaks
- open the application
Tweaks
- set off
Suspend when the laptop lid is closed
option.
Using Terminal
sudo vim /etc/systemd/logind.conf
- change
#HandleLidSwitch=suspend
toHandleLidSwitch=ignore
How to add swap space
Creating a swap file
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
-
if the fallocate failed with the error message
fallocate failed: Operation not supported
, trysudo dd if=/dev/zero of=/swapfile bs=1024 count=2097152
-
to make the change permanently, add the following line in
/etc/fstab
/swapfile swap swap defaults 0 0
Check and Change the Swappiness Value
-
check swappiness value
cat /proc/sys/vm/swappiness
-
change swappiness value
sudo sysctl vm.swappiness=10
- to make the change permanently, add the following line in
/etc/sysctl.conf
vm.swappiness=10
- to make the change permanently, add the following line in
Removing a swap file
sudo swapoff -v /swapfile
- remove the line
/swapfile swap swap defaults 0 0
from the/etc/fstab
file sudo rm /swapfile