home books search contact

***Secret FSR Fender guitars? Yes, they exist, and they're right here

As an Amazon Associate I earn from qualifying purchases. (What does this mean?)

Some of my favorite Linux Terminal commands


As I continue to use Linux, I'm learning stuff. And now you get to learn stuff too.

I'm an old fool from the old school. Before internet, the way to do stuff online was with a thing called the BBS. The vast majority of BBS operators and users did everything in MS-DOS.

In Windows - even now when I use Windows 11 - I still use the command line either at Command Prompt or PowerShell. But this is about Linux, so let's get into that.

These are some Terminal commands I've learned that have come in very useful.


Use: file name-of-file-here.ext

This identifies files for what they are, and this comes in handy more than just a little bit.

One of the better examples of this is identifying image types. Sometimes web sites will show images with a JPG extension when it's actually a PNG or vice versa.

For example, I took a screenshot of my desktop, saved as JPG, purposely renamed it to have a PNG extension, ran file on it, and it correctly identified it as a JPG.

Whenever I come across a file I think might have been some other extension before, I run file to check it out. This is mainly to ensure double-clicking on it from the GUI actually launches the right program for it.

Converting any audio or video format to another with ffmpeg

Use: ffmpeg -i name-of-file.ext new-file.ext

FFmpeg is not installed by default in Linux, at least not usually. In Ubuntu/Kubuntu/Xubuntu, this is how to install it:

sudo apt-get install ffmpeg

I will sometimes run across old file formats and use ffmpeg to convert them over.

Converting a PNG to JPG:

ffmpeg -i file.png file.jpg

Note: This doesn't delete the original file, so both file.png and file.jpg will be present; this is for any conversion.

Converting MOV to MP4:

ffmpeg -i file.mp4

Converting WMV to MKV:

ffmpeg -i file.wmv file.mkv

You get the idea.

I find this even works for absolutely ancient formats like RM, which is a RealMedia video format (remember RealPlayer?):

ffmpeg -i file.rm file.mp4


Use: zip file.ext

Creating a ZIP archive is stupidly easy in Linux. Just use the command above.

The only thing I can add is that if you're in a directory and you want every file zipped and all subdirectories, do this:

zip -r *

The above command literally means "Create ZIP archive-name-zip that includes all files in current directory, all subdirectories, and all files within subdirectories."

How to unzip?


Again, stupidly easy. And will it extract properly if subdirectories with files exists in the ZIP? Yes.

Splitting a file

As easy as it is to store giant files these days, I follow what I call The 4GB Rule for archiving stuff. If the archive exceeds 4GB, I'll split it up.

Why do I do this? File corruption can happen when transferring very large files, whether it's over the wire, wireless or directly to a memory card.

The two examples I'll show below purposely use a 4,092 megabyte split point because that's the biggest file that can be read on a FAT32 file system.

Using split:

split -b 4092M file.ext "file.ext.part" --verbose

This will split file.ext into file.ext.partaa, file.ext.partab and so on.

Combining the split parts back together is done with cat like this:

cat file.ext.parta* >file.ext

Using 7z:

If I were creating an archive of many files, 7z is the best way to go about it.

I navigate to the directory where I want everything in it (subdirectories and all) into an archive, and use this:

7z a archive-name.7z -v4092m *

This will create archive-name.7z.001, archive-name.7z.002 and so on until finished.

Extracting the archive would be handled by placing the files in an empty directory and using this:

7z x archive-name.7z.001

7-Zip needs somewhere to start, so the .001 file is used. The software is smart enough to know to look for .002, .003 and so on and go through them all until extraction is finished.

I'll note that yes, zip can technically do the split archive thing, but you'll have a much easier time working with 7z split archives.

NETSTAT equivalent

The ss command is what to use, like this:

sudo ss -ltpn

That literally means "display listening sockets, display only TCP sockets, show process using socket, don't resolve service names".

It's a quick way to get a NETSTAT-like report.

What's that Tetris game shown at top?

It's called vitetris, a Tetris-like game you can play directly within in the terminal.

Sometimes you need fun stuff in Terminal, because why not.

Published 2023 Aug 1

Best ZOOM R8 tutorial book
highly rated, get recording quick!

Other things to check out