What is the use of asterisk command (*) in Linux - The Tech Influences

The Tech Influences
0

What is the use of asterisk command (*) in Linux - The Tech Influences


We use this command in Linux, Like we have created many files in Linux and when we will use asterisk (*) command in front of the ls file name, whatever file matches it with the file name will be displayed.

If you do not understand then you can see the example for better understanding


Example:-

Like here we have created multiple files with different different names.

Asterisk 
[root@localhost testfolder]# ll
total 0
-rw-r--r--. 1 root root 0 Aug 10 22:17 file1
-rw-r--r--. 1 root root 0 Aug 10 22:17 file2
-rw-r--r--. 1 root root 0 Aug 10 22:17 file3
-rw-r--r--. 1 root root 0 Aug 10 22:17 File4
-rw-r--r--. 1 root root 0 Aug 10 22:17 File55
-rw-r--r--. 1 root root 0 Aug 10 22:17 FileA
-rw-r--r--. 1 root root 0 Aug 10 22:17 fileab
-rw-r--r--. 1 root root 0 Aug 10 22:17 Fileab
-rw-r--r--. 1 root root 0 Aug 10 22:17 FileAB
-rw-r--r--. 1 root root 0 Aug 10 22:17 fileabc
[root@localhost testfolder]#

Here you can see that like here I have created a different name file in which both small and capital words are coming.


Now we will define a string here that only the file which is written in capital word should be shown.

Example:-1

Asterisk 
[root@localhost testfolder]# ll File*
-rw-r--r--. 1 root root 0 Aug 10 22:17 File4
-rw-r--r--. 1 root root 0 Aug 10 22:17 File55
-rw-r--r--. 1 root root 0 Aug 10 22:17 FileA
-rw-r--r--. 1 root root 0 Aug 10 22:17 Fileab
-rw-r--r--. 1 root root 0 Aug 10 22:17 FileAB
[root@localhost testfolder]#

Here only the file which matches the File* name string will be displayed.


Example:-2

Asterisk 
[root@localhost testfolder]# ll *ile*
-rw-r--r--. 1 root root 0 Aug 10 22:17 file1
-rw-r--r--. 1 root root 0 Aug 10 22:17 file2
-rw-r--r--. 1 root root 0 Aug 10 22:17 file3
-rw-r--r--. 1 root root 0 Aug 10 22:17 File4
-rw-r--r--. 1 root root 0 Aug 10 22:17 File55
-rw-r--r--. 1 root root 0 Aug 10 22:17 FileA
-rw-r--r--. 1 root root 0 Aug 10 22:17 fileab
-rw-r--r--. 1 root root 0 Aug 10 22:17 Fileab
-rw-r--r--. 1 root root 0 Aug 10 22:17 FileAB
-rw-r--r--. 1 root root 0 Aug 10 22:17 fileabc
[root@localhost testfolder]#

Here only the file which matches the *ile* name string will be displayed.


Example:-3

Asterisk 
[root@localhost testfolder]# ll *Fi*
-rw-r--r--. 1 root root 0 Aug 10 22:17 File4
-rw-r--r--. 1 root root 0 Aug 10 22:17 File55
-rw-r--r--. 1 root root 0 Aug 10 22:17 FileA
-rw-r--r--. 1 root root 0 Aug 10 22:17 Fileab
-rw-r--r--. 1 root root 0 Aug 10 22:17 FileAB
[root@localhost testfolder]#

Here only the file which matches the *Fi* name string will be displayed.

Example:-4
 
Asterisk 
[root@localhost testfolder]# ll F*55
-rw-r--r--. 1 root root 0 Aug 10 22:17 File55
[root@localhost testfolder]#

Here only the file which matches the F*55 name string will be displayed.

Post a Comment

0Comments
Post a Comment (0)