GNU Linux/Useful Commands

From Personal Wiki
Revision as of 03:54, 26 December 2024 by Root (talk | contribs) (Root moved page Useful Commands/GNU Linux to GNU Linux/Useful Commands without leaving a redirect)


File Conversion

Batch Convert Man Pages into HTML files

Requires the mandoc program to be installed.

mkdir html && for x in .; do mandoc -Thtml -O man=./html/%N.%S.html,toc $x > html/$x.html; done

Virtual Machines

I've found this to be more useful than guestmount (provided by the libguestfs-tools package for Ubuntu), because it does not require superuser privileges to execute, and is easy to unmount afterwards. Based on the answer provided on Super User: https://superuser.com/a/1548983.

mkdir -p ~/tmp/windows10-vm
nbdfuse ~/tmp/windows10-vm [ qemu-nbd path_to_disk_image ] &
fusermount -u ~/tmp/windows10-vm

NVIDIA

To workaround a bug where the frame rate drops for Mutter and other applications, when they are viewed on an external monitor, boost the memory clock speed with this command below. The two values after lmc are the minimum and maximum memory clock speeds in MHz.

sudo nvidia-smi -lmc 2000,6000

Making Changes to Windows Registry Hive Files

The Windows registry consists of keys and values, belonging to hives. These hives are stored under C:\Windows\system32\config

According to Microsoft's official documentation (https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry-hives), these are the root keys and the hive file names which they correspond to:

Registry hive Supporting files
HKEY_CURRENT_CONFIG System, System.alt, System.log, System.sav
HKEY_CURRENT_USER Ntuser.dat, Ntuser.dat.log
HKEY_LOCAL_MACHINE\SAM Sam, Sam.log, Sam.sav
HKEY_LOCAL_MACHINE\Security Security, Security.log, Security.sav
HKEY_LOCAL_MACHINE\Software Software, Software.log, Software.sav
HKEY_LOCAL_MACHINE\System System, System.alt, System.log, System.sav
HKEY_USERS\.DEFAULT Default, Default.log, Default.sav

WARNING: Make a backup copy of the hive file before editing it.

I find it useful to browse through sub-keys and values with hivexsh <path to hive> , then export a key from the hive file (using the file for HKEY_LOCAL_MACHINE\Software for example):

hivexregedit --export ./SOFTWARE Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer > explorer-policies.reg

hivexregedit --merge ./SOFTWARE ./explorer-policies.reg

I've left out the conversion of the exported registry file from Windows UTF-16 to UTF-8, and back again to UTF-16 before the merge, as I've found through testing that this isn't needed (with hivex version 1.3.23).