Merry Christmas & Happy 2027! Less downtime. More good times. Celebrating 13 years of sorlavit.com
Skip to content
Sorlavit KimIT Support, Network & Infrastructure Services Let’s talk

Articles are written in English. The Thai translation button opens Google Translate; code and commands stay in their original form.

Linux Commands / IT Support Guides

Identify an unknown Linux file with file

Use file to check what a Linux file appears to contain before choosing how to open it.

Compiled for Sorlavit Kim · Published · Updated · 1 min read

Environment and inputs: Linux · Bash-compatible shell; package and service names vary by distribution

Understand the problem

Start with the actual file you received. Keep the original file so you can compare it with a fresh export if needed.

Run the command

Replace /tmp/support-sample with the path to the file you want to inspect. Put the path in quotes if it contains spaces. The -- marks the end of options.

file -- /tmp/support-sample

Read the output

An output such as support-sample: ASCII text means file detected plain text. If it reports gzip compressed data, use a tool that can read gzip. An output of data means it did not identify a more specific type.

Choose the next step

Compare the reported type with the format you expected. If the command cannot open the file, check the path and your read permissions.

Before making changes

The reported type helps you choose a viewer. Treat an unexpected attachment as untrusted and avoid executing it.

Source & further reading

Linux manual — file

Independently written summary reviewed on 2026-11-01. The example illustrates a possible application; it is not a client case study.

Share this article

Back to all articles