In Linux, file types are not recognized by file extensions. It is actually determined by the data in a file. The file extension doesn't even matter.
If you run file command on any file, three sets of tests, performed in this order: filesystem tests, magic number tests and language tests to determine the file type.
Go over the file command manual for more information:
Please help! I am preparing a Linux Script to move windows executable files from samba directory to quarantine directory. For safety, will use "file" command to determine if its executable. Anyone can help? Below is my trial script, but it just move everything, including non-executable.. any wrong... (2 Replies)
Hi
I compiled an executable on Solaris 10 which creates semaphore ( semget)
but it didn't work on solaris 9 , while it is executing sucessfully on solaris 10. It is throwing the system error that Invalid arguments ( system error 22) on solaris 9.
the ldd for the executable on two servers is as... (4 Replies)
Hi ,
Could you please guide me how to remove formatting (bold text) in a unix file?
vi editor showing like this...
^
Cat command showing like this...
tl21ss01
tl21ss02
tl21ss03 (6 Replies)
Hi All,
I just want to know how to get the executable name of the perl script as i know "$0" will give me the script name but i want to know the executable name which i got it from the script using pp command.
Regards
Raj (1 Reply)
Hi,
I want to check the incoming files whether the file is Mac file or dos/windows file in unix shell script.
Sometimes client is posting Mac file and sometimes it is dos file. Could you please help me how to determine/check whether the file is Mac or dos.
Help in advance
Thanks (4 Replies)
Dear Experts,
I am an ERP consultant and would like to learn shell script. We are working on Linux SUSE 11.4 and I am very new to shell scripting. We can manually encrypt an excel file using "executable jar" through command prompt by placing the jar file & the file to be encrypted on a physical... (1 Reply)
Dear all,
I download a .exe file in my current folder called: ukbmd5.exe. I was told to run the command below: ukbmd5 ukb25278.enc to verify the integrity of the files that you have downloaded and the program ukbmd5 has been made available to assist with decrpying ukb25278.enc.
while when I run... (1 Reply)
Discussion started by: forevertl
1 Replies
LEARN ABOUT HPUX
file
file(1) General Commands Manual file(1)NAME
file - determine file type
SYNOPSIS
mfile] ffile] file ...
UNIX 2003 (onwards) Synopsis
mfile] Mfile] ffile] file ...
DESCRIPTION
performs a series of tests on each file in an attempt to classify it. If file appears to be an ASCII file, examines the first 512 bytes
and tries to guess its language. If file is an executable file, prints the version stamp, provided it is greater than 0 (see the descrip-
tion of the option in ld(1)).
uses the file to identify files that have some sort of that is, any file containing a numeric or string constant that indicates its type.
Commentary at the beginning of explains the format.
Options
recognizes the following command-line options:
Use alternate magic file
mfile.
(UNIX 2003 onwards Only)
Use alternate magic file Mfile. Do not apply default context-sensitive tests.
Check the magic file for format errors.
This validation is not normally carried out for reasons of efficiency. No file classification is done when this option
is specified.
(UNIX 2003 onwards Only)
Apply position-sensitive tests from the default magic file, and default context-sensitive tests to the file.
Obtain the list of files to be examined from file
ffile. classifies each file whose name appears in ffile.
Do not follow symbolic links.
From UNIX 2003 (onwards) environment, if is not specified and the is a symbolic link referring to a non-existent file, it
is identified as a symbolic link, as if has been specified.
Do not attempt to classify a regular file further.
If the option is specified with the option, option, or both, the concatenation of the position-sensitive tests specified by these
options is applied in the order specified by the appearance of these options.
EXTERNAL INFLUENCES
For information about the UNIX standard environment, see standards(5).
Environment Variables
determines the language in which messages are displayed.
If is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty vari-
able. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of
If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See
environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported. However, all non-ASCII text files are identified as "data".
WARNINGS
The command for a release interprets the core files for that particular release correctly. Using the command on a core file generated on a
different release will report incorrect results.
SEE ALSO ld(1), standards(5).
STANDARDS CONFORMANCE file(1)