Quick Command Line Tips and Tricks

The command line allows us to do lots of things with just a little bit on input.

Here’s a command that cuts a sub-clip out of a larger one using ffmpeg:

ffmpeg -i /directory/original_file.mp4 -c copy -ss 00:01:23 -to 00:04:20 /directory/destination_file.mp4

And here’s one that combines multiple .csv files into one large one (assuming all columns have the same headers in the same order):

awk 'FNR==1 && NR!=1{next;}{print}' *.csv > output.csv

I’ve had a little text file with that awk trick for so long I can’t remember which StackOverflow or blog post it came from.

What are some of your favorite tricks?