Skip to content

Commands

I love this cheatsheet Neil showed us on the first class: https://devhints.io/bash.

Checking the size of a folder

du -sh
ncdu

Checking the size of a git repository

git-sizer --verbose

Copy

# File
cp $file ~/Documents
#  Folder
cp -r $folder ~/Documents
# Content of a file into the clipboard
xclip -selection clipboard < $file

Convert a video.mkv in video.mp4

ffmpeg -i video.mkv -codec copy video.mp4

Compress a video and removing the sound

ffmpeg -i input_video.mp4 -vcodec libx264 -b:v 1000k -vf scale=-2:1080 -an output_video.mp4

Cut a video

ffmpeg -i input_video.mp4 -vcodec libx264 -b:v 1000k -an -ss 00:00:00 -t 00:00:10 output_video.mp4

Accelerate or deccelerate a video

ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" output.mp4

Turn a batch of images into a video

Rename files from 1.jpg to n.jpg
ls -v | cat -n | while read n f; do mv -n "$f" "$n.jpg"; done 
Create a video from these images (r = number of images by seconds
ffmpeg -r 5 -f image2 -s 840x560 -i %d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p video.mp4

Last update: May 31, 2022
Back to top