Linux Snippets
# Helpful bash/Linux commands
# replace AAA with BBB in a bunch of files
find . -type f -name "*" -exec sed -i 's!AAA!BBB!g' {} +
# replace A with B in filenames (e.g. colons)
rename 's|A|B|g' *
# create SSH key
ssh-keygen -t ed25519 -a 100
# Create service user on Ubuntu
adduser --system --no-create-home --shell=/bin/false --group <NAME>
# Create service user on Fedora
sudo useradd -r -M -s /bin/false <NAME>
# Recursively fix permissions (dirs / files)
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
Apply git patch
git apply --verbose file.patch
# SELinux enable binary
sudo semanage fcontext -a -t bin_t "/opt/bin/program"
sudo restorecon -v /opt/bin/program