[Trick] How do Backup in PostreSQL

Postgres have the tool pg_dump the which is used for do backups.

$ pg_dump -i -F c -b -v -f backup_name.bk database_name

add -s, –schema-only: for dump only the schema, no data.

Create the database if no existing:

$ createdb --locale=en_US.UTF-8 --owner=postgres -W database_name

Restore backup:

$ pg_restore -i -d database_name -v backup_name.bk



install vim with support for python 2.7/3.X

* remove vim:

$ sudo apt update
$ sudo apt purge $(dpkg --get-selections|grep -i vim|cut -f1)

* install the dependencies:

$ sudo apt install python-dev python3-dev libncurses5-dev git

* download sources:

$ cd /tmp/
$ git clone http://github.com/vim/vim.git
$ cd vim

* configure and compiling sources:

$ ./configure \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
--enable-python3interp \
--with-python-config-dir=/usr/lib/python3.?/config-3.?m-x86_64-linux-gnu \
--with-features=huge \
--enable-multibyte \
--with-x=yes \
$ make
$ sudo make install

* check the support for python:

$ vim --version|grep --color -i python

you’re should see +python

* Set vim as your editor for default:

$ sudo update-alternatives --install $(which editor) editor $(which vim) 40
$ sudo update-alternatives --config editor