Sponsored Content
Full Discussion: Help about "file" cmd
Top Forums UNIX for Dummies Questions & Answers Help about "file" cmd Post 302674951 by yanglei_fage on Saturday 21st of July 2012 01:50:16 AM
Old 07-21-2012
Quote:
Originally Posted by jim mcnamara
file command uses (/etc/magic or /usr/share/magic or /usr/share/file/magic) and reads the first few bytes of the file. It then tries to decode The first n bytes and then does a lookup on those bytes in the magic file. The text you see is in the magic file.

The size of n depends on the OS.
But I can't find where tell "2.6.16"
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

assign shell var output of cmd "wc"

how do I feed output of "wc" to a shell script variable "countBcp"? (2 Replies)
Discussion started by: devy
2 Replies

2. Shell Programming and Scripting

Need help on use of "cmd" command in net::Telnet module in PERL

in "cmd" command i want to copy the ouput of the command excuted to a particular file in a directory. How to do this..?? Ex : $telnet->cmd(String => 'allip:acl=a1;',Prompt => '/</'); i want to copy o/p of the command "allip:acl=a1;" in a log file in a particular directory. Plz suggest.. (1 Reply)
Discussion started by: sudhakaryadav
1 Replies

3. Shell Programming and Scripting

passing the output of cmd from "eval" to a variable

Hello, I need help with the eval command. I have been building a lengthy cmd using eval, and I need to create $var from the output of the cmd. Here is what I have. Out=/dfezz1/output.txt Node="'LPAR Info:'" Gr3p0=" |grep" Printc=" prtconf" Output1=" 1>>$Out 0>&1" Cat1="cat... (8 Replies)
Discussion started by: dfezz1
8 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. Shell Programming and Scripting

Perl script with "chkconfig --list" cmd

Hi everybody; I try to code a script perl to list all services that are active "ON" with a chkconfig -- list the problem is that code list all services which are active or not. #!/usr/bin/perl use strict; use warnings; open(FILE,"-|") || exec "chkconfig --list |grep ON";... (2 Replies)
Discussion started by: bassma
2 Replies

6. Shell Programming and Scripting

cmd || echo "something" - doesn't exit uppon error

Hi guys, I have a shell script where I have the following: for i in ad0 ad1 do gpart create -s gpt $i || echo "Cannot create GPT partition on "$i". Exiting ..." gpart add -s 128 -t freebsd-boot $i || echo "Cannot add freebsd-boot partition on "$i". Exiting ..." gpart add -s 4G -t... (2 Replies)
Discussion started by: da1
2 Replies

7. Shell Programming and Scripting

Perl open(CMD, "cmd |"); buffering problem..

Hello, There's a third-party application's command that shows the application's status like "tail -f verybusy.log". When use the command, the output comes every 1-sec. but when it goes in a script below the output comes every 8-sec...What is the problem and how can I fix it? open(CMD,... (2 Replies)
Discussion started by: Shawn, Lee
2 Replies

8. Shell Programming and Scripting

Using a single "find" cmd to search for multiple file types and output individual files

Hi All, I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd. What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Discussion started by: swaters
3 Replies

9. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
file(1) 						      General Commands Manual							   file(1)

Name
       file - determine file type

Syntax
       file [ -c ] [ -f ffile] [ -m mfile] filename ...

Description
       The  command  performs  a  series of tests on each filename argument in an attempt to classify it.  If an argument appears to be ASCII, the
       command examines the first 1024 bytes and tries to guess its language.

       For character special files, part of this classification is information about which devices the system shows  as  active.   In  particular,
       device-specific	information such as controller type and unit, device type and unit, and status (offline, write locked, density, errors) is
       returned. The general categories currently implemented are disk, tape, and terminal devices. The supported terminal devices  include  Local
       Area Terminals (LAT) but not Local Area Network (LAN) pseudo-terminals.

       The  command  uses  the	file to identify files that have some sort of magic number.  A magic number is any numeric or string constant that
       identifies the file containing the constant.  Commentary at the beginning of explains its format.

Options
       -c   Checks the magic file for format errors by printing the internal representation of the magic file.	No file typing is done under -c.

       -f   Interprets the following argument to be a file containing the names of the files to be examined.

       -m   Instructs file to use an alternate magic file.

Restrictions
       It often does a poor job of distinguishing C programs, shell scripts, English text, and ASCII text.

       It does not recognize many programming languages, including Modula, Pascal, and Lisp.

Files
       /usr/lib/file/magic

See Also
       magic(5)

																	   file(1)
All times are GMT -4. The time now is 02:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy