sudo service nginx restart # or sudo systemctl restart nginx
Linux
Check port exclusion on Windows
These ports are blocked by default if opening from WSL, so either make exception for it or open a new port, for example nodejs port 3000 cannot be open from WSL
netsh int ipv4 show excludedportrange protocol=tcp Protocol tcp Port Exclusion Ranges Start Port End Port ---------- -------- 1051 1150 1151 1250 1338 1437 1438 1537 1538 1637 1638 1737 1766 1865 1938 2037 2038 2137 2180 2279 2280 2379 2380 2479 2480 2579 2699 2798 2830 2929 2930 3029 3030 3129 3130 3229 3230 3329 3430 3529 3530 3629 3630 3729 3757 3856 3857 3956 3957 4056 4057 4156 4157 4256 4315 4414 4466 4565 4566 4665 5357 5357 5426 5426 50000 50059 * 54235 54235 54236 54236 * - Administered port exclusions.
Swap size vs RAM Linux
RAM Size / Swap Size (Without Hibernation) / Swap size (With Hibernation)
256MB 256MB 512MB
512MB 512MB 1GB
1GB 1GB 2GB
2GB 1GB 3GB
3GB 2GB 5GB
4GB 2GB 6GB
6GB 2GB 8GB
8GB 3GB 11GB
12GB 3GB 15GB
16GB 4GB 20GB
24GB 5GB 29GB
32GB 6GB 38GB
64GB 8GB 72GB
128GB 11GB 139GB
Install VSCode on Linux Mint using Terminal
sudo apt update sudo apt install apt-transport-https curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ sudo apt update -y sudo apt install code -y
Start Mongodb automatically when Ubuntu boot up
sudo systemctl enable mongod
Use locate command to find files in Linux
locate is a very useful command, which can be use from time to time to find files in Linux when we don’t know where that file is.
sudo apt update sudo apt install locate sudo updatedb # need to let sometime for this to finish locate .bashrc # locate can be called from anywhere locate -c "*thingtosearch" # search by regex, show count locate -e "*thingtosearch" # search in real-time, regardless db not updated. locate -i "*thingToSearch" # search and ignore case locate -S # view locate db at 10:56:54 Database /var/cache/locate/locatedb is in the GNU LOCATE02 format. Database was last modified at 2020:10:07 10:38:37.467600124 +0200 Locate database size: 5860142 bytes All Filenames: 464048 File names have a cumulative length of 34300427 bytes. Of those file names, 1317 contain whitespace, 0 contain newline characters, and 32 contain characters with the high bit set. Compression ratio 82.92% (higher is better)
Install Midori browser using Terminal
Midori is probably one of the most lightweight browser for Linux, sometimes we just need it to quickly search for text information on Google and this is the browser for that purpose.
sudo apt update sudo apt install midori midori
Install and use Vagrant on Linux for development
sudo apt-get autoremove virtualbox-dkms sudo apt-get install build-essential linux-headers-`uname -r` dkms virtualbox-dkms sudo modprobe vboxdrv sudo modprobe vboxnetflt
Install and use vagrant
sudo apt update sudo apt install curl curl -O https://releases.hashicorp.com/vagrant/2.2.10/vagrant_2.2.10_x86_64.deb sudo apt install ./vagrant_2.2.10_x86_64.deb ## Let's test vagrant --version mkdir vagrant-project cd vagrant-project vagrant init centos/8 ## If you already have a vagrant image.box vagrant box add mybox ./image.box vagrant init mybox vagrant up ## To ssh into vagrant box vagrant ssh ## To stop vagrant box vagrant halt ## To destroy and clean up everything vagrant destroy
Lightshot alternative for Linux
Flameshot is a very good screenshot app, works seamlessly like Lightshot on Windows, let’s install it the easy way:
## Install using apt sudo apt update sudo apt install flameshot ## Quickly bind Print (Prtsc) to flameshot gsettings set org.gnome.settings-daemon.plugins.media-keys screenshot '[]' gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']" gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'flameshot' gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command '/usr/bin/flameshot gui' gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding 'Print'