Adding shell alias ↗
-
Make sure your
~/.bashrc
file has the following lines or append them:if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
-
Open
~/.bash_aliases
-
Add required aliases, for example
alias work='cd ~/work'
-
Save and close the file
-
Tell the system to reload aliases:
source ~/.bash_aliases
-
Alias can be removed with
unalias {alias_name}
- Remove all aliases:
unalias -a
- Remove all aliases:
split -b 20m dimg dimg.part
zip -r dimg.zip dimg*
...
unzip dimg.zip -d .
cat dimg.part* > dimg
Disk usage ↗
df -h
Adding shell script to apps list ↗
- Create new file:
touch ~/.local/share/applications/{Your App Name}.desktop
- Put contents:
[Desktop Entry] # Define which specification version this entry is using Version=1.0 # The application name (eg. "Gnome Terminal", "Firefox") Name=My Awesome App # The generic app name (eg. "Terminal", "Web Browser") GenericName=Awesome App # The Tooltip Comment=This app is awesome! # The command you want to execute Exec=/path/to/sh/file/file.sh # Whether the app should run in a terminal window Terminal=false # The pretty picture :D Icon=/opt/PhpStorm-103.243/bin/webide.png # The type of the desktop entry (Application, Link, or Directory) Type=Application
JetBrains ecosystem ↗
- Download and install latest .tar.gz from jetbrains.com
- Install required IDEs via Toolbox
sudo -i mkdir /opt/jetbrains-toolbox tar -xzf jetbrains-toolbox-1.21.9712.tar.gz -C /opt/jetbrains-toolbox --strip-components=1 chmod -R +rwx /opt/jetbrains-toolbox touch /opt/jetbrains-toolbox.sh echo '#!/bin/bash' >> /opt/jetbrains-toolbox.sh echo '/opt/jetbrains-toolbox/jetbrains-toolbox' >> /opt/jetbrains-toolbox.sh # TODO investigate (strip-comps) ln -s /opt/jetbrains-toolbox.sh /usr/local/bin/jetbrains-toolbox chmod -R +rwx /usr/local/bin/jetbrains-toolbox rm jetbrains-toolbox-1.21.9712.tar.gz jetbrains-toolbox
Ctrl + Shift language switch ↗
For Ubuntu 18.04 LTS, 20.04 LTS, 20.10 and 21.04 with GNOME desktop:
- Install GNOME Tweaks
sudo apt-get install gnome-tweaks
- Then open (
gnome-tweaks
). - Select Keyboard & Mouse tab
- Click Additional Layout Options button
- Expand Switching to another layout
- Select Ctrl + Shift here
- It also breaks "Ctrl + Shift + {X}" normal work in most of the cases.
Dual boot timezone fix ↗
- Fixes system time shift on OS switching
sudo timedatectl set-local-rtc 1
CLI markdown rendering ↗
curl -L -o glow_1.4.1_linux_amd64.deb https://github.com/charmbracelet/glow/releases/download/v1.4.1/glow_1.4.1_linux_amd64.deb
sudo dpkg -i glow_1.4.1_linux_amd64.deb
Install .deb package manually ↗
sudo dpkg -i DEB_PACKAGE
Remove invalid apt repository (PPA) ↗
cd /etc/apt/sources.list.d
ls -la
rm ...
Gnome Disks (GUI) ↗
- Disk format and partitioning
- Filesystem & bootsectors backup/restore
sudo apt-get install gnome-disk-utility gnome-disks
boot-repair (GUI) ↗
- Recovery/install MBR partition tables
- GRUB bootloader
- GPT disk drives
sudo add-apt-repository ppa:yannubuntu/boot-repair && \ apt-get update && \ apt-get install -y boot-repair && \ boot-repair
Archer T3U Plus ↗
- USB WiFi adapter drivers for Ubuntu 18/20/21
sudo apt update && \ apt install git dkms build-essential linux-headers-generic && \ git clone https://github.com/morrownr/88x2bu.git && \ cd 88x2bu && \ sudo ./install-driver.sh
User creation ↗
ssh root@{server_ip}
adduser delameter
usermod -aG sudo delameter
ufw app list
ufw allow OpenSSH
ufw enable
ufw status
Installing nginx ↗
sudo apt update
sudo apt install nginx
sudo ufw app list
sudo ufw allow 'Nginx HTTP'
sudo ufw status
systemctl status nginx
- Enable Read-Only Mode
FLUSH TABLES WITH READ LOCK; SET GLOBAL read_only = 1;
- Disable Read-Only Mode
SET GLOBAL read_only = 0; UNLOCK TABLES;
Reverse SSH tunnel ↗
- On target host:
ssh -fN -R 10022:localhost:22 dlup.link
- On relay host:
ssh -p 10022 localhost
SSH key autoload ↗
-
Launch ssh agent:
eval "$(ssh-agent -s)" ssh-add ~/.ssh/github touch ~/.ssh/config chmod 600 ~/.ssh/config nano ~/.ssh/config
-
.ssh/config
:Host github.com IdentityFile ~/.ssh/github # @TODO havent tried yet # AddKeysToAgent yes
SSH SOCKS proxy ↗
- Creates proxy that listens
127.0.0.1:1905
:ssh -fN4 -D 1905 dlup.link
-
--proxy socks5h://127.0.0.1:1488
-
apt
↗
sudo -i 'Acquire::http::proxy "socks5h://localhost:1488";' >> /etc/apt/apt.conf.d/12proxy sudo apt install sudo sed -i 's/^Acquire/#Acquire/' /etc/apt/apt.conf.d/12proxy
docker-compose on Ubuntu 20 ↗
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c