Equivalent windows в linux

What is the equivalent of an «exe file»?

Not an answer but would like to add EVERYTHING in LINUX is a FILE so having Extensions as .exe never matters.

@tijybba The «everything is a file» design philosophy is totally unrelated to .exe extensions not being needed for native executables. The former explains the contents of /dev ; the latter is because of execute permissions and reliance on examining the inside of a file to determine what kind of file it is.

@ Eliah Kagan — It was just a basic info since In Windows extension is necessary for execution , well in Linux it ain’t , as far as Executable Permissions is concerned , it requires little more Know How of Sudo -User Access and Underlaid security concerns, which i guessed someone would clarify in answer as its latter part ,if at all needed that’s why i posted it as comment not an answer.

@tijybba But «everything» being a file doesn’t really have anything to do with the topic of this question, does it?

I guess i misread that part in question , which says » what is a exe file is in Ubuntu?», i considered Executable, but now with your eager help it seems it meant » what is a .exe file is in Ubuntu? «. If it is highly inappropriate , let me know i would be glad to delete it .( Mistakes are great learning experiences:D ).

11 Answers 11

Linux extension Windows Equivalent Short description
[none], .bin, .elf(rare), .exe, .com(rare) Binary executables
.so, .o .dll Shared libraries
.a .lib Static library, for linking into an executable
[none], .sh .bat Shell script
[none], .pl, .php, .py, etc .cmd, .vbs Other scripting languages which may be used
.exe .exe Linux may be configured to execute some Windows executables using mono or wine
.deb, .rpm, etc .msi Installer package for the various distributions. Note that the packages in Linux distributions are more powerful as it supports dependency management and more.
.tar.gz, .tar, .gz, .zip, .lzo, .lz4 .zip (native support), other extensions/formats (via applications) Archives that can contain a program or any other files, and may be compressed
.ko .sys Drivers and kernel modules are loaded into the Linux kernel and have more hardware access than other programs.

Note that Linux/Unix doesn’t tend to use file extensions on directly executable files including binaries and shell scripts, instead identifying the executable type by inspecting the file.

While the other answers focus on the fact that ‘any’ file can be an executable, this answer really hits the nail on the head, whereas saying ‘anything’ can be an executable is not really informative or true, but rather exceptionalist. I could rename any file on windows to .exe, and it will try to execute it, but won’t necessarily work, in linux its the same, if it’s not meant to be executed, its not going to work. My issue many times is downloading a package, and not really understanding what to start, but off course, rtfm.

Читайте также:  Linux alias with params

@Dani-Br This is a community-wiki post, meaning that others are welcome to edit it, and you have enough reputation to do so (at 101). I’ve added .bin for now.

It is not an extension, but it was useful for me to know that the «PE» format on Windows is the equivalent to «ELF» format on Linux thought

There is no standard File-Extention like an «.exe» file in Windows.

On Linux nearly any file can be executable. The file ending just describes (but not necessarily) what or how a file is «executed».

For example a shell script ends with .sh and is «executed» via the bash shell.

In your question you ask for .deb and .tar.gz Well, the .deb file installs software on your system (Please be careful!) And the .tar.gz file is a compressed file like a .zip that you could know from Windows.

@Nick, .deb files tend NOT to be executables: they’re neither ELF nor «she-bang» scripts and they’re unlikely to be registered with binfmt. Even with executable permissions, the kernel wouldn’t know what to do with them. The fact that your file explorer can be registered to open files with a certain application based on the extension has nothing to do with them being executable (in terms of file permission or in terms of kernel binary format execution).

.deb file is also more like a .zip then like an .exe. The point is that .deb does not execute itself, it is extracted, interpreted and installed by some other application.

That other application usually being the Software Center, which doubles as an installer. Linux is less dependent on extensions compared to Windows and therefore decides executability based on permissions rather than extension.

The concept of an executable is different in unix/linux than Windows.

Windows

Anything that ends in .exe or .com becomes an executable file.

Linux/Unix

Each and every file has an executable bit, so any file can be executed, unlike Windows. To see if a file is executable, you can check its properties (Permissions tab), or even see them marked in the terminal (they are all marked with a *).

Even text files (like shell scripts) can have their executable bits set, and be run as one.

also worth adding that in the case of text files, the shebang ( #!/bin/bash for example) at the start of the file sets which program executes the file.

Separate executable bits exist for user, group, and other. Use of these bits can limit who can execute the program. Additional bits exist for SUID and SGID to cause the program to run as the user or group that owns the file.

There are some inaccuracies above: 2) «every file has an executable bit»: there are three executable bits (owner, group, and others), so one can allow himself but not others to execute a file. There is also a setuid bit to «execute-as-owner» and setgid «execute-as-group». 2) «any file can be executed»: not so. the permission bits are a required but insufficient condition to successfully execute a file. An Immediate failure will occur for example if the file cannot actually be loaded and run (Ref: file magic numbers man magic , ELF man elf , and hash-bang line man execve )

