| |
— | wiki:terminal [2023/08/11 09:24] (current) – created - external edit 127.0.0.1 |
---|
| ====== Terminal emulator, bash ====== |
| |
| Набор базовых терминальных команд. |
| |
| ===== SMART/Health Information (NVMe Log 0x02) ===== |
| |
| <code=bash>sudo smartctl --attributes /dev/nvme0 #https://dragonserw.ru/wiki:terminal</code> |
| |
| Source: [[https://www.linux.org.ru/forum/linux-hardware/17206456|Linux-ORG-RU]] |
| |
| <code=bash>brew upgrade youtube-dl |
| youtube-dl -f 'bestvideo[height<=1080]+bestaudio' --merge-output-format mkv rK0ak3Jy-8A J-CmEbXH90M</code> |
| |
| ===== Работа с .PDF ===== |
| |
| [[pdf|Работа с .pdf]]. |
| |
| ===== Вывод английского алфавита в командной строке ===== |
| |
| <code=bash>echo {a..z} #https://unixforum.org/viewtopic.php?t=151274 </code> |
| |
| ===== VCMI ===== |
| |
| <code=bash>vcmibuilder --gog $HOME/Public/Playground/VCMI/setup_heroes_of_might_and_magic_3_complete_4.0_\(28740\).exe</code> |
| |
| Source: https://wiki.vcmi.eu/Installation_on_Linux. https://bilge.ru/playground:vcmi. |
| |
| ===== Скопировать либо синхронизировать каталоги только с выбранными типами документов ===== |
| |
| https://unixforum.org/viewtopic.php?f=90&t=151273 |
| <code=bash>rsync -az --include={'*/','*.desktop',*.nfo','*.torrent','*.url','*.webloc'} --exclude='*' ~/Public ~'/Google Drive/rsync'</code> |
| |
| ===== Apple's SuperDrive tweak for use with Linux ===== |
| |
| <code=bash>sg_raw /dev/sr0 EA 00 00 00 00 00 01 # Wakes-Up your SuperDrive; no root needed! # sudo dnf install sg3_utils -y</code> |
| |
| https://gist.github.com/AnnoyingTechnology/dbaae864822cf08372f0aafe64a63477 |
| |
| ===== Создание загружаемого установщика для macOS ===== |
| |
| https://support.apple.com/ru-ru/HT201372. |
| |
| <code=bash>sudo /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume</code> |
| |
| ===== PhotoRec — свободная программа для восстановления данных ===== |
| |
| <code=bash>brew install testdisk |
| sudo photorec</code> |
| |
| ===== 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/ |
| |
| <code=bash>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</code> |
| |
| <code=bash>sudo systemctl stop myservice && sudo dnf update -y && sudo reboot now</code> |
| |
| ===== Calculate difference between start_time and end_time ===== |
| |
| Измерение времени выполнения команд в скриптах: https://drmini.ru/computers/os/get-program-execution-time-in-the-shell.html#i. |
| |
| <code=bash>#!/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"</code> |