====== Information ====== * Miscellaneous commands, paths, info, and syntax for Linux * Most of this was previously under the "Notable Folders and Commands" section at the bottom of distro notes ====== Extract ISO ====== * ''D'' is the destination you want the extracted files to go * ''x'' is the ISO you want to extract files from * No space after the ''-o'' flag is intentional * This is primarily useful for copying Windows ISO images to a FAT32 flash drive 7z x -o'D' -y x 7z x -o'/run/media/espionage724/LTSC 2019' -y '/home/espionage724/Downloads/en_windows_10_enterprise_ltsc_2019_x64_dvd_be3c8ffb.iso' && sync && sync ====== yt-dlp ====== * https://github.com/yt-dlp/yt-dlp ===== Download ===== **** rm -f '/tmp/yt-dlp' && wget -O '/tmp/yt-dlp' 'https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp' && chmod +x '/tmp/yt-dlp' ===== Show Formats ===== * Change ''x'' to a URL '/tmp/yt-dlp' --list-formats x ===== Download Media ===== * Change ''x'' to a URL * ''bestaudio'' can be changed to ''bestvideo'' for just video, or ''best'' for best video with audio '/tmp/yt-dlp' --extract-audio --format 'bestaudio' x ==== M4A Audio ==== * Ideally for if iOS devices will be involved '/tmp/yt-dlp' --extract-audio --format 'bestaudio' --audio-format 'm4a' x ==== MP3 Audio ==== **** '/tmp/yt-dlp' --extract-audio --format 'bestaudio' --audio-format 'mp3' x ====== Shortcuts ====== /usr/share/applications ~/.local/share/applications ====== Icons ====== /usr/share/icons/hicolor ~/.local/share/icons/hicolor ====== Fedora ====== ===== Anaconda Module Blacklists ===== **** sudo -e '/etc/modprobe.d/anaconda-blacklist.conf' ===== YUM/DNF Repos ===== **** gio open '/etc/yum.repos.d' ===== DNF History ===== ==== Transaction IDs ==== **** sudo dnf history ==== Undo ==== * Change ''x'' to a transaction ID found above sudo dnf history undo x ===== DNF Autoremove Fix ===== * Removes the initially-installed kernel in order to fix ''dnf autoremove'' if it's broken * :!: This will vary depending on the Fedora image version used sudo dnf list --installed 'kernel'* sudo dnf remove *5.3.7* && sync ====== openSUSE ====== ===== Zypper ===== ==== Find Orphans ==== **** zypper packages --orphaned ==== Remove Package and Deps ==== **** sudo zypper remove --clean-deps 'x' ==== Show Installed Patterns ==== **** sudo zypper patterns --installed-only ==== Folder ==== **** ls '/etc/zypp/repos.d' ==== List ==== **** zypper repos --priority ====== Firewalld ====== ===== List Active Rules ===== **** sudo firewall-cmd --list-all ===== List Available Services ===== **** sudo firewall-cmd --get-services ===== Show Service Info ===== * Change ''x'' to name of a service from above * This shows what ports and protocols a service covers sudo firewall-cmd --info-service=x ===== Reload ===== **** sudo firewall-cmd --reload ===== Add/Remove Service ===== * Add ''--permanent'' as-needed to allow the rule to persist sudo firewall-cmd --add-service=x sudo firewall-cmd --remove-service=x ===== Add/Remove Port ===== * Add ''--permanent'' as-needed to allow the rule to persist * Change ''tcp'' to ''udp'' as-needed sudo firewall-cmd --add-port=x/tcp sudo firewall-cmd --remove-port=x/tcp ====== PipeWire ====== ===== Set Default Rate ===== mkdir -p ~/'.config/pipewire/pipewire.conf.d' && nano ~/'.config/pipewire/pipewire.conf.d/99-custom.conf' context.properties = { default.clock.rate = 192000 default.clock.allowed-rates = [ 44100 48000 88200 96000 192000 ] } ===== User Config ===== * Copy main config to user folder mkdir -p ~/'.config/pipewire/pipewire.conf.d' && cp '/usr/share/pipewire/pipewire.conf' ~/'.config/pipewire/pipewire.conf.d/99-custom.conf' nano ~/'.config/pipewire/pipewire.conf.d/99-custom.conf' ===== Read Main Config ===== * [[https://github.com/PipeWire/pipewire/blob/master/src/daemon/pipewire.conf.in|pipewire.conf.in]] gio open '/usr/share/pipewire/pipewire.conf' nano '/usr/share/pipewire/pipewire.conf' ===== WirePlumber Settings Reset ===== sudo rm -Rf ~gdm/'.local/state/wireplumber' ~/'.local/state/wireplumber' rm -Rf ~/'.local/state/wireplumber' ====== GPG Keys ====== ===== Check Keys ===== **** rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' ===== Remove Keys ===== **** sudo rpm -e x ====== Re-generate Thumbnails ====== **** rm -Rf ~/'.cache/thumbnails' ====== List GNOME gsettings ====== * Change ''x'' to schema or omit it to show all settings gsettings list-recursively 'x' ====== GNOME App Grid Reset ====== * [[https://www.omgubuntu.co.uk/2020/11/reset-gnome-shell-applications-grid|OMG! Ubuntu!]] gsettings reset 'org.gnome.shell' 'app-picker-layout' ====== GNOME Software Maintenance ====== **** pkcon -c '1' refresh && pkcon update ====== fstrim ====== **** sudo fstrim --verbose --all ====== SELinux Re-label ====== **** sudo touch '/.autorelabel' ====== tracker3 Reset ====== **** tracker3 reset --filesystem --rss ====== GNOME Monitors Reset ====== **** rm -f ~/'.config/monitors.xml' ~/'.config/monitors.xml~' ====== PulseAudio Reset ====== **** rm -f ~/'.config/pulse/'* ====== Xorg Debug ====== journalctl -e _COMM='gdm-x-session' gio open ~/'.local/share/xorg/Xorg.0.log' mousepad '/var/log/Xorg.0.log' gio open ~/'.local/share/xorg/' ====== Verify DRI3 ====== **** LIBGL_DEBUG='verbose' glxinfo | grep 'libgl' ====== GpuTest ====== * https://www.geeks3d.com/gputest/ ===== Execute ===== ==== HDTV ==== * 1280x720 wget -O '/tmp/GpuTest_Linux_x64.zip' 'http://www.ozone3d.net/gputest/dl/GpuTest_Linux_x64_0.7.0.zip' && unzip '/tmp/GpuTest_Linux_x64.zip' -d '/tmp' && cd '/tmp/GpuTest_Linux_x64_'* && ./GpuTest /test='fur' /width='1280' /height='720' cd '/tmp/GpuTest_Linux_x64_'* && ./GpuTest /test='fur' /width='1280' /height='720' /fullscreen /benchmark /benchmark_duration_ms='15000' === NVIDIA Optimus === **** wget -O '/tmp/GpuTest_Linux_x64.zip' 'http://www.ozone3d.net/gputest/dl/GpuTest_Linux_x64_0.7.0.zip' && unzip '/tmp/GpuTest_Linux_x64.zip' -d '/tmp' && cd '/tmp/GpuTest_Linux_x64_'* && __NV_PRIME_RENDER_OFFLOAD='1' __GLX_VENDOR_LIBRARY_NAME='nvidia' ./GpuTest /test='fur' /width='1280' /height='720' ==== FHD ==== * 1920x1080 wget -O '/tmp/GpuTest_Linux_x64.zip' 'http://www.ozone3d.net/gputest/dl/GpuTest_Linux_x64_0.7.0.zip' && unzip '/tmp/GpuTest_Linux_x64.zip' -d '/tmp' && cd '/tmp/GpuTest_Linux_x64_'* && ./GpuTest /test='fur' /width='1920' /height='1080' cd '/tmp/GpuTest_Linux_x64_'* && ./GpuTest /test='fur' /width='1920' /height='1080' /fullscreen /benchmark /benchmark_duration_ms='15000' ==== UHDTV1 ==== * 3840x2160 wget -O '/tmp/GpuTest_Linux_x64.zip' 'http://www.ozone3d.net/gputest/dl/GpuTest_Linux_x64_0.7.0.zip' && unzip '/tmp/GpuTest_Linux_x64.zip' -d '/tmp' && cd '/tmp/GpuTest_Linux_x64_'* && ./GpuTest /test='fur' /width='3840' /height='2160' cd '/tmp/GpuTest_Linux_x64_'* && ./GpuTest /test='fur' /width='3840' /height='2160' /fullscreen /benchmark /benchmark_duration_ms='15000' ==== Cleanup ==== **** rm -Rf '/tmp/GpuTest_Linux_'* && cd ~ && sync ====== Show Sensors ====== **** sudo dnf install 'lm_sensors' -y && sudo sensors-detect --auto && sudo watch -n0.5 sensors ====== Show CPU Frequency ====== grep 'MHz' '/proc/cpuinfo' watch --interval '0.5' grep \'cpu MHz\' '/proc/cpuinfo' ====== OpenSSL Supported Ciphers ====== **** openssl ciphers -v | awk '{print $2}' | sort | uniq ====== Partition Information ====== * Both commands present the same information df -hT df --human-readable --print-type ====== Encryption Information ====== **** sudo cryptsetup -v status '/dev/dm-0' ====== ATA Secure Erase ====== * See [[notes:drive_wipe]] ====== RAID ====== ===== Controller Details ===== * This can be used to get the OpROM version for Intel RST sudo mdadm --detail-platform ===== Create Software RAID ===== ==== Fedora Anaconda ==== * :!: https://bugzilla.redhat.com/show_bug.cgi?id=1897350 * Compared to old notes, the RAID device needs to be under ''/dev/md/'' instead of just ''/dev/'' to appear on Anaconda * 2024/01: On the computer this was tested on ((Dell Latitude 5591)), it doesn't support CSM/Legacy/BIOS boot and this takes over the entire block devices, requiring the ''/boot'' partition and boot partition flag to be on a SD Card ((only tested with Legacy External Boot; UEFI untested but theoretically also requires ''/boot'' on a SD Card since BIOS/firmware can't directly-read software RAID)) sudo mdadm --create '/dev/md/raid0' --name='RAID' --level='0' --raid-devices='2' '/dev/nvme0n1' '/dev/sda' --verbose ==== Old ==== * :?: Came from old notes; this used to work for an Acer Predator laptop that had 3 SSDs sudo mdadm --create '/dev/md0' --name='RAID' --level='0' --raid-devices='3' '/dev/sda' '/dev/sdb' '/dev/sdc' --verbose ====== Fix MacBook Battery CPU Throttling ====== * 2023/07/17: This solves a MacBook Pro Mid-2010 with Intel C2D from being stuck at 1.5GHz CPU due to a missing internal battery, by unlocking full-performance sudo dnf install 'msr-tools' sudo wrmsr --all '0x1A0' '0x4000850089' ===== Verify ===== * ''0x4000850089'' is the expected value sudo rdmsr --all '0x1A0' ====== VGA Switcheroo Power States ====== * https://nouveau.freedesktop.org/wiki/Optimus sudo cat '/sys/kernel/debug/vgaswitcheroo/switch' ====== ACPI Tables ====== **** sudo strings '/sys/firmware/acpi/tables/DSDT' | grep -i 'windows ' | sort ===== Old Method ===== * Provides more information as to what certain ''_OSI'' values do and how they compare * In ''dsdt.dsl'', look for ''_OSI'' values, along with ''Windows'' and ''Linux'' sudo dnf install 'acpica-tools' sudo cp --force '/sys/firmware/acpi/tables/DSDT' ~/'dsdt.dat' cd ~ && iasl -d ~/'dsdt.dat' gio open ~/'dsdt.dsl' sudo dnf remove 'acpica-tools' && sync ====== Display EDID Info ====== * https://unix.stackexchange.com/a/114398 sudo dnf install 'monitor-edid' monitor-edid ====== Custom Resolutions ====== ===== Generate Modeline ===== * Use ''--reduced'' only for LCD/Non-CRT displays, and only as-needed ((useful for reducing amount of bandwidth over cables, particularly in-case of unstable 4k@60Hz set-ups)) * Syntax is ''horizontal'' (width), ''vertical'' (height) and ''refresh rate'' cvt '3840' '2160' '60' cvt --reduced '3840' '2160' '60' --reduced ===== Temporarily Apply ===== * Changes are lost after reboot * Values after ''--newmode'' are from the above generate command, and is everything after ''Modeline'' xrandr --newmode "3840x2160R" 533.00 3840 3888 3920 4000 2160 2163 2168 2222 +hsync -vsync xrandr --addmode 'HDMI-A-0' '3840x2160R' xrandr --output 'HDMI-A-0' --mode '3840x2160R' ===== Verify ===== **** xrandr --verbose | grep *current ===== Permanently Apply ===== * ''Identifier'' is the name of the port on the GPU the display is connected to * ''Modeline'' is from the above generate command, including the text ''Modeline'' * ''PreferredMode'' is the custom resolution name generated Section "Monitor" Identifier "HDMI-A-0" Modeline x Option "PreferredMode" "3840x2160R" EndSection ====== Backlight ====== * See [[notes:backlight]] ====== HT/SMT Information ====== **** grep -e "processor" -e "core id" -e "^$" /proc/cpuinfo ====== Optimal GCC compiler flags ====== **** gcc -v -E -x c -march=native -mtune=native - < /dev/null 2>&1 | grep cc1 | perl -pe 's/ -mno-\S+//g; s/^.* - //g;' ====== Privacy ====== ===== Clear Terminal History ===== **** history -cw ===== Create 7z Password Archive ===== * Change ''7ZIPNAME'' in ''7ZIPNAME.7z'' to the desired archive name * Change ''PASS'' in ''-pPASS'' to the desired password * Change ''x'' to the file or folder to add to the archive 7za a '7ZIPNAME.7z' -p'PASS' 'x' 7za a 'x.7z' -p'x' 'x' ===== oathtool ===== * ''x'' is a secret without ''&digits=6'' sudo apt install 'oathtool' sudo dnf install 'oathtool' oathtool --totp -b 'x' ===== Remove EXIF data ===== sudo apt install 'libimage-exiftool-perl' sudo dnf install 'perl-Image-ExifTool' exiftool -all= *.* -overwrite_original