Читайте также:  Альтернативные репозитории astra linux

To find out what a UNIX operating system thinks a particular file’s type is, you use the file command:

$ file /bin/ls /bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1, for OpenBSD, statically linked, stripped 

In the above example, I give the path to the program ‘ls’, you would replace with the path of your file.

A script file would look like:

$ file script.sh script.sh: Bourne-Again shell script text 
$ file textfile textfile: ASCII text 
$ file rsync-3.0.6.tar.gz rsync-3.0.6.tar.gz: gzip compressed data, from Unix 

It is even smart enough to correctly identify a windows program, should you happen to have one lying around on your UNIX box:

$ file FMZsetup.exe FMZsetup.exe: MS-DOS executable (EXE), OS/2 or Windows 

And when it can’t figure out what a file is (but is able to open it), it calls it data:

$ file myrandom myrandom: data 

File execution on Linux isn’t related at all to the file name or extension. Any file can potentially be executed, provided that it’s handled by the kernel’s binfmt mechanism (and that its executable permissions are set).

The most common format for executable is ELF, although some kernels can be compiled for support of the old a.out format. (For full technical details, binfmt_elf.c is where to look.)

Another common mechanism is the «Shebang» system, handled by binfmt_script , which looks for #!/path/to/interpreter at the beginning of the file.

binfmt_misc allows for the registration of other handlers, as documented here.

If you fancy doing a bit of kernel programming, you can even write your own.

Although not directly related, the file command should tell you whether a file is an ELF executable or something else.

The naming convention has nothing to do with the executable status of a file (except when it’s used for binfmt_misc registration). They’re just conventions. Typically, a .exe file found on Linux could be a mono application, getting the .exe extension as a convention coming from the Windows/.Net world.

The other aspect that can happen when you want to «run» a file is to have the file explorer tool that you use register extensions to be able to launch a program that will open these files. This is what would happen if you double click on a .txt , .tar.gz or .deb , for example: the files are not executables nor executed, but what you use to double-click chooses which executable to launch to open these files.

@ObsessiveFOSS, but does it deserve a downvote? No one had mentioned mono before my answe. No answer here really talks about how Linux executables really work (see my comment about binfmt on the accepted answer) anyway.

@ObsessiveFOSS, no problem. I’ve also noticed that the question had been edited since I answered it, changing a bit its meaning (I understood it initially as «I have an exe file, I can’t run it. «) and making my answer less relevant indeed.

Читайте также:  Служба ntp в линукс

Linux does not use the file extension to determine if a file is executable. It uses a file attribute called the executable bit.

Any file can be marked executable, and when attempting to execute a file Linux will look at the start of the file to see what type of executable it is.

Types of executable files

  • Binary executables in Linux usually use the ELF (Executable and Linkable Format) file format. These are Linux’s equivalent to the PE (Portable Executable) format used in Windows or the MZ and NE formats used in DOS and early Windows versions, all of which used the EXE file extension. That is, these formats consist of binary, compiled code but may be large and may embed other items in the file. Interestingly, the ELF file format also forms the equivalent of the Windows DLL file, because Linux also uses the format for shared libraries which contain functions callable from other executables. When executing an ELF format file, Linux recognises the file type from its magic number — the first four bytes are 7f 45 4c 46 — the 7f is included to avoid misclassification of text files. This is similar to the way Windows can distinguish the different executable formats that all use the EXE file extension.
  • Linux also allows direct execution of text-based script files, which serve a similar purpose to Batch files in DOS/Windows. Linux’s scripting support is extensible in the sense you can install or create any scripting language you like and configure your Linux installation to be able to run scripts in that language, by specifying in the script which binary should be used to interpret that script. Linux installations have a default script interpreter available at /bin/sh which interprets any scripts that don’t otherwise specify which interpreter to use. This script interpreter interprets shell scripts that adhere to scripting standard specified in POSIX, an initiative to standardize Unix-like operating systems. Historically Linux’s POSIX-compliant script interpreter has been bash — an open source re-implementation based on the Unix bourne shell and others — with bash so commonly used that in the Linux community such scripts are commonly referred to as bash scripts, but other scripting interpreters supporting POSIX may be used at /bin/sh including dash. Other scripting interpreters commonly used in Linux include perl and python. Within the script, you use a hashbang on the first line to specify which interpreter should be used. Here are some examples:
 #!/bin/perl #!/usr/bin/env python3 

Executable attribute

The executable bit forms part of a file’s file permissions, and can be specified separately for the owner and group of the file, or for world (everyone). A user who does not have execute permission applicable to them sees the file as a regular, non-executable file.

Источник

Оцените статью
Adblock
detector