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 [2021/02/10 12:49] – [Debug & Logs] mhlinux:start [2026/07/02 21:26] (current) – [File operations] mh
Line 1: Line 1:
 ====== Linux ====== ====== Linux ======
  
-  -[[linux:RBS|Razer Blade Stealth in Linux]] +  -**[[linux:bash|Bash]]** 
-  -[[linux:lampp|LAMPP local server]] +  -**[[linux:git|Git basics]]** 
-  -[[linux:git|Git basics]] +  -**[[linux:eGPU|Razer Core eGPU]]** 
-  -[[linux:bash|Bash]] +  -**[[linux:RBS|Razer Blade Stealth in Linux]]**
-  -[[linux:sed|sed]]+
  
-===== PATH ===== +====== System & Diagnostics ======
-<WRAP round info> +
-PATH is the //environment variable// containing a set of directories that should be searched for programs +
-</WRAP> +
-<code bash> +
-#print user PATH +
-$ printenv PATH +
-/bin:/sbin:/usr/bin:/usr/sbin +
-$ echo "$PATH" +
-/bin:/sbin:/usr/bin:/usr/sbin+
  
-#How it works +===== Logs =====
-$ ping 127.0.0.1+
  
-    PATH=/bin:/sbin:/usr/bin:/usr/sbin +Common system logs:
-           │     │ +
-           │     ╰──▶ /sbin/ping ?  found! +
-           ╰──▶ /bin/ping ?  not found.+
  
-#Add a folder to path for current shell session +<code> 
-$ PATH=$PATH:/path/to/app/folder+/var/log/syslog
 </code> </code>
  
-==== Local installs of binaries and PATH correction ====+View recent entries:
  
-=== Install the binary ===+<code bash> 
 +tail -f /var/log/syslog 
 +</code>
  
-There is debate as to where binaries that you install yourself should be put in the filesystem. The proper places to put them seem to be :+List recently modified log files:
  
-<code> +<code bash
-/opt/ <for bundled applications, typically grabbed from a software developper +ls -lt /var/log
-/usr/local/ <- for applications built by the administrator for local use, i.e. using "make" or other +
-/home/USER/opt/ <- for single-user use only+
 </code> </code>
