6. file
Lesson Content
In the previous lesson we learned about touch, let’s go back to that for a bit. Did you notice that the filename didn’t conform to standard naming like you’ve probably seen with other operating systems like Windows? Normally you would expect a file called banana.jpeg and expect a JPEG picture file.
In Linux, filenames aren’t required to represent the contents of the file. You can create a file called funny.gif that isn’t actually a GIF.
To find out what kind of file a file is, you can use the file command. It will show you a description of the file’s contents.
$ file banana.jpg
Exercise
Run the file command on a few different directories and files and note the output.
Quiz Question
# What command can you use to find the file type of a file?
> .file type may be of human-readable(e.g. ‘ASCII text’) or MIME type(e.g. ‘text/plain; charset=us-ascii’).
1. [ ] type
2. [ ] cd
3. [ ] touch
4. [x] file