Learn to find a file's type at the Linux command line.
Linux file command summary with examples (3:54)
Videos can also be accessed from the YouTube Playlist.
Our seventeenth word, or command to memorize is
file from the category Files.
file allows you to display a file's
Recall from our video (tutorial) #11 we saw how the
type command showed
a command's type? Now we're interested in displaying a file's type,
meaning is it text, or a binary like an excutable, or an image file.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
file command has
25 options and the argument is the file,
or list of files to test.
As with many commands, a double-dash
--help option is available.
The details here get complicated, so at this point, I'll just mention
-f option allows you to
input multiple filenames at once.
So why is
file an important command?
file helps you get organized,
and could help prevent you from running executables you know nothing
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go, let's start by locating the
file command, with
There it is in
/usr/bin. So let's
file by typing
Replay that if it helps. Ok, we see it's an executable, and other technical details we shouldn't be concerned with right now.
Next, let's compare that output to the file from the previous
Empty. And then video11.txt?
That's an ASCII text file, very good.
And last, let's look at a configuration file like
.bashrc as well.
Text as well. Excellent.
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
The user manual here, (
man file) while
advanced, does make for interesting reading. With coffee of course.
Okay, thanks for visiting today. I hope this was a fun introduction
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
The only way we can compete with the big corporations and offer better tutorials is with your support. Subscribe here.
touchcommand, hit Back.
whichcommand, click Next.