====== Terminal emulator, bash ======
Набор базовых терминальных команд.
===== SMART/Health Information (NVMe Log 0x02) =====
sudo smartctl --attributes /dev/nvme0 #https://dragonserw.ru/wiki:terminal
Source: [[https://www.linux.org.ru/forum/linux-hardware/17206456|Linux-ORG-RU]]
brew upgrade youtube-dl
youtube-dl -f 'bestvideo[height<=1080]+bestaudio' --merge-output-format mkv rK0ak3Jy-8A J-CmEbXH90M
===== Работа с .PDF =====
[[pdf|Работа с .pdf]].
===== Вывод английского алфавита в командной строке =====
echo {a..z} #https://unixforum.org/viewtopic.php?t=151274
===== VCMI =====
vcmibuilder --gog $HOME/Public/Playground/VCMI/setup_heroes_of_might_and_magic_3_complete_4.0_\(28740\).exe
Source: https://wiki.vcmi.eu/Installation_on_Linux. https://bilge.ru/playground:vcmi.
===== Скопировать либо синхронизировать каталоги только с выбранными типами документов =====
https://unixforum.org/viewtopic.php?f=90&t=151273
rsync -az --include={'*/','*.desktop',*.nfo','*.torrent','*.url','*.webloc'} --exclude='*' ~/Public ~'/Google Drive/rsync'
===== Apple's SuperDrive tweak for use with Linux =====
sg_raw /dev/sr0 EA 00 00 00 00 00 01 # Wakes-Up your SuperDrive; no root needed! # sudo dnf install sg3_utils -y
https://gist.github.com/AnnoyingTechnology/dbaae864822cf08372f0aafe64a63477
===== Создание загружаемого установщика для macOS =====
https://support.apple.com/ru-ru/HT201372.
sudo /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume
===== PhotoRec — свободная программа для восстановления данных =====
brew install testdisk
sudo photorec
===== Using Flatpak =====
https://docs.flatpak.org/en/latest/using-flatpak.html#updating
===== Use systemd to Start a Linux Service at Boot =====
https://www.linode.com/docs/guides/start-service-at-boot/
sudo cp test_service.sh /usr/bin/test_service.sh && sudo chmod +x /usr/bin/test_service.sh
sudo cp myservice.service /etc/systemd/system/myservice.service && sudo chmod 644 /etc/systemd/system/myservice.service && sudo systemctl enable myservice #https://dragonserw.ru/wiki:terminal
sudo systemctl stop myservice && sudo dnf update -y && sudo reboot now
===== Calculate difference between start_time and end_time =====
Измерение времени выполнения команд в скриптах: https://drmini.ru/computers/os/get-program-execution-time-in-the-shell.html#i.
#!/bin/bash
START_TIME=$(date +%s)
# do something
sleep 1
# in this block
END_TIME=$(date +%s)
DIFF=$(( $END_TIME - $START_TIME ))
echo "It took $DIFF seconds"