How to find executable files in Linux
Executable files in Linux
In Windows, you can use the extension "executable file", such as ".exe" and ". bat". But in Linux?
In Linux, you cannot simply determine whether execution is executable Based on the file suffix.
In linux, the key to determining whether a file is executable is to check whether the file has the executable permission, for example:
Enter "ls-l" in the terminal to list a list similar to the following:
-Rwxrwxr-x 1 bkjia 48141 Jul 17 redis-trib.rb *
-Rw-r -- 1 bkjia 2163 Aug 5 release. c
Drwxrwxr-x 2 bkjia 4096 Jul 22 20:03 Documents
The following output is used as an example. The underline area describes the file permissions, including readable, writable, and executable permissions.
[-] [Rwx] [rwx] [r-x] 1 bkjia 2324109 Aug 5 redis-cli *
10 characters to determine what different users can do with files:
The first character represents the file (-), directory (d), and link (l)
The remaining characters in a group of three (rwx), read (r), write (w), and execute (x) respectively indicate the object owner (User) other users (groups) in the user Group where the file owner is located, and users in other groups (Others) have permissions on the file.
Group 1 rwx: the permissions of the file owner are read, write, and execute.
Group 2 rwx: the permissions of users in the same group as the file owner are read, write, and execute.
Group 3 r-x: the permissions of other users not in the same group as the file owner are read and executed, and cannot be written.
In addition, some files can be determined by extension names. For example, in RedHat, all files in. rpm format can be executed in redhat, and In debian, The. deb format can be directly executed In debian Linux.
How to find executable files
Use
Ls-F | grep "*"
You can also use
Ll | grep "*"
Ll is not the next basic command in linux. It can be considered as an alias of ls-l.
Ls-F can classify files by type and add/* and other symbols at the end.
-F, -- classify append indicator (one of */=> @ |) to entries,
-F and -- classify options allow you to add a suffix to the list file. If a common file does not have a suffix, add the * sign to the executable file, add the/sign to the directory, and add the @ sign to the symbolic link.
| Pipeline output. grep "*" selects the rows ending with "*" and outputs them.
Similarly,
Use ls-F | grep "/" to find the Directory
Use ls-F | grep "@" to find soft connections
In addition, you can use ls-color to identify the executable file:
Instance output:
This article permanently updates the link address: