Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm new to Linux and saw files named "example.cmd" and "test.com".

How do I open these files? Also, what kind of files are these?

share|improve this question
1  
In Linux, filename extensions are not as important as on MS Windows. Do not rely on them much. –  choroba Dec 2 '11 at 13:24
1  
as in, they don't exist. People use the dotted notation for convenience only. The vast majority of the time anyhow (i.e: unless a particular app is coded in an odd way) –  Sirex Dec 2 '11 at 13:45

3 Answers 3

up vote 3 down vote accepted

As luke says, you should use the file utility to try to find out the truth; but my best guess is that these are actually Windows scripts/executables that have somehow found their way onto a linux system.

This means there might not be much point opening them. Still, but you could just start by trying to run the command less example.cmd or less test.com, and if you just see garbage, try hexdump. I don't know if that counts as "opening" in any useful sense, but at least you might find out something.

share|improve this answer
    
I would use strings on suspected binaries before using less. But use file first. –  RedGrittyBrick Dec 2 '11 at 16:14
    
the "com" file is a ASCII text, what does that mean? –  Josh Dec 2 '11 at 16:26
    
It depends on what the text is. You should definately just open it up using less or your faviourite text editor and have a look. It might be a script of some kind, if @file@ says "ASCII text" it might just be a document written by and for humans, but it might just be that it was doesn't know what kind of text it is. By the way, what is the context, where is this file and how did you get it? –  Adrian Ratnapala Dec 2 '11 at 17:03

Many cross-platform applications include both windows (.cmd) and unix/linux (.sh, etc) scripts, usually to start up an application. A bit more information about where you saw them, what the actual names are, etc would be needed to determine exactly what you're looking at.

.com files are a hold-over from the MS-DOS days.

share|improve this answer

Try running the file command on the files, e.g:

file test.com

and see if it gives you any useful information.

share|improve this answer
    
when I did that, it said "the file is an ascii text" –  Josh Dec 2 '11 at 16:24
    
OK, you can go ahead and run less test.com to view the contents of the file as @Adrian Ratnapala suggests. –  Luke Girvin Dec 2 '11 at 16:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.