How-tos (Linux tips)




Multimedias - Conversions

Convert Wav to Flac

Convert all wav files to flac files in a folder

for i in *.wav; do ffmpeg -i "$i" "$i".flac ; done

Convert Flac to Mp3 files

for f in *.flac; do flac -cd "$f" | lame -b 320 - "${f%.*}".mp3; done

Convert HEIC to jpg files

sudo apt install libheif-examples
for file in *.HEIC; do heif-convert $file ${file/%.HEIC/.jpg}; done

Compress all mp4 videos in a folder

for i in *.mp4; do ffmpeg -i "$i" -vcodec libx265 -crf 28 "${i%.*}_compressed.mp4"; done

Pick a random file with Totem

totem "$(ls -R | shuf -n1)"

If Totem can't read some mkv or mp4 vidéo

After upgrading to Ubuntu 22.04 I had some issue to read some video files (Totem crash at startup, display the error “The specified movie could not be found” or open the video with a strange format. I did install the Intel non-free drivers to solve this issue:

sudo apt install intel-media-va-driver-non-free

Network

Download test

curl -4 -o /dev/null http://bouygues.testdebit.info/100M.iso

Upload test

curl -o /tmp/temp.iso https://bouygues.testdebit.info/100M.iso
curl -4 -o /dev/null -F "filecontent=@/tmp/temp.iso" http://bouygues.testdebit.info

Fstab

Install cifs/nfs

sudo apt install nfs-common
sudo apt install cifs-utils

Install DCP-7055W scan driver

Fail2ban

Get SSH banned IP

fail2ban-client status sshd

AirPlay

Installation of Airplay in Ubuntu 22.04 with Pulse Audio

sudo apt-get install paprefs pavucontrol pulseaudio-module-raop pulseaudio-module-zeroconf
cd /usr/lib
#On Ubuntu 22.04
ln -s /usr/lib/pulse-15.99.1+dfsg1/ /usr/lib/pulse-15.99
paprefs

HandBrake

sudo apt install libdvdnav4 libdvdread4 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libdvd-pkg
sudo dpkg-reconfigure libdvd-pkg
sudo apt install ubuntu-restricted-extras

Pi-hole

Upgrade

pihole -up

Files

Remove files recursively

# remove lrc files
find -type f -name "*.lrc" -delete
# remove .DS_Store files
find -type f -name ".DS_Store" -delete

Remove duplicate files

fdupes -rdN .

Nice projects

Vous aussi
participez au projet !