Table of Contents

Linux

System & Diagnostics

Logs

Common system logs:

/var/log/syslog

View recent entries:

tail -f /var/log/syslog

List recently modified log files:

ls -lt /var/log

Notes:

  • tail -f follows logs in real time
  • On systemd systems, journalctl is often preferred

System information

General overview:

inxi -F

Distribution:

lsb_release -d

Kernel:

uname -snrm

Flags:

CPU:

lscpu
cat /proc/cpuinfo

Memory:

free -h

Mounted filesystems:

df -h

Kernel modules:

lsmod

Bash history:

history

Diagnostics

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

Storage & Filesystems

Mounting

List mounts:

findmnt

List disks:

lsblk

Mount:

sudo mkdir -p /media/DRIVE
sudo mount /dev/sdX# /media/DRIVE

Unmount:

sudo umount /media/DRIVE

Samba

Manage service:

sudo systemctl start smbd
sudo systemctl stop smbd
sudo systemctl restart smbd

Mount/Repair NTFS

If an NTFS volume mounts as read-only, it is usually due to an unclean shutdown or filesystem inconsistency.

Attempt repair:

sudo ntfsfix /dev/sdX#

Then remount:

sudo mount -t ntfs3 /dev/sdX# /mnt/ntfs

Create mount point if needed:

sudo mkdir -p /mnt/ntfs

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

Repair FAT32 filesystem errors

If a FAT32 filesystem mounts as read-only, it is often due to detected corruption.

Check kernel logs:

dmesg

Typical errors:

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

Repair the filesystem:

sudo umount /dev/sdX#
sudo fsck.vfat -a -w /dev/sdX#

Note: Ensure the correct device is targeted before running fsck.

File & Data Operations

Shell toolbox

File operations

Mass renaming

Uppercase .JPG to lowercase .jpg

for i in *.JPG; do mv "$i" "${i/.JPG/.jpg}"; done

Alternative (rename tool):

rename 's/\.JPG$/.jpg/' *.JPG

Empty a file

: > /path/to/file

Text processing

cut

Extract part of a string:

date | cut -c17-24

Archives

tar

# Extract
tar -xvf file.tar
tar -xvzf file.tar.gz
 
# Create
tar -cvf file.tar /path/folder
tar -cvzf file.tar.gz /path/folder

Flags:


User Environment

PATH

PATH is the environment variable containing a list of directories searched for executables.

# 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

Local installs of binaries and PATH

Install locations

Common locations for manually installed binaries:

/opt/                 # bundled applications
/usr/local/bin/      # system-wide manual installs
~/.local/bin/        # user-only installs (recommended)
/home/USER/opt/      # alternative user-only location

FHS Reference

Add to PATH

Add to ~/.profile or ~/.bashrc:

export PATH="/path/to/bin:$PATH"

Apply without logout:

source ~/.profile

Note: PATH must point to the directory, not the binary itself.

Locate a binary

type man
# man is /usr/bin/man

AppImages

Run an AppImage:

chmod +x example.AppImage
./example.AppImage

Some support automatic install:

./example.AppImage --install

Manual extraction:

./your.AppImage --appimage-extract

Tools

Add application to Cinnamon menu

Launch menu editor:

cinnamon-menu-editor

Manual method

User-level entries:

~/.local/share/applications/

Place or create a .desktop file in this directory.

Example minimal file:

[Desktop Entry]
Name=My App
Exec=/path/to/executable
Type=Application
Terminal=false

The entry should appear automatically in the menu.

Note: Avoid using /usr/share/applications/ unless a system-wide install is required.


GRUB

Config file:

/etc/default/grub

Line for background image:

GRUB_BACKGROUND=/path/to/image.jpg

Limit CPU usage

Using cpulimit:

cpulimit -P /path/to/executable -l 40 -b

Fonts install

System-wide:

sudo cp -r /path/to/fonts /usr/share/fonts/
sudo fc-cache -f -v

User-only:

~/.local/share/fonts/

Then refresh cache:

$ sudo fc-cache -f -v

PDF manipulation

Reorder / split / merge

CLI:

pdf-stapler cat in.pdf 2-3 out.pdf

GUI (recommended):

Reducing PDF size

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

-dPDFSETTINGS presets:

Note: Ghostscript rewrites the PDF.

It often reduces file size, especially with image-heavy PDFs, but this is not guaranteed.

Video playback (minimal UI)

Lightweight video player with minimal UI, suitable for clean output on external displays.

Example:

mpv --fs --no-border --ontop --geometry=+3200 --osd-level=0 video.mp4

Common options:

--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

Configuration file:

~/.config/mpv/mpv.conf

mplayer (legacy)

Legacy setup kept for reference.

Configuration files:

Example options:

fs=yes
noborder=yes
ontop=yes
geometry=+3200
osdlevel=0

Specialized & Recovery

Data recovery

Use TestDisk / PhotoRec as a first recovery tool.

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:

[X] mov/mdat Recover mdat atom as a separate file

Sort recovered files by name, then try concatenating matching parts:

cat f123_ftyp.mov f456_mdat.mov > recovered_1.mov
cat f456_mdat.mov f123_ftyp.mov > recovered_2.mov

One order may produce a usable file.

Sometimes the header/container part may be .mp4 while the media data part is .mov:

cat f54114560.mp4 f51781632_mdat.mov > recovered.mov

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

sudo apt install sg3-utils

Identify device

Usually appears as /dev/sr0:

lsblk

Send activation command

sudo sg_raw /dev/sr0 EA 00 00 00 00 00 01

The drive should become usable immediately after.

Note: This command must be reissued after reconnecting the drive.

QCAD (plugin location)

NOTE : MOVE TO BOTTOM 'MISC' SECTION AFTER REWRITE

To locate the QCAD plugin directory:

Go to:

Click on any plugin name to reveal its file location.

Note: Useful for locating and removing plugins related to trial limitations.

Screen recording

Lightweight alternatives

Notes

Samba

List available shares

smbclient -L //host -U username

Access a share (temporary mount)

sudo mount -t cifs //host/share /mnt/share -o username=user

Create mount point if needed:

sudo mkdir -p /mnt/share

GUI mounts (file manager)

When mounting via a file manager (Nautilus, Nemo, etc.), shares are typically mounted under:

/run/user/UID/gvfs/

Notes

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

Alias

Create an alias:

alias name='command'

Example:

alias ll='ls -lah'

Aliases are active for the current session only.

To make them persistent, add them to:

~/.bashrc

Reload configuration:

source ~/.bashrc
# or
. ~/.bashrc

Manage aliases

List aliases:

alias

Remove an alias:

unalias name

Mouse button mapping

X11 method (xbindkeys)

Install tools:

sudo apt install xbindkeys xvkbd

Identify button codes:

xev | grep button

Create configuration:

touch ~/.xbindkeysrc

Example:

# Send Enter on mouse button 8
"xvkbd -text '\r'"
b:8

Start xbindkeys:

xbindkeys

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

Package management

Fix broken packages

sudo dpkg --configure -a
sudo apt --fix-broken install

Additional Ressources