Notes
Written by Simone
I'll update this post whenever I see fits, A.K.A. when I have other bits of information which don't require a whole post.
Operations on files and directories
Move files to the current/parent directory in Linux
Current dir
find . -type f -exec mv {} . \;
Parent dir
find . -type f -exec mv {} .. \;
Recursive chmod on files and dirs
To change all the directories to 755 (-rwxr-xr-x
):
find /var/www/blog -type d -exec chmod 755 {} \;
To change all the files to 644 (-rw-r--r--
):
find /var/www/blog -type f -exec chmod 644 {} \;
Certbot
Certbot cli
/etc/letsencrypt/cli.ini
When renewing, use the same private key as the existing certificate. (default: False):
reuse-key = True
Common commands
Register single domain:
certbot certonly --standalone -d domain.tld --dry-run
- Remove “–dry-run” when ok.
Renew single domain:
certbot renew --cert-name domain.tld --dry-run
- Remove “–dry-run” when ok.
Delete single domain:
certbot delete --cert-name domain.tld
- Cannot use "--dry-run" in this case.
Revoke certificate:
certbot revoke --cert-path /etc/letsencrypt/archive/${YOUR_DOMAIN}/cert1.pem
Check certificate's expiry date:
cat /etc/letsencrypt/live/domain.tld/cert.pem | openssl x509 -noout -enddate
GIT
To reset your git repository to given commit id, do:
git reset --hard <commit-id>
git push origin master --force
Ignoring files that are already tracked
git update-index --assume-unchanged <your file here>
Delta Chat Mail sieve
require ["fileinto"];
# rule:[DeltaChat]
if header :contains "Chat-Version" "1.0"
{
fileinto "DeltaChat";
stop;
}
Postfix mail queue
To view postfix mail queue in case of problems and remove a particular message from it, do as follows:
# mailq
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
6DCF32201B* 4824 Thu Oct 19 22:54:44 roughnecks@woodpeckersnest.eu
debian@spacenet.it
-- 4 Kbytes in 1 Request.
# postsuper -d 6DCF32201B
postsuper: 6DCF32201B: removed
postsuper: Deleted: 1 message
To delete all emails in the queue, use this command:
# postsuper -d ALL
Check Preferred Outgoing IP (when multiple are set on <interface>
)
curl ifconfig.me
The correct command to add a new Linux user (in this case without a shell)
adduser --shell /usr/sbin/nologin <username>
I always forget which command is the complete one, useradd
or adduser
Packages management with apt and aptitude
Finding currently installed "external" packages (not from stable repo)
# aptitude search "?narrow(?installed,?not(?archive(stable)))"
i containerd.io - An open and reliable container runtime
i docker-buildx-plugin - Docker Buildx cli plugin.
i docker-ce - Docker: the open-source application container engine
i docker-ce-cli - Docker CLI: the open-source application container engine
i A docker-ce-rootless-extras - Rootless support for Docker.
i docker-compose-plugin - Docker Compose (V2) plugin for the Docker CLI.
In the above example, "i" means installed and "A" means it was automatically installed, such as a dependency. I'm running upstream docker.
This is another package that I have installed from sid and set on "hold":
# apt-cache policy toot
toot:
Installed: 0.45.0-1
Candidate: 0.45.0-1
Version table:
*** 0.45.0-1 100
100 /var/lib/dpkg/status
0.34.1-1 500
500 http://deb.debian.org/debian bookworm/main amd64 Packages
500 http://deb.debian.org/debian bookworm/main i386 Packages
bookworm version of toot
is rather old, as you can see.