linux:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:start [2026/04/26 22:15] – [Repair FAT32 filesystem errors] mhlinux:start [2026/10/31 22:34] (current) – [claude] align eGPU link label with page title (Core X) claude
Line 3: Line 3:
   -**[[linux:bash|Bash]]**   -**[[linux:bash|Bash]]**
   -**[[linux:git|Git basics]]**   -**[[linux:git|Git basics]]**
-  -**[[linux:eGPU|Razer Core eGPU]]**+  -**[[linux:eGPU|Razer Core X eGPU]]**
   -**[[linux:RBS|Razer Blade Stealth in Linux]]**   -**[[linux:RBS|Razer Blade Stealth in Linux]]**
  
Line 19: Line 19:
  
 <code bash> <code bash>
-tail -f /var/log/syslog+tail -f /var/log/syslog   # if rsyslog is installed 
 +journalctl -f             # systemd journal (Fedora, Debian 12+)
 </code> </code>
  
Line 37: Line 38:
 ===== System information ===== ===== System information =====
  
-=== General overview: ===+=== General overview ===
  
 <code bash> <code bash>
Line 43: Line 44:
 </code> </code>
  
-=== Distribution: ===+=== Distribution ===
  
 <code bash> <code bash>
Line 49: Line 50:
 </code> </code>
  
-=== Kernel: ===+=== Kernel ===
  
 <code bash> <code bash>
Line 59: Line 60:
   *''s'': kernel name   *''s'': kernel name
   *''n'': network node hostname   *''n'': network node hostname
-  *''r'': kernel relase number+  *''r'': kernel release number
   *''m'': machine hardware name   *''m'': machine hardware name
  
  
-=== CPU: ===+=== CPU ===
  
 <code bash> <code bash>
Line 70: Line 71:
 </code> </code>
  
-=== Memory: ===+=== Memory ===
  
 <code bash> <code bash>
Line 76: Line 77:
 </code> </code>
  
-=== Mounted filesystems: ===+=== Mounted filesystems ===
  
 <code bash> <code bash>
Line 82: Line 83:
 </code> </code>
  
-=== Kernel modules: ===+=== Kernel modules ===
  
 <code bash> <code bash>
Line 88: Line 89:
 </code> </code>
  
-=== Bash history: ===+=== Bash history ===
  
 <code bash> <code bash>
Line 102: Line 103:
 dmesg -T | tail     # recent kernel messages dmesg -T | tail     # recent kernel messages
 vmstat 1            # system performance vmstat 1            # system performance
-mpstat -P ALL 1     # CPU usage per core +mpstat -P ALL 1     # CPU usage per core (package: sysstat) 
-pidstat             # process statistics+pidstat             # process statistics (package: sysstat)
 free -h             # memory usage free -h             # memory usage
 </code> </code>
Line 112: Line 113:
 ===== Mounting ===== ===== Mounting =====
  
-=== List mounts: ===+=== List mounts ===
  
 <code bash> <code bash>
Line 118: Line 119:
 </code> </code>
  
-=== List disks: ===+=== List disks ===
  
 <code bash> <code bash>
Line 124: Line 125:
 </code> </code>
  
-=== Mount: ===+=== Mount ===
  
 <code bash> <code bash>
Line 131: Line 132:
 </code> </code>
  
-=== Unmount: ===+=== Unmount ===
  
 <code bash> <code bash>
Line 139: Line 140:
 ---- ----
  
-==== Samba ====+===== Samba =====
  
-Manage service:+==== Manage service ====
  
 <code bash> <code bash>
Line 148: Line 149:
 sudo systemctl restart smbd sudo systemctl restart smbd
 </code> </code>
 +
 +----
 +
 +==== List available shares ====
 +
 +<code bash>
 +smbclient -L //host -U username
 +</code>
 +
 +  * ''host'' → hostname or IP of the server
 +  * prompts for password
 +
 +----
 +
 +==== Access a share (temporary mount) ====
 +
 +Create mount point if needed:
 +
 +<code bash>
 +sudo mkdir -p /mnt/share
 +</code>
 +
 +Then mount:
 +
 +<code bash>
 +sudo mount -t cifs //host/share /mnt/share -o username=user
 +</code>
 +
 +----
 +
 +==== GUI mounts (file manager) ====
 +
 +When mounting via a file manager (Nautilus, Nemo, etc.), shares are typically mounted under:
 +
 +<code>
 +/run/user/UID/gvfs/
 +</code>
 +
 +----
 +
 +==== Notes ====
 +
 +<WRAP info>
 +**Notes:**
 +
 +  * ''smbclient -L'' is useful for discovery and debugging access issues
 +  * ''mount -t cifs'' provides a standard way to mount shares in scripts or system configs
 +  * SMB1 is deprecated and may be disabled on modern systems
 +</WRAP>
  
 ---- ----
