2020-02-23 14:26:55 -05:00
|
|
|
https://wiki.bash-hackers.org/
|
|
|
|
|
2018-04-12 14:00:19 -04:00
|
|
|
|
|
|
|
Update PostgreSQL
|
|
|
|
------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
|
|
|
|
|
|
|
|
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
|
|
|
|
|
|
|
|
sudo apt-get update
|
|
|
|
|
|
|
|
sudo apt-get install postgres-10
|
|
|
|
|
|
|
|
sudo su - postgres
|
|
|
|
|
2018-05-07 17:15:30 -04:00
|
|
|
psql
|
|
|
|
|
|
|
|
|
|
|
|
Set PSQL defaults
|
|
|
|
-------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
put .psqlrc in home directory
|
|
|
|
\set x '\\setenv PAGER less'
|
2018-07-11 14:23:47 -04:00
|
|
|
\set xx '\\setenv PAGER \'pspg -bX --no-mouse\''
|
|
|
|
|
|
|
|
|
|
|
|
Size of directory: `du -hcs //mnt/c/PostgreSQL/cassandra30/`
|
|
|
|
|
|
|
|
list lines in file `wc file`
|
2018-07-27 17:05:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
General tasks
|
|
|
|
------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
wc - print line counts
|
|
|
|
|
|
|
|
free - memory usage
|
|
|
|
|
2018-08-23 13:34:17 -04:00
|
|
|
du - disk space by file
|
|
|
|
|
|
|
|
Resource Limit
|
|
|
|
--------------------------------------------------------------------------------------------------------------
|
|
|
|
`ulimit -a` to see all limits
|
|
|
|
file at /etc/security/limits.conf to configure defaults
|
|
|
|
|
|
|
|
|
|
|
|
MySQL
|
|
|
|
---------------------------------------------------------------------------------------------------------------
|
|
|
|
connection like `mysql -u root -p`
|
|
|
|
|
|
|
|
`show databases;`
|
|
|
|
|
|
|
|
user is in the format root@127.0.0.1
|
|
|
|
|
|
|
|
`grant all prviileges on *.* to 'root'@'127.0.0.1'`
|
|
|
|
|
|
|
|
data is stored in /var/lib/mysql
|
|
|
|
|
|
|
|
failure to drop a db can be due to presence of unknown file in the database directory
|
|
|
|
|
|
|
|
SSH
|
|
|
|
----------------------------------------------------------------------------------------------------------------
|
|
|
|
add client
|
|
|
|
* client uses ssh-keygen to create a key in `/home/un/.ssh/` under files `id_rsa` and `id_rsa.pub`
|
|
|
|
* host setup //etc/ssh/sshd_config to allow passwords and restart
|
|
|
|
* client uses `ssh-copy-id host_address -p port_num` to move the key to the host
|
|
|
|
* client uses `ssh` to login
|