Determining a file type with file
It is useful to know what files contain in Linux system. To do this, we will use the file
command to determine a file's type. Filenames in Linux are not required to reflect a file's contents. While a filename like "picture.jpg" would normally be expected to contain a JPEG compressed image, it is not required to in Linux. We can invoke the file
command to see a brief description of the file's contents.
The file
syntax is:
file filename
For example:
$ file picture.jpg picture.jpg: JPEG image data, JFIF standard 1.01
In Linux, everything is a file. There are many kinds of files. While many of the files on your system are familiar, for example MP3 and JPEG, there are many kinds that are a little less obvious and a few that are quite strange.
There are many ways to display the contents of files, the most widely used are cat
, more
, less
, head
and tail
. Here is a short tutorial about them.
Latest Post
- Dependency injection
- Directives and Pipes
- Data binding
- HTTP Get vs. Post
- Node.js is everywhere
- MongoDB root user
- Combine JavaScript and CSS
- Inline Small JavaScript and CSS
- Minify JavaScript and CSS
- Defer Parsing of JavaScript
- Prefer Async Script Loading
- Components, Bootstrap and DOM
- What is HEAD in git?
- Show the changes in Git.
- What is AngularJS 2?
- Confidence Interval for a Population Mean
- Accuracy vs. Precision
- Sampling Distribution
- Working with the Normal Distribution
- Standardized score - Z score
- Percentile
- Evaluating the Normal Distribution
- What is Nodejs? Advantages and disadvantage?
- How do I debug Nodejs applications?
- Sync directory search using fs.readdirSync