Line 161: Line 211:
 </code> </code>
  
-Then remount:+Create mount point if needed:
  
 <code bash> <code bash>
-sudo mount -t ntfs3 /dev/sdX# /mnt/ntfs+sudo mkdir -p /mnt/ntfs
 </code> </code>
  
-Create mount point if needed:+Then remount:
  
 <code bash> <code bash>
-sudo mkdir -p /mnt/ntfs+sudo mount -t ntfs3 /dev/sdX# /mnt/ntfs
 </code> </code>
  
Line 213: Line 263:
  
 ====== File & Data Operations ====== ====== File & Data Operations ======
 +
 +===== Shell toolbox =====
 +
 +==== File operations ====
 +
 +=== Mass renaming ===
 +
 +__**Changing an extension:**__
 +
 +<code bash>
 +for i in *.JPG; do mv "$i" "${i/.JPG/.jpg}"; done
 +</code>
 +
 +__**Changing a prefix:**__
 +
 +<code bash>
 +for i in "prefix"*.png; do
 +  mv -n -- "$i" "${i/#prefix/another prefix}"
 +done
 +</code>
 +
 +  * ''"prefix"*.png'' targets only files beginning with the selected prefix, so unrelated files in the folder are ignored.
 +  * ''${i/#prefix/another prefix}'' replaces only the prefix at the beginning of the filename. If the same text appears later in the filename, it is left untouched.
 +  * In Bash parameter expansion, the ''#'' before ''prefix'' means “match only at the start of the variable value”. Without ''#'', Bash would replace the first matching occurrence anywhere in the filename.
 +  * ''mv -n'' prevents overwriting an existing file if the renamed target already exists.
 +  * ''--'' tells ''mv'' that everything after it is a filename, not an option. This protects against unusual filenames starting with ''-''.
 +  * ''"$i"'' keeps the original filename safely quoted, so spaces and special characters in filenames are preserved.
 +
 +__**Alternative (rename tool):**__
 +
 +<code bash>
 +rename 's/\.JPG$/.jpg/' *.JPG
 +</code>
 +
 +  * Use the ''for ... done'' + ''mv -n --'' loop for safe, explicit prefix renaming.
 +  * Use ''rename'' for concise regex-based changes, especially extension changes such as ''.JPG'' to ''.jpg''.
 +  * On Linux Mint / Ubuntu, ''rename 's/\.JPG$/.jpg/' *.JPG'' usually works because the available ''rename'' is the Perl-style tool.
 +  * On Ubuntu / Mint the Perl-style ''rename'' is a separate package and is not always preinstalled: ''sudo apt install rename''.
 +  * The ''rename'' command is not fully portable across all Linux distributions, because different systems may ship different versions with different syntax.
 +  * For safety, preview first with ''rename -n 's/\.JPG$/.jpg/' *.JPG''.
 +
 +----
 +
 +=== Empty a file ===
 +
 +<code bash>
 +: > /path/to/file
 +</code>
 +
 +----
 +
 +==== Text processing ====
 +
 +=== cut ===
 +
 +Extract part of a string:
 +
 +<code bash>
 +date | cut -c17-24
 +</code>
 +
 +----
 +
 +==== Archives ====
 +
 +=== tar ===
 +
 +<code bash>
 +# Extract
 +tar -xvf file.tar
 +tar -xvzf file.tar.gz
 +
 +# Create
 +tar -cvf file.tar /path/folder
 +tar -cvzf file.tar.gz /path/folder
 +</code>
 +
 +Flags:
 +
 +  * ''c'' create archive
 +  * ''x'' extract archive
 +  * ''v'' verbose (list files processed)
 +  * ''f'' specify archive file
 +  * ''z'' gzip compression
 +
 +----
 +
 +====== User Environment ======
 +
 ===== PATH ===== ===== PATH =====
 <WRAP round info> <WRAP round info>
Line 248: Line 387:
 </code> </code>
  
-[[http://refspecs.linuxfoundation.org/fhs.shtml|FHS Reference]]+[[https://refspecs.linuxfoundation.org/fhs.shtml|FHS Reference]]
  
 === Add to PATH === === Add to PATH ===
Line 350: Line 489:
 <code> <code>
 GRUB_BACKGROUND=/path/to/image.jpg GRUB_BACKGROUND=/path/to/image.jpg
 +</code>
 +
 +Apply the change:
 +
 +<code bash>
 +# Ubuntu / Mint
 +sudo update-grub
 +
 +# Fedora
 +sudo grub2-mkconfig -o /boot/grub2/grub.cfg
 </code> </code>
  
Line 382: Line 531:
  
 <code bash> <code bash>
-$ sudo fc-cache -f -v+fc-cache -f -v
 </code> </code>
  
Line 420: Line 569:
 It often reduces file size, especially with image-heavy PDFs, but this is not guaranteed. It often reduces file size, especially with image-heavy PDFs, but this is not guaranteed.
 </WRAP> </WRAP>
- 
- 
- 
- 
-===== Data recovery ===== 
- 
-Use **TestDisk** / **PhotoRec** as a first recovery tool. 
- 
-  * **TestDisk** attempts partition repair and file undelete when filesystem metadata is still usable. 
-  * **PhotoRec** performs file carving by signature. It can recover files from damaged filesystems, but filenames and folder structure are usually lost. 
- 
-Do not write recovered files to the source disk. 
- 
-==== PhotoRec: recovered MOV files ==== 
- 
-For some recovered ''.mov'' files, PhotoRec may split the video into separate ''ftyp'' and ''mdat'' parts. 
- 
-In PhotoRec ''FileOpts'', enable: 
- 
-<code> 
-[X] mov/mdat Recover mdat atom as a separate file 
-</code> 
- 
-Sort recovered files by name, then try concatenating matching parts: 
- 
-<code bash> 
-cat f123_ftyp.mov f456_mdat.mov > recovered_1.mov 
-cat f456_mdat.mov f123_ftyp.mov > recovered_2.mov 
-</code> 
- 
-One order may produce a usable file. 
- 
-Sometimes the header/container part may be ''.mp4'' while the media data part is ''.mov'': 
- 
-<code bash> 
-cat f54114560.mp4 f51781632_mdat.mov > recovered.mov 
-</code> 
- 
-Note: This is a recovery attempt, not a guaranteed repair method. For valuable data, stop using the disk immediately and clone/image it before experimenting. 
- 
  
 ===== Video playback (minimal UI) ===== ===== Video playback (minimal UI) =====
Line 512: Line 621:
 </code> </code>
  
-===== Using Apple USB SuperDrive =====+===== Alias =====
  
-The Apple USB SuperDrive requires a vendor-specific command to activate on non-Apple systems.+Create an alias:
  
-=== Required package ===+<code bash> 
 +alias name='command' 
 +</code> 
 + 
 +Example:
  
 <code bash> <code bash>
-sudo apt install sg3-utils+alias ll='ls -lah'
 </code> </code>
  
-=== Identify device ===+Aliases are active for the current session only.
  
-Usually appears as ''/dev/sr0'':+To make them persistent, add them to:
  
-<code bash> +<code> 
-lsblk+~/.bashrc
 </code> </code>
  
-=== Send activation command ===+Reload configuration:
  
 <code bash> <code bash>
-sudo sg_raw /dev/sr0 EA 00 00 00 00 00 01+source ~/.bashrc 
 +# or 
 +. ~/.bashrc
 </code> </code>
  
-The drive should become usable immediately after.+----
  
-<WRAP info> +==== Manage aliases ====
-**Note:** This command must be reissued after reconnecting the drive. +
-</WRAP>+
  
-===== QCAD (plugin location) =====+List aliases:
  
-<WRAP center round alert 60%> +<code bash> 
-NOTE : MOVE TO BOTTOM 'MISC' SECTION AFTER REWRITE +alias 
-</WRAP>+</code>
  
 +Remove an alias:
  
-To locate the QCAD plugin directory:+<code bash> 
 +unalias name 
 +</code>
  
-Go to: +===== Package management =====
-  * Help > About > Plugins (Linux / Windows) +
-  * QCAD > About > Plugins (macOS)+
  
-Click on any plugin name to reveal its file location.+==== Fix broken packages ====
  
-<WRAP info> +__**Ubuntu / Mint (apt):**__
-**Note:** Useful for locating and removing plugins related to trial limitations. +
-</WRAP>+
  
-===== Screen recording =====+<code bash> 
 +sudo dpkg --configure -a 
 +sudo apt --fix-broken install 
 +</code>
  
-==== Recommended ====+__**Fedora (dnf):**__
  
-  * **OBS Studio** → full-featured, actively maintained, works for both simple and advanced recording+<code bash> 
 +sudo dnf distro-sync 
 +sudo rpm --rebuilddb 
 +</code>
  
-==== Lightweight alternatives ====+  * ''dnf distro-sync'' realigns installed packages with the repositories and resolves inconsistent dependencies 
 +  * ''rpm --rebuilddb'' rebuilds the RPM database if it is damaged
  
-  * simplescreenrecorder → lightweight, reliable on X11 
-  * vokoscreenNG → simple GUI, good for quick recordings 
  
-==== Notes ====+====== Specialized & Recovery ======
  
-  * Older tools such as Kazam or gtk-recordmydesktop are largely unmaintained and may not work reliably on modern systems +===== Data recovery =====
-  * Wayland sessions may require OBS or desktop-native recording tools+
  
-===== Samba =====+Use **TestDisk** / **PhotoRec** as a first recovery tool.
  
-==== List available shares ====+  * **TestDisk** attempts partition repair and file undelete when filesystem metadata is still usable. 
 +  * **PhotoRec** performs file carving by signature. It can recover files from damaged filesystems, but filenames and folder structure are usually lost.
  
-<code bash> +Do not write recovered files to the source disk.
-smbclient -L //host -U username +
-</code>+
  
-  * ''host'' → hostname or IP of the server +==== PhotoRec: recovered MOV files ====
-  * prompts for password+
  
-----+For some recovered ''.mov'' files, PhotoRec may split the video into separate ''ftyp'' and ''mdat'' parts.
  
-==== Access a share (temporary mount) ====+In PhotoRec ''FileOpts'', enable:
  
-<code bash> +<code> 
-sudo mount -t cifs //host/share /mnt/share -o username=user+[X] mov/mdat Recover mdat atom as a separate file
 </code> </code>
  
-Create mount point if needed:+Sort recovered files by name, then try concatenating matching parts:
  
 <code bash> <code bash>
-sudo mkdir -p /mnt/share+cat f123_ftyp.mov f456_mdat.mov > recovered_1.mov 
 +cat f456_mdat.mov f123_ftyp.mov > recovered_2.mov
 </code> </code>
  
-----+One order may produce a usable file.
  
-==== GUI mounts (file manager) ====+Sometimes the header/container part may be ''.mp4'' while the media data part is ''.mov'':
  
-When mounting via a file manager (Nautilus, Nemo, etc.), shares are typically mounted under: +<code bash> 
- +cat f54114560.mp4 f51781632_mdat.mov > recovered.mov
-<code> +
-/run/user/UID/gvfs/+
 </code> </code>
  
-----+Note: This is a recovery attempt, not a guaranteed repair method. For valuable data, stop using the disk immediately and clone/image it before experimenting.
  
-==== Notes ==== 
  
-<WRAP info> 
-**Notes:** 
  
-  * ''smbclient -L'' is useful for discovery and debugging access issues +===== Using Apple USB SuperDrive =====
-  * ''mount -t cifs'' provides a standard way to mount shares in scripts or system configs +
-  * SMB1 is deprecated and may be disabled on modern systems +
-</WRAP>+
  
-===== Alias =====+The Apple USB SuperDrive requires a vendor-specific command to activate on non-Apple systems.
  
-Create an alias:+=== Required package ===
  
 <code bash> <code bash>
-alias name='command'+sudo apt install sg3-utils
 </code> </code>
  
-Example:+=== Identify device === 
 + 
 +Usually appears as ''/dev/sr0'':
  
 <code bash> <code bash>
-alias ll='ls -lah'+lsblk
 </code> </code>
  
-Aliases are active for the current session only. +=== Send activation command ===
- +
-To make them persistent, add them to:+
  
-<code> +<code bash> 
-~/.bashrc+sudo sg_raw /dev/sr0 EA 00 00 00 00 00 01
 </code> </code>
  
-Reload configuration:+The drive should become usable immediately after.
  
-<code bash> +<WRAP info> 
-source ~/.bashrc +**Note:** This command must be reissued after reconnecting the drive. 
-# or +</WRAP>
-. ~/.bashrc +
-</code>+
  
-----+===== Additional Resources =====
  
-==== Manage aliases ====+  * [[https://en.wikipedia.org/wiki/Magic_SysRq_key#Configuration|SysRq Keys]] -- Best combo is ''Alt + SysRq + R E I S U B'' 
 +  * [[https://wiki.networksecuritytoolkit.org/nstwiki/index.php?title=HowTo_Create_A_GPT_Disk_With_EFI_System_And_exFAT_Partitions_Using_Parted|Creating GPT/exFAT partitions using CLI]]
  
-List aliases: 
  
-<code bash> +====== Misc / Desktop ======
-alias +
-</code>+
  
-Remove an alias:+===== Screen recording =====
  
-<code bash> +==== Recommended ==== 
-unalias name + 
-</code>+  * **OBS Studio** → full-featured, actively maintained, works for both simple and advanced recording 
 + 
 +==== Lightweight alternatives ==== 
 + 
 +  * simplescreenrecorder → lightweight, reliable on X11 
 +  * vokoscreenNG → simple GUI, good for quick recordings 
 +  * Spectacle → on Fedora (KDE Plasma), the native screenshot tool can also record video; nothing to install 
 + 
 +==== Notes ==== 
 + 
 +  * Older tools such as Kazam or gtk-recordmydesktop are largely unmaintained and may not work reliably on modern systems 
 +  * Wayland sessions may require OBS or desktop-native recording tools
  
 ===== Mouse button mapping ===== ===== Mouse button mapping =====
Line 716: Line 830:
 </WRAP> </WRAP>
  
-===== Shell toolbox =====+===== QCAD (plugin location) =====
  
-==== File operations ====+To locate the QCAD plugin directory:
  
-=== Mass renaming ===+Go to: 
 +  * Help > About > Plugins (Linux / Windows) 
 +  * QCAD > About > Plugins (macOS)
  
-Uppercase .JPG to lowercase .jpg+Click on any plugin name to reveal its file location.
  
-<code bash> +<WRAP info> 
-for i in *.JPG; do mv "$i" "${i/.JPG/.jpg}"; done +**Note:** Useful for locating and removing plugins related to trial limitations. 
-</code> +</WRAP>
- +
-Alternative (rename tool): +
- +
-<code bash> +
-rename 's/\.JPG$/.jpg/' *.JPG +
-</code> +
- +
----- +
- +
-=== Empty a file === +
- +
-<code bash> +
-: > /path/to/file +
-</code> +
- +
----- +
- +
-==== Text processing ==== +
- +
-=== cut === +
- +
-Extract part of a string: +
- +
-<code bash> +
-date | cut -c17-24 +
-</code> +
- +
----- +
- +
-==== Archives ==== +
- +
-=== tar === +
- +
-<code bash> +
-# Extract +
-tar -xvf file.tar +
-tar -xvzf file.tar.gz +
- +
-# Create +
-tar -cvf file.tar /path/folder +
-tar -cvzf file.tar.gz /path/folder +
-</code> +
- +
-Flags: +
- +
-  * ''c'' create archive +
-  * ''x'' extract archive +
-  * ''v'' verbose (list files processed) +
-  * ''f'' specify archive file +
-  * ''z'' gzip compression +
- +
----- +
- +
- +
- +
-==== Package management ==== +
- +
-=== Fix broken packages === +
- +
-<code bash> +
-sudo dpkg --configure -a +
-sudo apt --fix-broken install +
-</code> +
- +
----- +
- +
- +
- +
-===== Additional Ressources ===== +
- +
-  ***[[https://en.wikipedia.org/wiki/Magic_SysRq_key#Configuration|SysRq Keys]]** -- Best combo is ''Alt + SysRq + R E I S U B'' +
- +
-  ***[[https://www.guruadvisor.net/en/software-saas/465-advanced-linux-troubleshooting-methods-and-tools-for-diagnostics-and-problem-identification|Advanced Linux Troubleshooting]]** +
- +
-  ***[[https://wiki.networksecuritytoolkit.org/nstwiki/index.php?title=HowTo_Create_A_GPT_Disk_With_EFI_System_And_exFAT_Partitions_Using_Parted|Creating GPT/exFAT partitions using CLI]]**+
  • linux/start.1777234505.txt.gz
  • Last modified: 2026/04/26 22:15
  • by mh