Skip to content

Instantly share code, notes, and snippets.

@madebylydia
Last active August 22, 2022 20:57
Show Gist options
  • Save madebylydia/3d4a520122015c3371ce1d0b18e3f476 to your computer and use it in GitHub Desktop.
Save madebylydia/3d4a520122015c3371ce1d0b18e3f476 to your computer and use it in GitHub Desktop.
Basic Applications for my systems

Commands

Logging

Check logging disk space

journalctl --disk-usage

Archive logs

journalctl --rotate

Clear logs

Delete journal logs older than X days

sudo journalctl --vacuum-time=2days

Delete log files until the disk space taken falls below the specified size

sudo journalctl --vacuum-size=100M

Delete old logs and limit file number to X

sudo journalctl --vacuum-files=5

Lynis

Reference: https://packages.cisofy.com/community/#debian-ubuntu

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 013baa07180c50a7101097ef9de922f1c2fde6c4
sudo apt install apt-transport-https
echo 'Acquire::Languages "none";' | sudo tee /etc/apt/apt.conf.d/99disable-translations
echo "deb https://packages.cisofy.com/community/lynis/deb/ stable main" | sudo tee /etc/apt/sources.list.d/cisofy-lynis.list
sudo apt update
sudo apt install lynis

OhMyZsh

Beautiful

Reference: https://github.com/ohmyzsh/ohmyzsh

sudo apt install zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Theme: agnoster

PostgreSQL

SQL database.

Reference: https://www.postgresql.org/download/linux/ubuntu/

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql

Superuser creator for PSQL

Reference: https://stackoverflow.com/questions/57975093/create-a-superuser-in-postgres

sudo -u postgres createuser -s -i -d -r -l -w <username>
sudo -u postgres psql -c "ALTER ROLE <username> WITH PASSWORD '<password>';"

NCDU

Disk usage scanner! WinDirStat, but Linux.

Reference: https://dev.yorhel.nl/ncdu

sudo apt install ncdu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment