18 February 2026

How to sort by time the result of the $ find command?

$ find . -iname "applied*" -type f -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort -r

$ find . -iname "applied*" -type f -printf '%T+ %p\n' | sort -r

11 February 2026

In vim, how to make the first letter of every word into uppercase?

https://dev.to/gokayburuc/vim-regex-tricks-capitalize-every-first-letter-526j

To capitalize the first letter of each word in a sentence, use the following Vim command:

:s/\<\w/\u&/g

Explanation of the Command

  • :s/ starts the substitution command in Vim, which is used to find a pattern and replace it with a specified value.
  • \< matches the beginning of a word. In Vim, a word is defined as a sequence of letters, digits, or underscores.
  • \w matches any word character (letters, digits, or underscores).
  • \u is a replacement flag in Vim that converts the next character in the replacement string to uppercase.
  • & represents the entire matched text from the search pattern (in this case, the first character of each word).
  • /g applies the substitution globally, ensuring every matching occurrence in the line is processed rather than just the first one.

By running this command, Vim will capitalize the first letter of each word in the specified text.

 

 

 

01 February 2026

How to crop a video on Ubuntu?

ffmpeg -i input.mp4 -vf "crop=1200:626:279:89" -c:v libx264 -crf 20 -c:a copy output.mp4


To crop a video on Ubuntu, you use FFmpeg’s
crop filter. Cropping is different from resizing; it’s like taking a pair of scissors to the video frame to cut out a specific area (like removing a watermark or focusing on a specific person).

The logic for cropping is: crop=width:height:x:y


1. The Basic Crop Command

If you know the exact dimensions you want to keep, use this:

Bash
ffmpeg -i input.mp4 -vf "crop=1280:720:0:0" -c:a copy output_cropped.mp4
  • 1280: The width of the "box" you want to keep.

  • 720: The height of the "box" you want to keep.

  • 0: The X coordinate (distance from the left edge) where the box starts.

  • 0: The Y coordinate (distance from the top edge) where the box starts.


2. Common "Real World" Examples

To crop a square from the center (great for social media):

Bash
ffmpeg -i input.mp4 -vf "crop=ih:ih" -c:a copy output_square.mp4

(Note: ih stands for "Input Height." This tells FFmpeg to make the width equal to the height.)

To cut the video in half (keep only the right side):

Bash
ffmpeg -i input.mp4 -vf "crop=iw/2:ih:iw/2:0" -c:a copy output_right_half.mp4

3. How to find your coordinates (The Easy Way)

Trying to guess "X" and "Y" coordinates in a terminal is hard. Here is a trick to do it visually:

  1. Open your video in VLC.

  2. Go to Tools > Effects and Filters.

  3. Go to Video Effects > Crop.

  4. Type in numbers until the video looks exactly how you want it.

  5. Write down those numbers (Left, Right, Top, Bottom) and use them in this FFmpeg command:

Bash
# If you found: Left=100, Top=50, Width=800, Height=600
ffmpeg -i input.mp4 -vf "crop=800:600:100:50" -c:a copy output_cropped.mp4

Important Tips:

  • Re-encoding: Because you are changing the actual picture, FFmpeg has to re-encode the video. I didn't include quality flags above to keep it simple, but for the best result, add -crf 20: ffmpeg -i input.mp4 -vf "crop=w:h:x:y" -c:v libx264 -crf 20 -c:a copy output.mp4

  • Even Numbers: Just like before, H.264 (MP4) loves even numbers. If you get an error, make sure your width and height are divisible by 2.


How to convert a .webm video into a .mp4 one?

ffmpeg -i output_trimmed.webm -c:v libx264 -crf 23 -preset medium -c:a aac output.mp4

How to trim a video on Ubuntu?

ffmpeg -i toAi.webm -ss 02:42 -to 05:59 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output_trimmed.webm