How to find an executable file under Linux

Source: Internet
Author: User

executable files under Linux

Linux under How to find executable files, as a Linux side dish just got this problem,

In Windows, you can use the suffix name to determine if an executable file, such as. Exe,.bat, is an executable file, but under Linux?

Linux can not be simply based on the file suffix to determine whether executable.

Linux to determine whether a file can be executed, the key to see if there are executable permissions , such as:

Enter:ls-l in the terminal and a list similar to the following is listed:

-rwxrwxr-x 1 Bingyue bingyue 48141 Jul 02:50 redis-trib.rb*
-rw-rw-r--1 Bingyue bingyue 2163 5 23:34 release.c
Drwxrwxr-x 2 Bingyue bingyue 4096 Jul 20:03 Documents

Take the following output as an example, the underscore area describes the permissions of the file, including readable, writable, executable, and so on.

"-" "rwx " "rwx" "R-x" 1 Bingyue bingyue 2324109 5 23:35 redis-cli*

10 characters determines what different users can do with files:
The first character represents a file (-), a table of contents (d), and a link (l)
The remaining characters are per 3 groups (RWX), read (R), write (w), and execute (x), respectively, stating the permissions of the file owner (user), the user group in which the file owner resides, and other group users (Others).

First set of rwx: The permissions of the file owner are read, write, and execute
Second set of rwx: Permissions for users of the same group as the file owner are read, write, and execute
Third group R-x: permissions for other users who are not in the same group as the file owner are read and executed and cannot be written

In addition, some of the files can also be judged by the suffix name, such as Redhat, in general, the. rpm format can be executed in Redhat, Debian. Deb format can be executed directly in Debianlinux.

how to find an executable file

Use
Ls-f|grep "*"

can also be used under Ubuntu

ll | grep "*"
ll is not a basic Linux command and can be considered an alias for ls-l.

Ls-f can classify files by type, and add/* symbols at the end.
-F,--classify append indicator (one of */=>@|) to entries,
The-F and --classify options allow you to add suffixes to the list view file. Normal files do not add suffixes, add * to the executable file , add/number to the directory, and add the @ sign for the symbolic link.
| Pipe output,grep "*" to pick out the line ending with "*" and output.

Similar to the
Use Ls-f|grep "/" to find a table of contents
Use Ls-f|grep "@" to find a soft connection

In addition, you can use Ls-color to identify the executable file:

Instance output:

How to find an executable file under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.