Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

file(1) [bsd man page]

FILE(1) 						      General Commands Manual							   FILE(1)

file - determine file type SYNOPSIS
file file ... DESCRIPTION
File performs a series of tests on each argument in an attempt to classify it. If an argument appears to be ascii, file examines the first 512 bytes and tries to guess its language. BUGS
It often makes mistakes. In particular it often suggests that command files are C programs. Does not recognize Pascal or LISP. 7th Edition April 29, 1985 FILE(1)

Check Out this Related Man Page

file(1B)					     SunOS/BSD Compatibility Package Commands						  file(1B)

file - determine the type of a file by examining its contents SYNOPSIS
/usr/ucb/file [-f ffile] [-cL] [-m mfile] filename... DESCRIPTION
file performs a series of tests on each filename in an attempt to determine what it contains. If the contents of a file appear to be ASCII text, file examines the first 512 bytes and tries to guess its language. file uses the file /etc/magic to identify files that have some sort of magic number, that is, any file containing a numeric or string con- stant that indicates its type. OPTIONS
-c Check for format errors in the magic number file. For reasons of efficiency, this validation is not normally carried out. No file type-checking is done under -c. -f ffile Get a list of filenames to identify from ffile. -L If a file is a symbolic link, test the file the link references rather than the link itself. -m mfile Use mfile as the name of an alternate magic number file. EXAMPLES
Example 1 Using file on all the files in a specific user's directory. This example illustrates the use of file on all the files in a specific user's directory: example% pwd /usr/blort/misc example% /usr/ucb/file * code: mc68020 demand paged executable code.c: c program text counts: ascii text doc: roff,nroff, or eqn input text empty.file: empty libz: archive random library memos: directory project: symboliclink to /usr/project script: executable shell script titles: ascii text s5.stuff: cpio archive example% ENVIRONMENT VARIABLES
The environment variables LC_CTYPE, LANG, and LC_default control the character classification throughout file. On entry to file, these environment variables are checked in the following order: LC_CTYPE, LANG, and LC_default. When a valid value is found, remaining environ- ment variables for character classification are ignored. For example, a new setting for LANG does not override the current valid character classification rules of LC_CTYPE. When none of the values is valid, the shell character classification defaults to the POSIX.1 "C" locale. FILES
/etc/magic ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWscpu | +-----------------------------+-----------------------------+ SEE ALSO
magic(4), attributes(5) BUGS
file often makes mistakes. In particular, it often suggests that command files are C programs. file does not recognize Pascal or LISP. SunOS 5.11 14 Sep 1992 file(1B)
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File/directory information......

Basically i have done created the script below, and it functions ok, it prints the access rights the user has. But i need it to print the group permissions, and other permissions, it would also be helpful if i could print the permissions in numeric form aswell, if it is possible. I have looked in... (50 Replies)
Discussion started by: Makaveli.2003
50 Replies

2. Shell Programming and Scripting

Korne Script for format file

Hi All, I am not too familiar with Korne script so I need as much help as possible on this ;) What I want to do is: from the excel file on my computer, I want to take certain field from this xls file and put it in txt or cvs format in specific width column. Then fpt this file into the server. ... (51 Replies)
Discussion started by: CamTu
51 Replies

3. Shell Programming and Scripting

Parse a string in XML file using shell script

Hi! I'm just new here and don't know much about shell scripting. I just want to ask for help in creating a shell script that will parse a string or value of the status in the xml file. Please sample xml file below. Can you please help me create a simple script to get the value of status? Also it... (46 Replies)
Discussion started by: ayhanne
46 Replies

4. Shell Programming and Scripting

Bash can't find file but tcsh can why?

I have a short script for compiling an old program. It's a simple text file 'ccprog' created in emacs. The permissions were changed with 'chmod 775 ccprog' to make it an executable. When I try to run ccprog I get "bash: ./ccprog: No such file or directory". If I change to tcsh ccprog runs. Why... (68 Replies)
Discussion started by: muddauber
68 Replies

