postgre-backup-and-restore-guide

(★ 11)

Simple to follow, single-page guide to postgre-17 backup and restore to/from local/s3 on Ubuntu

File Explorer

  • README.md

# Use via CDN

jsDelivr

jsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.

Command Glossary

Commands referenced in this DOCs, explained below.

🔍

crontab

View Details ▼

Schedule cron jobs to run on a time interval for the current user.

crontab -e

[e]dit the crontab file for the current user:

sudo crontab -e -u {{user}}

[e]dit the crontab file for a specific [u]ser:

crontab {{path/to/file}}

Replace the current crontab with the contents of the given file:

🔍

nano

View Details ▼

Text editor. An enhanced `pico` clone.
See also: `pico`, `rnano`.

nano {{path/to/file1 path/to/file2 ...}}

Open specific files, moving to the next file after closing the previous one:

nano {{[-I|--ignorercfiles]}}

Start the editor without using configuration files:

nano +{{line}},{{column}} {{path/to/file}}

Open a file and position the cursor at a specific line and column:

🔍

psql

View Details ▼

PostgreSQL client.

psql {{database}}

Connect to the database. By default, it connects to the local socket using port 5432 with the currently logged in user:

psql {{[-h|--host]}} {{host}} {{[-p|--port]}} {{port}} {{[-U|--username]}} {{username}} {{database}}

Connect to the database on given server host running on given port with given username, without a password prompt:

psql {{[-h|--host]}} {{host}} {{[-p|--port]}} {{port}} {{[-U|--username]}} {{username}} {{[-W|--password]}} {{database}}

Connect to the database; user will be prompted for password:

🔍

apt install

View Details ▼

Install packages for Debian-based distributions.

sudo apt install {{package}}

Install a package, or update it to the latest version:

sudo apt install {{[-V|--verbose-versions]}} {{package}}

Display verbose package version information during installation or update:

🔍

apt

View Details ▼

Package manager for Debian-based distributions.
Intended as a user-friendly alternative to `apt-get` for interactive use.
For equivalent commands in other package managers, see <https://wiki.archlinux.org/title/Pacman/Rosetta>.

sudo apt update

Update the list of available packages and versions (recommended before running other `apt` commands):

apt search {{package}}

Search packages by name or description:

apt list {{package}}

Search packages by name only (supports wildcards like `*`):

🔍

last

View Details ▼

View the last logged in users.

last

View last login information (e.g., username, terminal, boot time, kernel) of all users as read from `/var/log/wtmp`:

last {{username}}

List login information of a specific user:

last {{[-n|--limit]}} {{login_count}}

Specify how many of the last logins to show:

🔍

systemctl enable

View Details ▼

Enable systemd services.
See also: `systemctl revert`.

systemctl enable {{unit}}

Enable a service to run on boot:

systemctl enable {{unit}} --now

Enable a service to run on boot and start it now:

systemctl enable {{unit}} --user

Enable a user unit to run on login:

🔍

systemctl restart

View Details ▼

Stop and then start one or more systemd units.
Can be used in place of `systemctl start` on a stopped unit, but `start` is safer so that a running unit isn't accidentally restarted.

systemctl restart {{unit}}

Restart a unit:

systemctl restart {{unit1 unit2 ...}}

Restart more than one unit:

systemctl restart {{unit}} --user

Restart a user unit:

🔍

systemctl start

View Details ▼

Start systemd units.

systemctl start {{unit}}

Start a unit:

systemctl start {{unit}} --user

Start a user unit:

🔍

systemctl status

View Details ▼

Display the status of systemd units.

systemctl status {{unit}}.{{service|timer|socket|target|...}}

Show the status of a systemd unit:

systemctl status --failed

Show the status of failed units:

systemctl status

List all running services:

🔍

systemctl stop

View Details ▼

Stop systemd units.

systemctl stop {{unit}}

Stop a unit:

systemctl stop {{unit}} --no-warn

Stop a service and suppress warnings:

systemctl stop {{unit}} --user

Stop a user unit:

// repository documentation