notes/bash.md
2020-02-23 14:26:55 -05:00

1.9 KiB

https://wiki.bash-hackers.org/

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

psql

Set PSQL defaults

put .psqlrc in home directory \set x '\setenv PAGER less' \set xx '\setenv PAGER 'pspg -bX --no-mouse''

Size of directory: du -hcs //mnt/c/PostgreSQL/cassandra30/

list lines in file wc file

General tasks

wc - print line counts

free - memory usage

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