linux
Debian install
Better install from stable
then upgrade to testing
if needed.
Post-install config
bash prompt
alias ls="ls --color"
alias lls="ls -altr --color"
alias nano="nano -c"
export PROMPT="[%n] %~ %#" # renders like: [user] ~/tmp %
file watcher
By default, file watcher limit is around 8K. Each watcher needs around 1Kb in RAM.
# cat /proc/sys/fs/inotify/max_user_watches
# echo "fs.inotify.max_user_watches=1280000" >>> /etc/systctl.conf
# sysctl -p
CLI
cron / systemd
Starting Debian 12, prefered way is systemd service/timer.
It offers better logging, integration with system and dependency management.
# each day, at 1:15am
15 01 * * * <USER> <COMMAND>
[Unit]
Description=<TASK DESCRIPTION>
[Service]
# Type: oneshot (runs once and exit), simple (default; for deamons)
Type=oneshot
User=<USER>
WorkingDirectory=<WORKING DIR>
ExecStart=/bin/bash -c 'APP_ENV=value ./bin/python3 ./cron_daily.py'
[Unit]
Description=<TASK DESCRIPTION>
[Timer]
OnCalendar=*-*-* 01:15:00
Persistent=false
[Install]
WantedBy=timers.target
Enable and start
# systemctl daemon-reload # since service files have changed
# systemctl enable <TASK>.timer
# systemctl start <TASK>.timer
# systemctl list-timers
# journalctl status <TASK>
# systemctl start <TASK> # to start a task now (testing purpose)
groups
$ usermod -a -G <GROUP> <USER> // add user to secondary group
$ id -G -n <USER> // list groups membership for user
$ apt install members
$ members <GROUP> // list all members
mlocate
Use plocate
: faster & more efficient.
mlocate is safer locate (user only sees files given its permissions)
plocate
# apt install plocate
# updatedb // initialize database
$ mlocate <FILENAME> // all path with <FILENAME>
$ mlocate -b '\<FILENAME>' // exact <FILENAME>
rsync
#!/bin/sh
rsync -n -avuz -e "ssh -p 22" \
--exclude='*.cfg' --exclude='bin/' --exclude='lib/' --exclude='.*' --exclude='__pycache__**' \
/local/path/ user@host:/path/remote/
echo "!!! DRY-RUN"
shell
$ echo $0 // print current shell
$ exec bash // reload bash
ssh
add public key for specific user
On target server, add user's public key on ~/.ssh/authorized_keys
.
Line start with ssh-rsa
or ssh-ed25519
depending key type.
wget
Backup locally a remote website
$ wget -mpEk --delay=1 --random-delay -H --domain=www.domain.com,subdomain.domain.com
video codecs
# apt install ffmpeg libavcodec-extra x265
applications
brave
Available on Brave's repo
$ wget -qO - https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg > brave-browser.gpg
# mv /home/<USER>/brave-browser.gpg /usr/share/keyrings
deb [signed-by=/usr/share/keyrings/brave-browser.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main
# apt update
# apt install brave-browser
/usr/bin/brave-browser
firefox
Due to high release rate and breaking changes, it is mandatory to use Mozilla's repo.
$ wget -qO - https://packages.mozilla.org/apt/repo-signing-key.gpg > packages.mozilla.org.asc
# mv /home/<USER>/packages.mozilla.org.asc /usr/share/keyrings
deb [signed-by=/usr/share/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main
# apt update
# apt install firefox
/usr/bin/firefox.real
For GPU acceleration, about:settings
then set media.ffmpeg.vaapi.enabled
to true
goaccess
tmux
tmux (for terminal multiplexer) is usefull to keep console programs open even if user logs-off.
$ tmux new -s <SESSION_NAME>
exit
closes session
Ctrl+B and ++$++ rename current sessions
Ctrl+B and D exit with session in background
Ctrl+B and [ scroll-mode (exit with Q)
misc
/usr/bin vs /usr/local/bin
/bin
: for small programs to be available before /usr is mounted
/usr/bin
: for programs installed by distribution manager
/usr/local/bin
: for programs installed outside distribution manager