-[[http://refspecs.linuxfoundation.org/fhs.shtml|FHS Reference]] 
-=== Add it to the user's PATH === 
  
-Include the following line in /home/USER/.profile :+<WRAP info> 
 +**Notes:** 
 + 
 +  * ''tail -f'' follows logs in real time 
 +  * On systemd systems, ''journalctl'' is often preferred 
 +</WRAP> 
 + 
 +===== System information ===== 
 + 
 +=== General overview===
  
 <code bash> <code bash>
-EXPORT PATH="/path/to/bin/folder:$PATH"+inxi -F
 </code> </code>
  
-This will only be active **after logging out**. If you want to activate it without logging out for a current shell session run the following command :+=== Distribution===
  
 <code bash> <code bash>
-$ source /home/USER/.profile+lsb_release -d
 </code> </code>
  
-//Note that the path must point to the **folder containing** the binary and not to the binary itself.//+=== Kernel: === 
 + 
 +<code bash> 
 +uname -snrm 
 +</code> 
 + 
 +Flags: 
 + 
 +  *''s'': kernel name 
 +  *''n'': network node hostname 
 +  *''r'': kernel relase number 
 +  *''m'': machine hardware name
  
-=== Add it to cinnammon start menu === 
  
-Cinnammon has implemented a handy GUI Editor you can access by right-clicking the 'Menu' icon and selecting 'configure'. You can also launch :+=== CPU===
  
 <code bash> <code bash>
-$ cinnamon-menu-editor+lscpu 
 +cat /proc/cpuinfo
 </code> </code>
  
-Using bash you can create a symbolic link to a .desktop file anywhere on your system and place that link in /usr/share/applications+=== Memory: ===
  
 <code bash> <code bash>
-$ ln -s path/to/target/file.desktop LINK_NAME+free -h
 </code> </code>
  
-Make sure the .desktop file has proper permissions :+=== Mounted filesystems===
  
 <code bash> <code bash>
-$ chmod 644 path/to/file.desktop +df -h
 </code> </code>
  
-The menu entry will appear after logging out.+=== Kernel modules: ===
  
-=== Locate a binary ===+<code bash> 
 +lsmod 
 +</code> 
 + 
 +=== Bash history: ===
  
 <code bash> <code bash>
-$ type man +history
-man is /usr/bin/man+
 </code> </code>
 +
 ---- ----
  
-===== AppImages =====+===== Diagnostics =====
  
-Extract the content of an AppImage :+<code bash> 
 +uptime              # load average 
 +dmesg -T | tail     # recent kernel messages 
 +vmstat 1            # system performance 
 +mpstat -P ALL 1     # CPU usage per core 
 +pidstat             # process statistics 
 +free -h             # memory usage 
 +</code>
  
-./your.AppImage --appimage-extract 
  
-This is useful if you want to get the Icon.+====== Storage & Filesystems ======
  
-[[https://github.com/AppImage/AppImageKit/releases|Link to AppImage Daemon]] //This Daemon scans well known places for appimages and creates menu entries and extracts icons// +===== Mounting =====
-----+
  
-===== Grub =====+=== List mounts: ===
  
-Config file is located at ''/etc/default/grub''+<code bash> 
 +findmnt 
 +</code>
  
-The line for a splash image is ''GRUB_BACKGROUND=/path/to/image.jpg''+=== List disks: === 
 + 
 +<code bash> 
 +lsblk 
 +</code> 
 + 
 +=== Mount: === 
 + 
 +<code bash> 
 +sudo mkdir -p /media/DRIVE 
 +sudo mount /dev/sdX# /media/DRIVE 
 +</code> 
 + 
 +=== Unmount: === 
 + 
 +<code bash> 
 +sudo umount /media/DRIVE 
 +</code>
  
 ---- ----
-===== Limit CPU usage ===== 
  
-There are various ways to limit the CPU usage of a process. One simple way is using ''cpulimit''+==== Samba ==== 
 + 
 +Manage service:
  
 <code bash> <code bash>
-$ cpulimit -P /path/to/executable -l %CPU (e.g. 40) -b (background)+sudo systemctl start smbd 
 +sudo systemctl stop smbd 
 +sudo systemctl restart smbd
 </code> </code>
  
-[[https://linoxide.com/linux-how-to/limit-cpu-usage-processes-linux/|Ressource site]] 
 ---- ----
-===== Fonts install (bash) ===== 
  
-To quickly install folders containing many OpenType fonts (OTF) or TrueType fonts (TTF)copy to the following locations :+===== Mount/Repair NTFS ===== 
 + 
 +If an NTFS volume mounts as read-onlyit is usually due to an unclean shutdown or filesystem inconsistency. 
 + 
 +Attempt repair:
  
 <code bash> <code bash>
-sudo cp -r /path/to/OTF-folder /usr/share/fonts/opentype/ +sudo ntfsfix /dev/sdX#
-$ sudo cp -r /path/to/TTF-folder /usr/share/fonts/truetype/+
 </code> </code>
  
-Regenerate font cache :+Then remount:
  
 <code bash> <code bash>
-sudo fc-cache -f -v+sudo mount -t ntfs3 /dev/sdX# /mnt/ntfs
 </code> </code>
  
-**Note :** This will install fonts system-wide. To install for a single user only copy the files to :+Create mount point if needed:
  
-<code> +<code bash
-~/.fonts+sudo mkdir -p /mnt/ntfs 
-</code> +</code>
  
-and regenerate font cache.+<WRAP info> 
 +**Notes:**
  
-===== Manipulate pdf =====+  * ''ntfsfix'' performs basic repairs and clears the "dirty" flag 
 +  * Full repair should be done from Windows using ''chkdsk'' 
 +  * If the issue persists, ensure Windows Fast Startup is disabled 
 +</WRAP>
  
-==== Modifying page order ====+===== Repair FAT32 filesystem errors =====
  
-Use (<del>pdftk (ubuntu) </del> -> deprecated) or pdf-stapler (fedora) :+If a FAT32 filesystem mounts as read-only, it is often due to detected corruption. 
 + 
 +Check kernel logs:
  
-//For example to extract two pages out of a pdf// 
 <code bash> <code bash>
-$ pdf-stapler cat in.pdf 2-3 out.pdf+dmesg
 </code> </code>
-Old syntax with pdftk : <del>$ pdftk in.pdf cat 3-4 output out.pdf</del> 
  
-=== Ubuntu and derivatives ===+Typical errors:
  
-pdfshuffler is a front end for python-pyPdf and a great tool for merging or splitting pdf files with a GUI.+<code bash> 
 +FAT-fs (sdb1): error, corrupted directory (invalid entries) 
 +FAT-fs (sdb1): Filesystem has been set read-only 
 +FAT-fs (sdb1): error, invalid access to FAT 
 +</code>
  
-==== Reducing PDF size ==== +Repair the filesystem:
- +
-Found from [[https://askubuntu.com/questions/113544/how-can-i-reduce-the-file-size-of-a-scanned-pdf-file| +
-this answer]] on AskUbuntu :+
  
 <code bash> <code bash>
-gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf+sudo umount /dev/sdX# 
 +sudo fsck.vfat --/dev/sdX#
 </code> </code>
  
-''-dPDFSETTINGS'' can be the following : +  * ''-a'' automatically repair filesystem 
 +  * ''-w'' write changes to disk
  
-  *''/screen'' lower quality, smaller size(72 dpi) +Note: Ensure the correct device is targeted before running ''fsck''.
-  *''/ebook'' for better quality, but slightly larger pdfs. (150 dpi) +
-  *''/prepress'' output similar to Acrobat Distiller "Prepress Optimized" setting (300 dpi) +
-  *''/printer'' selects output similar to the Acrobat Distiller "Print Optimized" setting (300 dpi) +
-  *''/default'' selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file+
  
  
 +====== File & Data Operations ======
  
 +===== Shell toolbox =====
  
 +==== File operations ====
  
-===== Repair FAT32 FS errors =====+=== Mass renaming ===
  
-When FAT32 filesystems mount in read-only it's often related to corrupted filesystem.+__**Changing an extension:**__
  
-Run **dmesg** to check. If you see lines such as :+<code bash> 
 +for i in *.JPG; do mv "$i" "${i/.JPG/.jpg}"; done 
 +</code> 
 + 
 +__**Changing a prefix:**__
  
 <code bash> <code bash>
-[54259.098330] FAT-fs (sdb1): error, corrupted directory (invalid entries) +for i in "prefix"*.png; do 
-[54259.098338] FAT-fs (sdb1): Filesystem has been set read-only +  mv --- "$i" "${i/#prefix/another prefix}" 
-[54304.610623] FAT-fs (sdb1): error, corrupted directory (invalid entries) +done
-[54304.690012] FAT-fs (sdb1): error, invalid access to FAT (entry 0xf7d0f91e) +
-[54304.690213] FAT-fs (sdb1): error, invalid access to FAT (entry 0xff27ff23) +
-[54304.690314] FAT-fs (sdb1): error, invalid access to FAT (entry 0xff0dff13)+
 </code> </code>
  
-Run the following command :+  * ''"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> <code bash>
-$ sudo umount /dev/sdX# +rename 's/\.JPG$/.jpg/' *.JPG
-sudo fsck.msdos -aw /dev/sdX#+
 </code> </code>
  
-//[[https://serverfault.com/questions/331779/how-do-i-debug-this-fs-error-on-a-flash-device?newreg=6fb41732994749cc8d802f6233af86ea|Stack Exchange thread on the subject]]// +  * 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. 
 +  * 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''.
  
-===== Data Recovery ===== +----
-Try [[https://www.cgsecurity.org/wiki/TestDisk_Download|Test Disk & PhotoRec]] written by Christophe Grenier+
  
-=== For .mov === +=== Empty a file === 
-//PhotoRec 7.1-WIP// + 
-In FileOptsMenu check : +<code bash
-<code> +: > /path/to/file
-[X] mov/mdat Recover mdat atom as a separate file+
 </code> </code>
-Two files are created for every .mov recovered. Concatenate with :  + 
-<code> +---- 
-cat f123_ftyp.mov f456_mdat.mov > 1.mov + 
-cat f456_mdat.mov f123_ftyp.mov > 2.mov+==== Text processing ==== 
 + 
 +=== cut === 
 + 
 +Extract part of a string: 
 + 
 +<code bash
 +date | cut -c17-24
 </code> </code>
-One of the two files will be goodSometimes one file is .mp4 and the other is .mov : + 
-<code> +---- 
-cat f54114560.mp4 f51781632_mdat.mov > 1.mov+ 
 +==== 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> </code>
  
 +Flags:
  
 +  * ''c'' create archive
 +  * ''x'' extract archive
 +  * ''v'' verbose (list files processed)
 +  * ''f'' specify archive file
 +  * ''z'' gzip compression
  
-===== Mount NTFS =====+----
  
-If NTFS volume mounts in read-only, remount using :+====== User Environment ====== 
 + 
 +===== PATH ===== 
 +<WRAP round info> 
 +PATH is the //environment variable// containing list of directories searched for executables. 
 +</WRAP>
  
 <code bash> <code bash>
-$ su +# Print PATH 
-$ mkdir /mnt/ntfs +printenv PATH 
-mount -t ntfs /dev/sd[X] /mnt/ntfs +echo "$PATH"
-</code>+
  
 +# Example resolution
 +ping 127.0.0.1
  
-===== mplayer =====+PATH=/bin:/sbin:/usr/bin:/usr/sbin 
 +       │     │ 
 +       │     └── /sbin/ping ? found 
 +       └── /bin/ping ? not found
  
-==== Configuration Files ==== +# Add a folder to PATH (current session only) 
-=== Global ===+PATH=$PATH:/path/to/app/folder 
 +</code>
  
-  */etc/mplayer/mplayer.conf +==== Local installs of binaries and PATH ====
  
-=== Local ===+=== Install locations ===
  
-  *~/.mplayer/config +Common locations for manually installed binaries:
-  *~/.mplayer/input.conf +
-  *~/.mplayer/menu.conf +
  
-==== Common Options ==== 
 <code> <code>
-fs=yes #enable fullscreen +/opt/                 bundled applications 
-noborder=yes +/usr/local/bin/      # system-wide manual installs 
-ontop=yes +~/.local/bin/        # user-only installs (recommended) 
-geometry=+3200 +/home/USER/opt/      # alternative user-only location
-osdlevel=0+
 </code> </code>
-===== Using Apple USB SuperDrive ===== 
  
-=== Required packages === +[[http://refspecs.linuxfoundation.org/fhs.shtml|FHS Reference]] 
-<code> + 
-sg3-utils+=== Add to PATH === 
 + 
 +Add to ''~/.profile'' or ''~/.bashrc'': 
 + 
 +<code bash
 +export PATH="/path/to/bin:$PATH"
 </code> </code>
  
-=== Find USB Drive === +Apply without logout: 
-(usually sr0 or sr1)+
 <code bash> <code bash>
-$ ls /dev | grep 'dvd'+source ~/.profile
 </code> </code>
  
-=== Send activation byte sequence === +Note: PATH must point to the **directory**, not the binary itself. 
-(change sr0 accordingly if needed)+ 
 +=== Locate a binary === 
 <code bash> <code bash>
-$ sg_raw /dev/sr0 EA 00 00 00 00 00 01+type man 
 +# man is /usr/bin/man
 </code> </code>
  
-===== QCAD Tutorial removal =====+----
  
-This is not specifically linux-related but since every time I install it (especially on MacOS systems) it's such a pain to find the plugins/ folder from where to remove the plugins blocking the trial version of QCAD here's an easy way to find them :+===== AppImages =====
  
-Go to Help > About > Plugins and just click on the name of one of the plugins.+Run an AppImage:
  
-In MacOS it will be QCAD About > Plugins instead+<code bash> 
 +chmod +x example.AppImage 
 +./example.AppImage 
 +</code>
  
-===== LAMPP Local Server =====+Some support automatic install:
  
-Start stop the server using : +<code bash
-<code> +./example.AppImage --install
-sudo /opt/lampp/lampp start/stop+
 </code> </code>
  
-Put your sites and data in +Manual extraction: 
-<code> + 
-/opt/lampp/htdocs/example_site+<code bash
 +./your.AppImage --appimage-extract
 </code> </code>
  
-===== Fixes =====+=== Tools === 
 + 
 +  * AppImageLauncher → integrates AppImages into the system (recommended) 
 +  * AppImage Daemon → older alternative 
 + 
 +==== Add application to Cinnamon menu ==== 
 + 
 +Launch menu editor: 
 + 
 +<code bash> 
 +cinnamon-menu-editor 
 +</code> 
 + 
 +=== Manual method === 
 + 
 +User-level entries:
  
-==== Wired network doesn't work after suspend (does not work) ==== 
-Identify your wired interface card module. Realtek 8169 is known to have this issue with some kernels. 
 <code> <code>
-$ lsmod+~/.local/share/applications/
 </code> </code>
-Look for :+ 
 +Place or create a ''.desktop'' file in this directory. 
 + 
 +Example minimal file: 
 <code> <code>
-.... +[Desktop Entry] 
-hid                   118784  2 usbhid,hid_generic +Name=My App 
-ahci                   36864  4 +Exec=/path/to/executable 
-r8169                  86016  0 +Type=Application 
-libahci                32768  1 ahci +Terminal=false
-mii                    16384  1 r8169 +
-...+
 </code> </code>
-Edit (create if it doesn't exist) the file :+ 
 +The entry should appear automatically in the menu. 
 + 
 +<WRAP info> 
 +**Note:** Avoid using ''/usr/share/applications/'' unless a system-wide install is required. 
 +</WRAP> 
 + 
 + 
 +---- 
 + 
 +===== GRUB ===== 
 + 
 +Config file: 
 <code> <code>
-$nano /etc/pm/config.d/unload_modules+/etc/default/grub
 </code> </code>
-Append the following line :+ 
 +Line for background image: 
 <code> <code>
-SUSPEND_MODULES="$SUSPEND_MODULES r8169"+GRUB_BACKGROUND=/path/to/image.jpg
 </code> </code>
-Replace module name if necessary 
  
-//Note to self : Added "mii" module to the list, the fix didn't seem to hold after reboot. Mii seems to be using r8169 and is network-monitoring-related//+----
  
-===== Linux Screencast tools =====+===== Limit CPU usage =====
  
-  ***Kazam :** only one tried at the moment, produces OK files and you can select a specific region you want to capture +Using ''cpulimit'':
-  *gtk-recordmydesktop +
-  *vokoscreen +
-  *simplescreenrecorder +
-    *add-apt-repository ppa:maarten-baert/simplescreenrecorder+
  
-===== Open VPN =====+<code bash> 
 +cpulimit -P /path/to/executable -l 40 -b 
 +</code>
  
-=== Connecting a client to a remote server === +----
-//This requires a valid .ovpn file//+
  
 +===== Fonts install =====
  
-<code> +System-wide: 
-openvpn --config /path/to/file.ovpn+ 
 +<code bash
 +sudo cp -/path/to/fonts /usr/share/fonts/ 
 +sudo fc-cache -f -v
 </code> </code>
  
-[[https://www.linux.com/training-tutorials/configure-linux-clients-connect-openvpn-server/|Linux.com OpenVPN connection tutorial]]+User-only:
  
-=== Connecting to shared folders through openvpn === +<code> 
-//This requires the ip of the shared folders location//+~/.local/share/fonts/ 
 +</code>
  
-===== Samba tips =====+Then refresh cache:
  
-=== List available shares on a given host === 
-Replace host with the hostname or IP address of the server running samba shares 
 <code bash> <code bash>
-smbclient -L host+sudo fc-cache -f -v
 </code> </code>
  
-Output will be something like this  +----
-<code> +
- Sharename       Type      Comment +
- ---------       ----      ------- +
- home            Disk       +
- shares          Disk       +
- users           Disk       +
- IPC$            IPC       IPC Service ()+
  
-Reconnecting with SMB1 for workgroup listing.+===== PDF manipulation =====
  
- Server               Comment +==== Reorder / split / merge ====
- ---------            -------+
  
- Workgroup            Master +CLI: 
- ---------            ------- + 
- MY_WORK              CODE-CA04+<code bash> 
 +pdf-stapler cat in.pdf 2-3 out.pdf
 </code> </code>
  
-[[https://www.tldp.org/HOWTO/SMB-HOWTO-8.html|More ressources here]]+GUI (recommended):
  
-=== Locate mount points ===+  * pdfarranger → lightweight, modern, actively maintained 
 + 
 +==== Reducing PDF size ====
  
-Most of the time they are located at ''/run/user/##ID##/gvfs'' 
-===== Alias ===== 
-Create an alias using command  
 <code bash> <code bash>
-alias name='command'+gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
 </code> </code>
-The alias is only in place while the user session is active. To make it permanent, write it in the ''.bashrc'' file in the home directory of the user. ([[http://www.linfo.org/alias.html|more info]]) 
  
-You can reload the .bashrc file using :+''-dPDFSETTINGS'' presets: 
 + 
 +  * ''/screen'' low-resolution output, smallest file, lowest quality 
 +  * ''/ebook'' medium-resolution output, good size/quality compromise 
 +  * ''/printer'' print-oriented output, larger file, higher quality 
 +  * ''/prepress'' prepress-oriented output, larger file, higher quality 
 +  * ''/default'' general-purpose output, can produce larger files 
 + 
 +<WRAP info> 
 +**Note:** Ghostscript rewrites the PDF. 
 + 
 +It often reduces file size, especially with image-heavy PDFs, but this is not guaranteed. 
 +</WRAP> 
 + 
 +===== Video playback (minimal UI) ===== 
 + 
 +==== mpv (recommended) ==== 
 + 
 +Lightweight video player with minimal UI, suitable for clean output on external displays. 
 + 
 +Example:
  
 <code bash> <code bash>
-$ source ~/.bashrc +mpv --fs --no-border --ontop --geometry=+3200 --osd-level=0 video.mp4
-#or +
-$ . ~/.bashrc+
 </code> </code>
-===== Useful shell ===== 
  
-=== Mass renaming files ===+Common options:
  
-[[https://debian-administration.org/article/150/Easily_renaming_multiple_files.|Debian Admin guide to mass renaming]] +<code> 
-You can use for commands in the shell or use the 'rename' tool (written in perl). For example :+--fs            # fullscreen 
 +--no-border     # remove window decorations 
 +--ontop         # keep window above others 
 +--geometry=+X+Y # window position (multi-display setups) 
 +--osd-level=0   # disable on-screen display 
 +</code>
  
-<code bash+Configuration file: 
-skx@lappy:~$ ls + 
-a.JPG  b.JPG  c.JPG  d.JPG +<code> 
-skx@lappy:~$ for i in *.JPG; do mv "$i" "${i/.JPG}"; done +~/.config/mpv/mpv.conf
-skx@lappy:~$ ls +
-a.jpg  b.jpg  c.jpg  d.jpg+
 </code> </code>
 +
 ---- ----
  
-=== cut === +==== mplayer (legacy) ==== 
-Remove sections from input and output them+ 
 +Legacy setup kept for reference. 
 + 
 +Configuration files: 
 + 
 +  */etc/mplayer/mplayer.conf 
 +  *~/.mplayer/config 
 +  *~/.mplayer/input.conf 
 +  *~/.mplayer/menu.conf 
 + 
 +Example options: 
 + 
 +<code> 
 +fs=yes 
 +noborder=yes 
 +ontop=yes 
 +geometry=+3200 
 +osdlevel=0 
 +</code> 
 + 
 + 
 + 
 +====== Specialized & Recovery ====== 
 + 
 +===== 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> <code bash>
-$ date +cat f123_ftyp.mov f456_mdat.mov > recovered_1.mov 
-Thu 02 Jan 2020 08:20:10 PM CET +cat f456_mdat.mov f123_ftyp.mov > recovered_2.mov
-$ date | cut -c17-24 +
-08:21:02+
 </code> </code>
----- 
  
-=== Mount === +One order may produce a usable file. 
-Target disk+ 
 +Sometimes the header/container part may be ''.mp4'' while the media data part is ''.mov'': 
 <code bash> <code bash>
-$ sudo fdisk -l +cat f54114560.mp4 f51781632_mdat.mov > recovered.mov
-Disk /dev/sda +
-[...+
-Disk /dev/sdb +
-[...]+
 </code> </code>
-Create mount point+ 
 +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. 
 + 
 + 
 + 
 +===== Using Apple USB SuperDrive ===== 
 + 
 +The Apple USB SuperDrive requires a vendor-specific command to activate on non-Apple systems. 
 + 
 +=== Required package === 
 <code bash> <code bash>
-sudo mkdir /media/DRIVE+sudo apt install sg3-utils
 </code> </code>
-Mount device+ 
 +=== Identify device === 
 + 
 +Usually appears as ''/dev/sr0'': 
 <code bash> <code bash>
-$ sudo mount /dev/sda1 /media/DRIVE+lsblk
 </code> </code>
-Unmount+ 
 +=== Send activation command === 
 <code bash> <code bash>
-sudo umount /media/DRIVE+sudo sg_raw /dev/sr0 EA 00 00 00 00 00 01
 </code> </code>
-[[https://linuxconfig.org/howto-mount-usb-drive-in-linux|More info]] 
----- 
  
-=== pwd === +The drive should become usable immediately after. 
-Display Present Working Directory+ 
 +<WRAP info> 
 +**Note:** This command must be reissued after reconnecting the drive. 
 +</WRAP> 
 + 
 +===== QCAD (plugin location) ===== 
 + 
 +<WRAP center round alert 60%> 
 +NOTE : MOVE TO BOTTOM 'MISC' SECTION AFTER REWRITE 
 +</WRAP> 
 + 
 + 
 +To locate the QCAD plugin directory: 
 + 
 +Go to: 
 +  * Help > About > Plugins (Linux / Windows) 
 +  * QCAD > About > Plugins (macOS) 
 + 
 +Click on any plugin name to reveal its file location. 
 + 
 +<WRAP info> 
 +**Note:** Useful for locating and removing plugins related to trial limitations. 
 +</WRAP> 
 + 
 +===== Screen recording ===== 
 + 
 +==== Recommended ==== 
 + 
 +  * **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 
 + 
 +==== 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 
 + 
 +===== Samba ===== 
 + 
 +==== List available shares ====
  
 <code bash> <code bash>
-$ pwd +smbclient -L //host -U username
-/home/pi+
 </code> </code>
 +
 +  * ''host'' → hostname or IP of the server
 +  * prompts for password
 +
 ---- ----
  
-=== tar === +==== Access a share (temporary mount) ====
-Pack/Unpack tarball+
  
 <code bash> <code bash>
-#All the following commands are verbose (-v) +sudo mount -t cifs //host/share /mnt/share -o username=user 
-$ tar -xvf file.tar #Unpack tar +</code> 
-$ tar -xvzf file.tar.gz #Unpack compressed (gzip) tar + 
-$ tar -cvf file.tar /path/folder #Pack folder into file.tar archive +Create mount point if needed: 
-$ tar -cvzf file.tar /path/folder #Same as above with compression (gzip)+ 
 +<code bash> 
 +sudo mkdir -/mnt/share
 </code> </code>
  
-[[https://www.cyberciti.biz/faq/tar-extract-linux/|Extensive Guide]] 
 ---- ----
  
 +==== GUI mounts (file manager) ====
  
 +When mounting via a file manager (Nautilus, Nemo, etc.), shares are typically mounted under:
  
-===== List info =====+<code> 
 +/run/user/UID/gvfs/ 
 +</code>
  
-=== Display all information ===+---- 
 + 
 +==== 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> 
 + 
 +===== Alias ===== 
 + 
 +Create an alias:
  
 <code bash> <code bash>
-$ inxi -F+alias name='command'
 </code> </code>
-//Read the manual, inxi is a very powerful tool to quickly get an overview of a full hardware setup// 
  
-=== Distrib ===+Example: 
 <code bash> <code bash>
-$ lsb_release -d+alias ll='ls -lah'
 </code> </code>
  
-=== CPU === +Aliases are active for the current session only. 
-Basic + 
-<code bash+To make them persistent, add them to: 
-$ lscpu+ 
 +<code> 
 +~/.bashrc
 </code> </code>
-Detailed, core-specific information, output /proc/cpuinfo+ 
 +Reload configuration: 
 <code bash> <code bash>
-$ cat /proc/cpuinfo+source ~/.bashrc 
 +# or 
 +. ~/.bashrc
 </code> </code>
  
-=== Mounted devices ===+---- 
 + 
 +==== Manage aliases ==== 
 + 
 +List aliases: 
 <code bash> <code bash>
-$ df -h+alias
 </code> </code>
  
-=== Kernel ===+Remove an alias: 
 <code bash> <code bash>
-$ uname -snrm+unalias name
 </code> </code>
-  *s : kernel name 
-  *n : network node hostname 
-  *r : kernel relase number 
-  *m : machine hardware name 
  
-[[ http://www.tecmint.com/useful-linux-commands-for-system-administrators/]]+===== Mouse button mapping ===== 
 + 
 +==== X11 method (xbindkeys) ==== 
 + 
 +Install tools:
  
-=== Kernel modules === 
 <code bash> <code bash>
-$ lsmod+sudo apt install xbindkeys xvkbd
 </code> </code>
  
-=== Bash history ===+Identify button codes: 
 <code bash> <code bash>
-$ history+xev | grep button
 </code> </code>
  
-=== D-Bus/system bus history ===+Create configuration: 
 <code bash> <code bash>
-$ gdbus +touch ~/.xbindkeysrc
-$ g-feet //gui history+
 </code> </code>
  
 +Example:
  
-=== Motherboard information === +<code> 
-<code bash+# Send Enter on mouse button 8 
-$ sudo dmidecode | grep -A3 ‘^System Information’+"xvkbd -text '\r'" 
 +b:8
 </code> </code>
-//dmidecode spurns out a lot of information if you want to query your system// 
  
-=== Diagnostics & Tools ===+Start xbindkeys:
  
 <code bash> <code bash>
-$ uptime [load Average] +xbindkeys
-$ dmesg -T | tail [Kernel errors] +
-$ vmstat 1 [Virtual memory and detailed information] +
-$ mpstat -P ALL 1 [CPU state] +
-$ pidstat [processes] +
-$ free -m [memory] +
-$ atop [main overview]+
 </code> </code>
  
 +----
  
-===== Debug & Logs =====+<WRAP info> 
 +**Notes:**
  
-''/var/log/syslog''+  * Works on X11 sessions only 
 +  * Wayland sessions generally do not support this method 
 +  * ''xvkbd'' simulates keypresses; alternative tools may be preferred depending on use case 
 +</WRAP>
  
-Check in ''/var/log'' which file was last changed. Use :+ 
 + 
 + 
 + 
 +==== Package management ==== 
 + 
 +=== Fix broken packages ===
  
 <code bash> <code bash>
-$ls -lart //inverted sorted by time. Last entry is latest modified+sudo dpkg --configure -a 
 +sudo apt --fix-broken install
 </code> </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''
  
-===== Misc Ressources =====+  ***[[https://www.guruadvisor.net/en/software-saas/465-advanced-linux-troubleshooting-methods-and-tools-for-diagnostics-and-problem-identification|Advanced Linux Troubleshooting]]**
  
-  *[[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]]**
-  *[[https://www.guruadvisor.net/en/software-saas/465-advanced-linux-troubleshooting-methods-and-tools-for-diagnostics-and-problem-identification|Advanced Linux Troubleshooting]]+
  • linux/start.1612957769.txt.gz
  • Last modified: 2025/06/02 21:18
  • (external edit)