df -h
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | more
sudo apt-get remove --purge wolfram-engine
sudo apt-get remove --purge libreoffice
sudo apt-get remove --purge libreoffice-core
sudo apt-get remove --purge libreoffice-common
sudo apt-get remove --purge scratch
sudo apt-get remove --purge scratch2
sudo apt-get remove --purge scratch3
sudo apt-get remove --purge minecraft-pi
sudo apt-get remove --purge sonic-pi
sudo apt-get clean
sudo apt-get autoremove
Find all directories with size larger than 1GB (or 1MB if you change G to M after the pipe) and print only files up to 4th depth level
sudo du -xh -d 4 / | grep -P "G\t"
ls -lah | grep "M "
ls -lah | grep "G "
https://www.linode.com/docs/guides/use-logrotate-to-manage-log-files/
systemctl list-units --type=service
crontab -l
grep CRON /var/log/syslog
tail -f /var/log/syslog
lsblk -p
ssh pi@192.168.1.38 'sudo dd bs=4M if=/dev/mmcblk0 status=progress | gzip' | dd of=pi_os_backup.gz
https://www.raspberrypi.org/documentation/installation/installing-images/linux.md
ssh-copy-id -i ~/.ssh/klucz grizwold@192.168.1.38
https://www.ssh.com/ssh/copy-id
For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD Card. When the Raspberry Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted. The content of the file does not matter; it could contain text, or nothing at all.
https://raspberrypi.stackexchange.com/questions/10251/prepare-sd-card-for-wifi-on-headless-pi
The Raspberry Pi Foundation's Raspberry Pi Imager now has an advanced options menu which is accessed by the keyboard shortcut Ctrl+Shift+X. You can set hostname, allow SSH (including changing user password), configure wifi and set locale. Note that this tool also appears to have telemetry built in, which can be turned off from the GUI.
https://play.google.com/store/apps/details?id=it.Ettore.raspcontroller&hl=en&gl=US
https://www.ics.com/blog/gpio-programming-using-sysfs-interface
Custom bash welcome screen. Create file /home/pi/.bash_profile
:
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
# get the load averages
read one five fifteen rest < /proc/loadavg
echo "$(tput setaf 2)
.~~. .~~. `date +"%A, %e %B %Y, %r"`
'. \ ' ' / .' `uname -srmo`$(tput setaf 1)
.~ .~~~..~.
: .~.'~'.~. : Uptime.............: ${UPTIME}
~ ( ) ( ) ~ Memory.............: `cat /proc/meminfo | grep MemFree | awk {'print int($2/1024)'}`/`cat /proc/meminfo | grep MemTotal | awk {'print int($2/1024)'}` MB
( : '~'.~.'~' : ) Free Disk Space....: `df -Pkh | grep -E '^/dev/root' | awk '{ print $4 }' | awk -F '.' '{ print $1 }'` on /dev/root
~ .~ ( ) ~. ~ Load Averages......: ${one}, ${five}, ${fifteen} (1, 5, 15 min)
( : '~' : ) Running Processes..: `ps ax | wc -l | tr -d " "`
'~ .~~~. ~' Temperature........: `/usr/bin/vcgencmd measure_temp`
'~'
$(tput sgr0)"
command:
/usr/bin/vcgencmd measure_temp
outputs:
temp=43.3'C