Skip to main content

Questions tagged [file-command]

file - determine file type.

Filter by
Sorted by
Tagged with
6 votes
1 answer
2k views

Consider this scenario: $ file a b c a: empty b: cannot open `b' (No such file or directory) c: cannot open `c' (No such file or directory) $ file b/c b/c: cannot open `b/c' (No such file or ...
pmor's user avatar
  • 757
2 votes
1 answer
619 views

The file -b <path> command seems useful for scripting (filtering file types, not necessarily by extension). But for that you have to know the actual string output for your target filetype(s) If ...
Jonathan Levin's user avatar
16 votes
3 answers
5k views

Why does file xxx.src lead to cannot open `xxx.src' (No such file or directory) but has an exit status of 0 (success)? $ file xxx.src ; echo $? xxx.src: cannot open `xxx.src' (No such file or ...
pmor's user avatar
  • 757
14 votes
2 answers
1k views

I have a number of files (Jupyter notebooks, .ipynb) which are text files. All of these contain some LaTeX markup. But when I run file, I get: $ file nb_* nb_1.ipynb: ASCII text nb_2....
cheersmate's user avatar
0 votes
0 answers
234 views

A year ago I've used a more advanced version of file, I think this was on a Debian based linux and it was in their main repository. Compared to file, it would show some more information such as if ...
Isa's user avatar
  • 151
17 votes
2 answers
4k views

Consider the shared object dependencies of /bin/bash, which includes /lib64/ld-linux-x86-64.so.2 (dynamic linker/loader): ldd /bin/bash linux-vdso.so.1 (0x00007fffd0887000) libtinfo.so.6 =>...
Shuzheng's user avatar
  • 5,009
0 votes
1 answer
483 views

I'm using cx-Freeze to freeze a PyQt5 application. On my Jenkins slave running OSX 10.13, when cx-Freeze is using the file command to check the type of the files, it classifies a .pyc file (python ...
MindObjects223's user avatar
3 votes
0 answers
655 views

I'm trying to understand the output of the file command when used on an INI-file. I create a file like this ("DOS" line endings are crucial, otherwise it is recognized as an ascii text file) ;Trying ...
johnny's user avatar
  • 2,051
28 votes
6 answers
134k views

I know I can find files using find: find . -type f -name 'sunrise'. Example result: ./sunrise ./events/sunrise ./astronomy/sunrise ./schedule/sunrise I also know that I can determine the file type of ...
Flux's user avatar
  • 3,318
0 votes
1 answer
726 views

When I try to create a C/C++ source file touch test.cpp Usually it will generate a file which type is C source code file. But today I got a plain text file. And I write a simple program in it like: #...
pangbryant's user avatar
2 votes
1 answer
162 views

I used the file command on a c# source file, and linux thought it was a c++ file. What is the reason for this?
J. Czekaj's user avatar
0 votes
5 answers
510 views

So I have a directory where I wish to open the only file in that directory that is human readable. I use file * to print the type of each file, and one file shows as ASCII-text. How can I redirect ...
firedrillsergeant's user avatar
4 votes
1 answer
2k views

I would like to write the format of a drawing with "file drawing" Files start like: CAD A1 mm (Blank after A1) or: CAD A00 m (Blank after "m") I tried somethings like in the file magic: 0 ...
Horst's user avatar
  • 43
1 vote
1 answer
180 views

The file command (Debian Jessie) in does not recognize some Perl modules. For example: /usr/share/perl5/XML/SAX.pm (from libxml-sax-perl) gives: $ file /usr/share/perl5/XML/SAX.pm /usr/share/perl5/...
Wybo Dekker's user avatar
1 vote
1 answer
973 views

I am getting different output while using file command in AIX vs Linux. File contents : D|P_APAC_PH_PHINGTF00240_20150731031225|APAC|PH|NN (L) SPEK DYWIDENDOWYCH RYNKÓW WSCHODZCYCH||4|20130308|PHN|...
GAURAV MAHAJAN's user avatar
1 vote
2 answers
505 views

I'm trying to use /usr/bin/file to detect file types in a program but also would like it to report if the file does not exist. However the command always returns exit status 0. Besides grepping the ...
chakrit's user avatar
  • 111
1 vote
2 answers
4k views

I performed a file-command on all elements in my Desktop directory: ~/Desktop > file * then I grepped all the lines who have the string "image" in the description: ~/Desktop > file * | grep "...
Abdul Al Hazred's user avatar
4 votes
1 answer
330 views

The man pages of the file command/libmagic are talking about a datatype called "ID3 length". The only explanation i found was: A 32-bit ID3 length So what is this for a type ? Is it related to the ...
SleepProgger's user avatar
1 vote
1 answer
362 views

I am currently writing a parser for the libmagic database (used by the file command) and i don't found any information on the 'use' and 'clear' type (second column in the magic file). Can someone ...
SleepProgger's user avatar
8 votes
2 answers
926 views

I'm running file against a wallet.dat file (A file that Bitcoin keeps its private keys in) and even though there doesn't seem to be any identifiable header or string, file can still tell that it's a ...
Nick ODell's user avatar
  • 2,818
8 votes
5 answers
21k views

I am writing a menu based bash script, one of the menu options is to send an email with a text file attachment. I am having trouble with checking if my file is a text file. Here is what I have: ...
Powea's user avatar
  • 83
3 votes
2 answers
4k views

I have been trying to list files in directory using ls and passing it different options. Does it have the ability to list types of files as well ? I want to know which ones are executable , ...
Ahmed's user avatar
  • 227
4 votes
3 answers
8k views

I am searching for a method to find only JPEG files/ With my limited knowledge of Linux I came to this point: list all paths that exist from root below with find / pipe the result into next command ...
Abdul Al Hazred's user avatar
9 votes
2 answers
7k views

Why doesn't the following return text/csv? $ echo 'foo,bar\nbaz,quux' > temp.csv;file -b --mime temp.csv text/plain; charset=us-ascii I used this example for extra clarity but I'm also ...
Jason Swett's user avatar
1 vote
3 answers
4k views

There is a bash command file(1) which outputs a file's contents type according to the matching pattern definitions in the /etc/magic and /usr/share/misc/magic. Is there a way to use these pattern ...
user avatar
6 votes
1 answer
26k views

I want to do a loop for all the images in a directory. The images doesn't have extension so I have to read the first bytes of the image to know its type. The loop should end up being something like. ...
user avatar
1 vote
1 answer
13k views

I am trying to make a check to see if the file being attached to the email is a text file, and if it is not it returns an error. However during testing, I provide a valid text.txt and it returns the "...
Duncan's user avatar
  • 33
10 votes
2 answers
4k views

I have an image archive I keep up. Sometimes, the sites I pull them from reformat the file while keeping the extension the same, most often making PNG images into JPG's that are still named ".png". ...
Aescula's user avatar
  • 363
7 votes
1 answer
498 views

My question follows that one: file(1) and magic(5) : describing other formats . I want to describe a FASTA sequence ( http://en.wikipedia.org/wiki/FASTA_format) It could be a DNA sequence (with only ...
Pierre's user avatar
  • 1,793
8 votes
3 answers
2k views

Can I use file and magic ( http://linux.die.net/man/5/magic ) to override the description of some other known formats ? for example, I would like to describe the following formats: BED: http://...
Pierre's user avatar
  • 1,793
1 vote
2 answers
3k views

Please let me know if below two statements are correct or not: Folder /usr/share/mime/magic has a database/table that will give me what are the current possible file formats (outputs that I can get ...
user2543622's user avatar
22 votes
4 answers
35k views

I need to recognize type of data contained in random files. I am new to Linux. I am planning to use the file command to understand what type of data a file has. I tried that command and got the ...
user2543622's user avatar
3 votes
2 answers
524 views

This is a followup to Normal looking text file, detected by file as ASCII Pascal program text It seems file can't be trusted all the time. It seems possible that a particular file may be detected ...
user13107's user avatar
  • 5,405
20 votes
2 answers
4k views

I was reading about the file command and I came across something I don't quite understand: file is designed to determine the kind of file being queried.... file accomplishes this by performing ...
Abdennour TOUMI's user avatar
1 vote
2 answers
2k views

I need to define mime type of various video files and I got a problem with .m2ts files. Before I stumbled on this, I used file utility with -iL keys and parsed the output with sed. Today I found that ...
tijagi's user avatar
  • 982
14 votes
2 answers
852 views

While I'm reading file(1) I noticed this in the man page (emphasis mine): When adding local definitions to /etc/magic, make sure to preserve these keywords. Users depend on knowing that all the ...
yegle's user avatar
  • 1,219
10 votes
3 answers
9k views

I am looking for a way to determine file types in a folder with thousands of files. File names do not reveal much and have no extension, but are different types. Specifically, I am trying to determine ...
dmars's user avatar
  • 113
2 votes
1 answer
3k views

I have a folder (the iPhone Backup) with various files without a suffix. I want to run a batch process over these files, which detects each file's file-type (with the help of the magic-file database (...
porg's user avatar
  • 674
5 votes
2 answers
2k views

Sometimes it seems that the standard file command (5.04 on my Ubuntu system) is not sophisticated enough (or I am just using it wrong, which could well be). For example when I run it on an .exe file, ...
maxschlepzig's user avatar
  • 59.7k
4 votes
2 answers
5k views

Searching, googling, I could not find any information about file types recognized by file. For example, an *.mp4 file is identified as "ISO Media" (while being able to play with VLC normally). This ...
Alois Mahdal's user avatar
  • 4,598
6 votes
1 answer
364 views

What could cause file(1) command to output application/msword application/msword (yes, twice in a row) as the mime type for some of the .doc files? Normally it prints just application/msword. If run ...
alex's user avatar
  • 7,523
3 votes
1 answer
430 views

I would like to create a file that just contains a binary number. I think that touch can be used to create an empty file, but is there any way I can fill it with a binary number e.g. 10 (ten)? And how ...
Jonas's user avatar
  • 1,613
6 votes
5 answers
13k views

I have a list of files and I need to find all the image-files from that list. For example, if my list contained the following: pidgin.tar.gz photo01.jpg picture01 screenshot.gif invoice.pdf Then I ...
Stefan's user avatar
  • 26.1k