Organized cheatsheet of commands I use but keep forgetting.
Logs from last boot session in reverse order
journalctl -rb -1
Where are things autostarted for new user sessions:
Freedesktop specifications:
/etc/xdg/autostart/thing.desktop
~/.config/autostart/thing.desktop
Systemd (more info):
- Global definitions of user sessions (by root):
/etc/systemd/user/default.target.wants/* → /usr/lib/systemd/user/thing.service
Manage with:
systemctl --user --global disable thing.service
systemctl --user --global enable thing.service
- User defining its own session:
~/.config/systemd/user/default.target.wants/*.service → ~/.local/share/systemd/user/thing.service
Manage with:
systemctl --user status thing.service
systemctl --user edit thing.service
systemctl --user enable thing.service
systemctl --user restart thing.service
journalctl --user
systemd-analyze --user security thing.service
dpkg-reconfigure console-setup
# Choose font 'Terminus', 'fixed' has less available sizes
# Select bigger font size, it will need framebuffer available
In /etc/default/keyboard
XKBOPTIONS="terminate:ctrl_alt_bksp"
add-apt-repository ppa:yuezk/globalprotect-openconnect
Newer solution: https://wiki.debian.org/DebianRepository/UseThirdParty
Deprecated:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys XXXXXXXXXXX
apt-key adv --fetch-keys https://packages.cloud.google.com/apt/doc/apt-key.gpg
# Find keys, note the last 8 chars of the cert to be migrated
apt-key list
# Export the cert
apt-key export 87654321 | gpg --dearmour -o /etc/apt/trusted.gpg.d/my.gpg
# Modify repo file
deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/my.gpg] https://my.repo/debian testing main
# Delete key
apt-key del 87654321
rm -f /var/lib/aptitude/pkgstates*
aptitude purge ?config-files
dpkg --purge $(dpkg --get-selections | grep deinstall | cut -f1)
systemctl enable fstrim.timer
update-alternatives --config java
With testing and unstable repositories, prefer testing packages. In /etc/apt/preferences.d/
Package: *
Pin: release a=testing
Pin-Priority: 800
Also prefer the firefox package from unstable
Package: firefox
Pin: release a=unstable
Pin-Priority: 999
:%s/search/replace/g
apt install exhuberant-ctags
cd repos/my_project
ctags -R -f .tags .
Launch vim and test looking for a function definition with Ctrl+], return to the previous position with Ctrl+t
https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
/etc/bash.bashrc
~/.bashrc
Since ~/.bash_profile usually loads ~/.bashrc, set there stuff for every shell
Sometimes interactive contents of .bashrc may block session scripts. To avoid this, have the interactive parts after this line:
[ -z "$PS1" ] && return
curl --tls-max 1.2 --tlsv1.2
openssl s_client -starttls smtp -crlf -connect smtp.office365.com:587
openssl s_client -noservername -connect host:port
docker create --name=YOLO image:tag
docker export YOLO | tar t
docker rm YOLO
kubectl config current-context
kubectl config get-contexts
kubectl config use-context yolo
kubectl config set-context --current --namespace=yolo-namespace
inxi -Fxz
cat /proc/asound/cards
lsusb -tv
pactl list modules