On this page I'm continously storing useful Linux (not only) commands collected for past decade :).

### Disk space ###
du -akd1 | sort -nr | head

### lsof ###
lsof /folder
lsof -p 1112
lsof -u user
lsof -i TCP:22
losf -i TCP@127.0.0.1

### netcat ###
nc -vz[4,6] <ip> <port1-port100>
nc -lk <ip> <port>
echo "hello" > /dev/tcp/<ip>/<port>

### Video convert (requires libavcodec-freeworld package) ###
ffmpeg -nostdin -i input.mov -acodec copy -vcodec libx264 -f mp4 -preset faster output.mp4
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -vf "scale=1920:-1" -preset faster -movflags +faststart -c:a aac -b:a 128k output.mp4

### Remove old naming of network cards (ethX) ###
grubby --update-kernel=ALL --remove-args="net.ifnames=0"
grub2-mkconfig -o /boot/grub2/grub.cfg
nmtui - edit connection and interface and reboot

### Netplan ###
netplan set ethernets.eeth0.dhcp4=true
netplan apply
netplan status

### sssd ###
systemctl stop sssd
sss_cache -E
sss_cache -u jsmith
rm -rf /var/lib/sss/db/*
systemctl start sssd

### yt-dlp ###
yt-dlp --windows-filenames -x -t mp3

### nmap ###
nmap -Pn --script vuln <IP>
nmap -A <IP>
nmap -n -sP 192.168.200.0/24 (ping subnet)

### RTSP ###
VLC -> open stream -> rtsp://192.168.200.1:554

### F42 nvidia driver with secure boot ###
1. Ensure there are no nvidia drivers present
dnf remove kmod-nvidia xorg-x11-drv-nvidia xorg-x11-drv-nvidia-cuda

2. Generate secureboot kernel module signing key pair
cat /usr/share/doc/akmods/README.secureboot

3. Reboot and enroll the key

4. Install nvidia drivers 
dnf install kmod-nvidia xorg-x11-drv-nvidia xorg-x11-drv-nvidia-cuda

5. Reboot

6. Test
lsmod | grep nvidia
nvidia-smi
systemctl status akmods.service

### QEMU/libvirt ###
## Extend Disk
qemu-img resize disk.qcow2 [+]10G
qemu-img info disk.qcow2

## DHCP
sudo virsh net-dhcp-leases default
13. 10. 2025 EN Linux