Published using Google Docs
Transcript: File Command
Updated automatically every 5 minutes

BYU-Idaho Online Learning

Video Transcript

File Command

Paul: Welcome to Linux Essentials covering your first 100 commands and today we'll demonstrate the file command. I'm Paul, and here's the plan: First, the command and why you need it; second, we'll play around in our terminal window; and third, we'll return for a quick tip and then we're done. Okay, we know Linux is the backbone of the Internet and is used by statisticians and postdocs. At FactorPad, we use Linux for fun stuff like data analysis. So Linux is great, but it requires that you memorize commands just like words in a language, and our 17th word or command to memorize is "file" from our category, "files."

[Slide switches from the title page to a slide containing information on the file command. It displays the term definition, commands, options, and arguments.]

File allows you to display a file's type. Recall from Video 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 executable, or an image file? Before we start, it helps to think of commands as mini programs, and most follow this structure: command, options, and arguments. The file command has 25 options, and the argument is the file or a list of files to test. As with many commands, a double dash help option is available. And the details here can get complicated, so at this point, I'll just mention that one other option, dash F, allows you to input multiple file names at once. So, why is file an important command? Well, file helps you get organized and could help prevent you from running executables you know nothing about. And now, you know how to do that. Oh, a quick word on navigation: This button goes to the playlist. Back one video, forward one video, and click here for updates.

[Paul’s cursor shows us the back and forward buttons at the bottom right corner. These buttons are used to get to different videos. He also shows us the house icon which will lead you to the updates.]

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 Console. And currently, Microsoft is adding this functionality to Windows.

[The slide switches to the terminal slide where you will write code.] 

Here we go. Let's start by locating the file command with "where is file." There it is, in slash user slash bin. So let's use file on file by typing "file slash user slash bin slash file." Replay that. if it helps. Okay. 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 video, 16 dot TXT using file, video 16 dot TXT—Hmm. Empty. And then video 11 dot TXT, that's an ASCII text file. Very good. And last, let's look at a configuration file like dot bash RC—Text as well. Excellent. And as always, exit closes the terminal window.

[Paul returns to the slide with information about the file command.]

 Okay, now you know how to use file and you know the syntax for commands, options, and arguments. One last tip about the file command: The user manual here, while advanced, does make for interesting reading. With coffee, of course. Oh, and thanks for visiting today. I hope this was a fun introduction to the file command.

[End of video.]