Clear Cache on Linux

  1. Clear PageCache only: # sync; echo 1 > /proc/sys/vm/drop_caches
  2. Clear dentries and inodes: # sync; echo 2 > /proc/sys/vm/drop_caches
  3. Clear PageCache, dentries and inodes: # sync; echo 3 > /proc/sys/vm/drop_caches

Create a LiveUSB (other distro)

To create a non-Ubuntu Linux Live USB, you must use UNetbootin, but if you find that when you run it is no widgets on the window, type the following command:

sudo QT_X11_NO_MITSHM=1 unetbootin

source

Hold Packages

Using apt

Holding a package

sudo apt-mark hold <package-name>

Unhold package:

sudo apt-mark unhold <package-name>

Using dpkg

Hold package:

echo "<package-name> hold" | sudo dpkg --set-selections

Unhold package:

echo "<package-name> install" | sudo dpkg --set-selections

Display status:

dpkg --get-selections

Display the status of a single package

dpkg --get-selections | grep <package-name>

source

How to change the default locale in Ubuntu Server

Generate locale:

sudo locale-gem es

also try generating supported local list

sudo dpkg-reconfigure locale

update the current locale

sudo update-locale LANG=es_PA.UTF-8

extra steps to try

sudo update-locale LANG="es_PA.UTF-8" LANGUAGE="es_PA"
sudo dpkg-reconfigure locales

How to list installed packages

The apt tool on Ubuntu 14.04 and above makes this very easy.

apt list --installed

Older versions

To get a list of packages installed locally do this in your terminal:

dpkg --get-selections | grep -v deinstall

(The -v tag “inverts” grep to return non-matching lines)

To get a list of a specific package installed:

dpkg --get-selections | grep postgres

To save that list to a text file called packages on your desktop do this in your terminal:

dpkg --get-selections | grep -v deinstall > ~/Desktop/packages

Alternatively, simply use

dpkg -l

How to set the default editor

$ update-alternatives --config editor

How to set my user account to have no password

You can’t do that using the GUI tool, but you can using the terminal.

  1. First, if your user has sudo privileges, you must enable its NOPASSWD option. Otherwise, sudo will ask for a password even when you don’t have one, and won’t accept an empty password.

    To do so, open the sudoers configuration file with sudo visudo, and add the following line to the file, replacing david with your username:

    david ALL=(ALL) NOPASSWD:ALL
    

    Close the editor to apply the changes, and test the effect on sudo in a new terminal.

  2. Delete the password for your user by running this command:

    sudo passwd -d `whoami`
    

Update Editor

$ update-alternatives --config editor