-
-
Save mort3za/2ee614c79f10139674d603f06a0b68ba to your computer and use it in GitHub Desktop.
| # Set permission of all files and folders. 755 and 644. | |
| find . -type d -exec chmod 755 {} \; | |
| find . -type f -exec chmod 644 {} \; | |
| find ./app/cache -type d -exec chmod 777 {} \; | |
| find ./app/logs -type d -exec chmod 777 {} \; | |
| find ./web/upload -type d -exec chmod 777 {} \; | |
| #find /opt/lampp/htdocs -type d -exec chmod 755 {} \; | |
| #find /opt/lampp/htdocs -type f -exec chmod 644 {} \; | |
| # Show permissions in number format in ubuntu. #linux | |
| # http://askubuntu.com/a/430685/205156 | |
| alias perms="stat -c '%a - %n'" |
See the temperature of CPU
cat /sys/class/thermal/thermal_zone*/temp
Create bootable USB
to find usb drive path: cat /dev/sd* (if it is sdb1, use sdb instead)
sudo dd if=ubuntu-18.04-desktop-amd64.iso of=/dev/sdb
Switch keyboard keys
xev and press any key to find the key codes, the output is something like this:
state 0x10, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
state 0x10, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
state 0x11, keycode 11 (keysym 0x40, at), same_screen YES,
Switch keys by:
xmodmap -e "keycode 78 = at"
Save to prevent reset after booting:
xmodmap -pke|egrep -e '78'
That will print a line like:
keycode 78 = at NoSymbol at
Create file ~/.Xmodmap and copy to it.
Show local IP address
hostname -I
Connect to ssh and use server connection
ssh -fN -D 1080 user@remote
Open an application by defined proxy
proxychains4 -f /etc/proxychains4.conf [firefox, bash or something]
https://github.com/rofl0r/proxychains-ng
Fix mint 19 slow sleep (suspend) by adding usb c port to blacklist
Restart cinnamon when GUI is laggy
press alt + f2 anywhere, a dialog box will open, type r and press Enter.
See hardware details
sudo apt install inxi
inxi -Fxz
Fix hibernate on ubuntu 20
apt remove --purge hibernate uswsusp
# /etc/default/grub
# add resume=UUID=###
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=7ef2fd85-9a9e-4fa9-a9c9-6c541d7944c9"
and edit (or create file)
# /etc/initramfs-tools/conf.d/resume
RESUME=UUID=###
* ### is the UUID of swap partition.
sudo apt install pm-utils
sudo pm-hibernate
https://www.linuxuprising.com/2018/08/how-to-use-swap-file-instead-of-swap.html
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1819915/comments/49
Install Nvidia optimus-manager in Manjaro distro (to switch between Intel and Nvidia GPUs easily)
Get ip of websites through Tor
tor-resolve WEBSITE_DOMAIN
Fix dns leak in OpenVPN (necessary to unblock filtering)
cd /tmp & git clone git@github.com:alfredopalhares/openvpn-update-resolv-conf.git
cd openvpn-update-resolv-conf
sudo cp update-resolv-conf.sh /etc/openvpn/
Then open your ovpn config file and add:
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
Finally, connect to your server by:
sudo openvpn --config myconfig.ovpn
Resources:
https://wiki.archlinux.org/index.php/OpenVPN#The_update-resolv-conf_custom_script
https://github.com/alfredopalhares/openvpn-update-resolv-conf
Copy text between two VIMs.
Install GVim instead of vim which contains vim too, it has clipboard feature (check with vim --version | grep clipboard).
Select text and use "+y to copy text to global clipboard register. then paste as normal text.
Clear DNS cache in manjaro
update /etc/hosts then sudo nscd -i hosts
Shred a partition (without ability to recover files)
sudo shred -v -n1 -z /dev/sdX
OpenVPN - exempt a website on VPN
Add this line for every website to .ovpn file:
route WEBSITE_IP 255.255.255.255 DEFAULT_GATEWAY
example for https://www.whatsmyip.org/
route 208.79.209.138 255.255.255.255 192.168.1.1
208.79.209.138 is the IP of the website.
Get the website IP by ping whatsmyip.org
Restart VPN.
screen command (toggle between multiple terminals)