5. UNIX for Dummies Questions & Answers

List directories, subs and files

Hi, I try to list all files in a folder, including all the subdirs (and their subdirs) and all files contained in each of these folders. I then print it to a simple txt file. I use ls -R -1 >test.txt This sort of does what I need, yet, the result is something like: It reasonably comes... (53 Replies)
Discussion started by: dakke
53 Replies

6. UNIX for Dummies Questions & Answers

Getting non unique lines from concatenated files

Hi All, Is there a way to get NON unique lines from 2 or more concatenated files? Basically I have several files which are very similar with the exception of few lines and I want to find out which lines are different in each file. Very simple example is file1 contains: 1 2 3 4 5file2... (122 Replies)
Discussion started by: pawannoel
122 Replies

7. Shell Programming and Scripting

Copy file to SD card from internal flash.

Hi, At first I have to say that I know nothing about Linux :( But I am looking for solution how to copy one file from internal Lowrnace HDS flash memory. Lowrance HDS is Linux based device. Here is the link for firmware update files for this unit. At the end of main firmware file there... (62 Replies)
Discussion started by: PouchX
62 Replies

8. Shell Programming and Scripting

Help in extracting fields from a file

I have an input file with contents like: 203969 OrdAcctCycChg USAGE_DAEMON1 203970 OrdAcctCycChg USAGE_DAEMON2 203971 OrdAcctCycChg USAGE_DAEMON3 203972 OrdAcctCycChg USAGE_DAEMON4 I need to extract variables in first column... (51 Replies)
Discussion started by: Rajesh Putnala
51 Replies

9. Shell Programming and Scripting

Help me pls : splitting single file in unix into different files based on data

I have a file in unix with sample data as follows : -------------------------------------------------------------- -------------------------------------------------------------- {30001002|XXparameter|Layout|$ I want this file to be splitted into different files and corresponding to the sample... (54 Replies)
Discussion started by: Ravindra Swan
54 Replies

10. Shell Programming and Scripting

FTP search ,grep using perl

Need assistance on a Perl script. I have a list of file names in a file and would like to search/grep the same names in the list of files on the ftp server and output to a file. Any help is appreciable Below is the script that can give me the list of files,size of file, Modified date on the... (56 Replies)
Discussion started by: ajayram_arya
56 Replies

11. UNIX for Dummies Questions & Answers

Move File Containing More Than two "-" at 3rd Line To New Directory

Hi Guys I am trying to move file containing more than two - at the 3rd line of each files to a new directory. The files are something like this : ****** Text ****** /text/ text text I want to make sure the search effect only take place on the 3rd line one as there might me... (46 Replies)
Discussion started by: Nexeu
46 Replies

12. Shell Programming and Scripting

UNIX Shell Scripting (Solaris) for File Checking

Hi guys, I'm sorry but i badly need your help. I am assigned to do a basic shell script in my job but sadly i don't have any idea on what it is because i am an electronics engineer, but i googled all of it, ask my friends but i cant finalize my scripts. so do please help me. The requirement... (47 Replies)
Discussion started by: daveaztig14
47 Replies

13. Shell Programming and Scripting

Ranking data points from multiple files

I need to rank a large number of data points that exist in multiple files. My data points (Column 3) are based on unique values in columns 1 and 2. I need to rank the values that are in File 1, Column 3. For instance: Input File 1 AAA BBB 10 CCC DDD 16 EEE FFF 20 Input File 2 ... (47 Replies)
Discussion started by: ncwxpanther
47 Replies

14. UNIX for Beginners Questions & Answers

Parsing a column of text file - best practices

HI Folks - I hope all is well! I have a business process where I manage a text file of substitution variables and their values for a target system. After updating, I run a script to push the changes to the target system. However, I'm trying to develop a method to be able to automatically... (50 Replies)
Discussion started by: SIMMS7400
50 Replies

Featured Tech Videos