Sponsored Content
Top Forums UNIX for Dummies Questions & Answers What are the executable file formats in Solaris and Linux? Post 302785379 by Yoda on Monday 25th of March 2013 01:29:11 PM
Old 03-25-2013
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:
Code:
man file

 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Linux Script to move executable to quarantine

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)
Discussion started by: gavintam
2 Replies

2. Solaris

Executable compiled on solaris 10 not working on solaris 9

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)
Discussion started by: ash_bit2k2
4 Replies

3. Solaris

Executable file on Solaris

Hi! What are executable file formats in Solaris? Can someone please share it? Thanks! (3 Replies)
Discussion started by: Klyde
3 Replies

4. Shell Programming and Scripting

Removing formats (bold) from UNIX file

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)
Discussion started by: suresh3566
6 Replies

5. Shell Programming and Scripting

Get the File name of perl executable in Linux

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)
Discussion started by: kar_333
1 Replies

6. Shell Programming and Scripting

Need to check the file formats

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)
Discussion started by: lkeswar
4 Replies

7. Shell Programming and Scripting

Shell script to encrypt the xls file using executable jar in Linux SUSE 11.4

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)
Discussion started by: nithin226
1 Replies

8. UNIX for Beginners Questions & Answers

How to make a .exe file executable in Linux?

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
file(1) 							   User Commands							   file(1)

NAME
file - determine file type SYNOPSIS
/usr/bin/file [-dh] [-m mfile] [-M Mfile] [-f ffile] file... /usr/bin/file [-dh] [-m mfile] [-M Mfile] -f ffile /usr/bin/file -i [-h] [-f ffile] file... /usr/bin/file -i [-h] -f ffile /usr/bin/file -c [-d] [-m mfile] [-M Mfile] /usr/xpg4/bin/file [-dh] [-m mfile] [-M Mfile] [-f ffile] file... /usr/xpg4/bin/file [-dh] [-m mfile] [-M Mfile] -f ffile /usr/xpg4/bin/file -i [-h] [-f ffile] file... /usr/xpg4/bin/file -i [-h] -f ffile /usr/xpg4/bin/file -c [-d] [-m mfile] [-M Mfile] DESCRIPTION
The file utility performs a series of tests on each file supplied by file and, optionally, on each file listed in ffile in an attempt to classify it. If the file is not a regular file, its file type is identified. The file types directory, FIFO, block special, and character special are identified as such. If the file is a regular file and the file is zero-length, it is identified as an empty file. If file appears to be a text file, file examines the first 512 bytes and tries to determine its programming language. If file is a symbolic link, by default the link is followed and file tests the file to which the symbolic link refers. If file is a relocatable object, executable, or shared object, file prints out information regarding the file's execution requirements. This information includes the machine class, byte-ordering, static or dynamic linkage, and any software or hardware capability require- ments. By default, file will try to use the localized magic file /usr/lib/locale/locale/LC_MESSAGES/magic, if it exists, to identify files that have a magic number. For example, in the Japanese locale, file will try to use /usr/lib/locale/ja/LC_MESSAGES/magic. If a localized magic file does not exist, file will utilize /etc/magic. A magic number is a numeric or string constant that indicates the file type. See magic(4) for an explanation of the format of /etc/magic. If file does not exist, cannot be read, or its file status could not be determined, it is not considered an error that affects the exit status. The output will indicate that the file was processed, but that its type could not be determined. OPTIONS
The following options are supported: -c Checks the magic file for format errors. For reasons of efficiency, this validation is normally not carried out. -d Applies any position-sensitive and context-sensitive default system tests to the file. -f ffile ffile contains a list of the files to be examined. -h When a symbolic link is encountered, this option identifies the file as a symbolic link. If -h is not specified and file is a symbolic link that refers to a non-existent file, the file utility identifies the file as a symbolic link, as if -h had been specified. -i If a file is a regular file, this option does not attempt to classify the type of file further, but identifies the file as a "regular file". -m mfile /usr/bin/file Uses mfile as an alternate magic file, instead of /etc/magic. /usr/xpg4/bin/file Specifies the name of a file containing position-sensitive tests that are applied to a file in order to classify it (see magic(4)). If the -m option is specified without specifying the -d option or the -M option, position-sensitive default system tests are applied after the position-sensitive tests specified by the -m option. -M Mfile Specifies the name of a file containing position-sensitive tests that are applied to a file in order to classify it (see magic(4)). No position-sensitive default system tests nor context-sensitive default system tests are applied unless the -d option is also specified. If the -M option is specified with the -d option, the -m option, or both, or if the -m option is specified with the -d option, the concate- nation of the position-sensitive tests specified by these options is applied in the order specified by the appearance of these options. OPERANDS
The following operands are supported: file A path name of a file to be tested. USAGE
See largefile(5) for the description of the behavior of file when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes). EXAMPLES
Example 1: Binary executable files Determine if an argument is a binary executable file: file "$1" | grep -Fq executable && printf "%s is executable. " "$1" ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of file: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/etc/magic file's magic number file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
elfdump(1), ls(1), magic(4), attributes(5), environ(5), largefile(5), standards(5) SunOS 5.10 16 July 2004 file(1)
All times are GMT -4. The time now is 12:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy