answersLogoWhite

0

Why file command is used in unix?

Updated: 8/18/2019
User Avatar

Wiki User

13y ago

Best Answer

The 'file' command in Unix attempts to guess what type of file you are looking at by reading the first several sections of the file and comparing it to a list of known contents for files.

It is a useful command if you just want to know what type of file something is without having to examine it yourself. The command is not perfect because it does not detect all types of files but it does a reasonable job of guessing.

It is used because in Unix there are no file extension types to tell us what kind of file a given file might be; you have to look inside the file to tell how it might be used.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why file command is used in unix?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a file command used to create or start a new file?

The 'touch' command creates a new empty file in Unix.


What is the command echo in unix mean?

it is a command in unix and unix like operating systems that places a string on the computer terminal.It is typically used in shell scripts and bath files screen or a file.


What do CD command do in unix?

The 'CD' command is not standard for Unix. The 'cd' command, however, will change directories (folders). It is a means of navigating the Unix file system.


Is there a define type program for Unix?

If you are asking about how can you find the type of file something is, the command is 'file' followed by the filename. This command will attempt to tell you something about the file and how it might be used.


How do you redirect a displayed line used by echo command to a file in UNIX?

echo "This is my text" > myfile.txt


Which command displays the contents of file specified in UNIX?

The 'cat' command is typically used for this purpose, although there are numerous varieties of this command that may do similar things.


What is the rm command in Unix?

The rm command is used to delete a file or directory. Its syntax isrm file or rm -r directoryExample:rm myfilerm -r /home/user/mystuff


How do you create dummy file in unix?

using touch command of UNIX. syntax touch <filename> will create dummy regular file.


How do you check a file for spelling errors in unix?

Depending on the Unix vendor, there is usually a 'spell' or 'ispell' command available to spell check words in a file.


What file extensions are used to identify command shell scripts?

For windows, you might use .cmd, .bat as common file extensions. Unix doesn't use file extensions as associations, so no file extension needs to be used in the Unix environment. A shell script in Unix is simply a text file with any name that is readable and executable. However, file extensions are typically used in Unix as a documentation aid that states that the file is a shell script. Common extensions are .sh, .csh, .ksh, .tcsh, .zsh, etc.


In unix how will you find extension of file using commands?

Unix files do not rely on extensions, therefore there is no command to find them.


Which is the most commonly used command for referencing detailed information about a particular command in UNIX?

In Unix, use the 'man' command.