Show pageOld revisionsBacklinksFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Linux ====== -**[[linux:bash|Bash]]** -**[[linux:git|Git basics]]** -**[[linux:eGPU|Razer Core eGPU]]** -**[[linux:RBS|Razer Blade Stealth in Linux]]** ====== System & Diagnostics ====== ===== Logs ===== Common system logs: <code> /var/log/syslog </code> View recent entries: <code bash> tail -f /var/log/syslog </code> List recently modified log files: <code bash> ls -lt /var/log </code> <WRAP info> **Notes:** * ''tail -f'' follows logs in real time * On systemd systems, ''journalctl'' is often preferred </WRAP> ===== System information ===== === General overview: === <code bash> inxi -F </code> === Distribution: === <code bash> lsb_release -d </code> === Kernel: === <code bash> uname -snrm </code> Flags: *''s'': kernel name *''n'': network node hostname *''r'': kernel relase number *''m'': machine hardware name === CPU: === <code bash> lscpu cat /proc/cpuinfo </code> === Memory: === <code bash> free -h </code> === Mounted filesystems: === <code bash> df -h </code> === Kernel modules: === <code bash> lsmod </code> === Bash history: === <code bash> history </code> ---- ===== Diagnostics ===== <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> ====== Storage & Filesystems ====== ===== Mounting ===== === List mounts: === <code bash> findmnt </code> === 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> ---- ==== Samba ==== Manage service: <code bash> sudo systemctl start smbd sudo systemctl stop smbd sudo systemctl restart smbd </code> ---- ===== Mount/Repair NTFS ===== If an NTFS volume mounts as read-only, it is usually due to an unclean shutdown or filesystem inconsistency. Attempt repair: <code bash> sudo ntfsfix /dev/sdX# </code> Then remount: <code bash> sudo mount -t ntfs3 /dev/sdX# /mnt/ntfs </code> Create mount point if needed: <code bash> sudo mkdir -p /mnt/ntfs </code> <WRAP info> **Notes:** * ''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> ===== Repair FAT32 filesystem errors ===== If a FAT32 filesystem mounts as read-only, it is often due to detected corruption. Check kernel logs: <code bash> dmesg </code> Typical errors: <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> Repair the filesystem: <code bash> sudo umount /dev/sdX# sudo fsck.vfat -a -w /dev/sdX# </code> * ''-a'' automatically repair filesystem * ''-w'' write changes to disk Note: Ensure the correct device is targeted before running ''fsck''. ====== File & Data Operations ====== ===== Shell toolbox ===== ==== File operations ==== === Mass renaming === Uppercase .JPG to lowercase .jpg <code bash> for i in *.JPG; do mv "$i" "${i/.JPG/.jpg}"; done </code> 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 ---- ====== User Environment ====== ===== PATH ===== <WRAP round info> PATH is the //environment variable// containing a list of directories searched for executables. </WRAP> <code bash> # Print PATH printenv PATH echo "$PATH" # Example resolution ping 127.0.0.1 PATH=/bin:/sbin:/usr/bin:/usr/sbin │ │ │ └── /sbin/ping ? found └── /bin/ping ? not found # Add a folder to PATH (current session only) PATH=$PATH:/path/to/app/folder </code> ==== Local installs of binaries and PATH ==== === Install locations === Common locations for manually installed binaries: <code> /opt/ # bundled applications /usr/local/bin/ # system-wide manual installs ~/.local/bin/ # user-only installs (recommended) /home/USER/opt/ # alternative user-only location </code> [[http://refspecs.linuxfoundation.org/fhs.shtml|FHS Reference]] === Add to PATH === Add to ''~/.profile'' or ''~/.bashrc'': <code bash> export PATH="/path/to/bin:$PATH" </code> Apply without logout: <code bash> source ~/.profile </code> Note: PATH must point to the **directory**, not the binary itself. === Locate a binary === <code bash> type man # man is /usr/bin/man </code> ---- ===== AppImages ===== Run an AppImage: <code bash> chmod +x example.AppImage ./example.AppImage </code> Some support automatic install: <code bash> ./example.AppImage --install </code> Manual extraction: <code bash> ./your.AppImage --appimage-extract </code> === 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: <code> ~/.local/share/applications/ </code> Place or create a ''.desktop'' file in this directory. Example minimal file: <code> [Desktop Entry] Name=My App Exec=/path/to/executable Type=Application Terminal=false </code> 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> /etc/default/grub </code> Line for background image: <code> GRUB_BACKGROUND=/path/to/image.jpg </code> ---- ===== Limit CPU usage ===== Using ''cpulimit'': <code bash> cpulimit -P /path/to/executable -l 40 -b </code> ---- ===== Fonts install ===== System-wide: <code bash> sudo cp -r /path/to/fonts /usr/share/fonts/ sudo fc-cache -f -v </code> User-only: <code> ~/.local/share/fonts/ </code> Then refresh cache: <code bash> $ sudo fc-cache -f -v </code> ---- ===== PDF manipulation ===== ==== Reorder / split / merge ==== CLI: <code bash> pdf-stapler cat in.pdf 2-3 out.pdf </code> GUI (recommended): * pdfarranger → lightweight, modern, actively maintained ==== Reducing PDF size ==== <code bash> gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf </code> ''-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> mpv --fs --no-border --ontop --geometry=+3200 --osd-level=0 video.mp4 </code> Common options: <code> --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> Configuration file: <code> ~/.config/mpv/mpv.conf </code> ---- ==== mplayer (legacy) ==== 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> 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. ===== Using Apple USB SuperDrive ===== The Apple USB SuperDrive requires a vendor-specific command to activate on non-Apple systems. === Required package === <code bash> sudo apt install sg3-utils </code> === Identify device === Usually appears as ''/dev/sr0'': <code bash> lsblk </code> === Send activation command === <code bash> sudo sg_raw /dev/sr0 EA 00 00 00 00 00 01 </code> The drive should become usable immediately after. <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> smbclient -L //host -U username </code> * ''host'' → hostname or IP of the server * prompts for password ---- ==== Access a share (temporary mount) ==== <code bash> sudo mount -t cifs //host/share /mnt/share -o username=user </code> Create mount point if needed: <code bash> sudo mkdir -p /mnt/share </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> ===== Alias ===== Create an alias: <code bash> alias name='command' </code> Example: <code bash> alias ll='ls -lah' </code> Aliases are active for the current session only. To make them persistent, add them to: <code> ~/.bashrc </code> Reload configuration: <code bash> source ~/.bashrc # or . ~/.bashrc </code> ---- ==== Manage aliases ==== List aliases: <code bash> alias </code> Remove an alias: <code bash> unalias name </code> ===== Mouse button mapping ===== ==== X11 method (xbindkeys) ==== Install tools: <code bash> sudo apt install xbindkeys xvkbd </code> Identify button codes: <code bash> xev | grep button </code> Create configuration: <code bash> touch ~/.xbindkeysrc </code> Example: <code> # Send Enter on mouse button 8 "xvkbd -text '\r'" b:8 </code> Start xbindkeys: <code bash> xbindkeys </code> ---- <WRAP info> **Notes:** * 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> ==== 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.txt Last modified: 2026/04/26 22:17by mh