which command in Linux With Easy Examples

In this article, you will learn about which command in Linux with Easy Examples.

When we talk about which command, I like to tell you that it is one of the best commands in Linux. We use it to locate the executable files related to the given command and it searches it in the path environmental variable.

How to get help for the which command

I always suggest reading the manual page. So, it will give you an in-depth introduction to the command.

To get the manual page, you can type the below command.

man which

After typing the above command, you can see the below output on the terminal.

Manual Output of which command on terminal

Syntax of the which command

As we know now, how to get some information about the which command using the above command. So, now let’s talk about which syntax. The syntax of the which command is as below.

which [OPTIONS] FileName…

How To Use the which command in Linux With Easy Examples

Firstly, Suppose that you want to find the full path of the cp command then you can type the command in the below format.

which cp

Also, you will get the below output

The output of the full path of the cp command using which command in Linux

Secondly, If you want to find the full path of more than one argument then you can type which, and then you can type the arguments with one space between the arguments.

which mv rmdir

Also, you can find the output picture below.

The output of the full path of more than one argument using which command in Linux

Thirdly, If you use -a then it will print all the related pathnames of every argument.

which -a cp

Also, you can look below the output of the above command right way now.

which command in Linux
All pathnames are Printed using the which command along with the -a argument

Conclusion

In this tutorial, you learned about which command in Linux With Easy Examples. Also, if you find it useful then please share it with your friends on Facebook or any other means. If you find any difficulties then you can ask in the comment section. Thank you.

Also, you may find the below tutorials useful,

| which command in Linux With Easy Examples | How to Use which command | which command | How to use which command in Kali Linux | How to use which command in Rocky | How to use which command in CentOS | How to use which command in CentOS8 | How to use which command in RedHat | How to use which command in Debian | How to use which command in linuxmint |

| How to use which command in Arch Linux | How to use which command in Garuda | How to use which command in Ubuntu | How to use which command in Kubuntu | How to use which command in Fedora | How to use which command in Suse | How to use which command in Deepin | How to use which command in Bodhi | How to use which command in Mandriva | How to use which command in Parrot OS | How to use which command in Scientific Linux |

Linux best command | Linux most useful command | What is the use of which command? | Why should we use which command? | What is the better way to use which command?| Most Important linux-based commands | the use of which command in Linux effectively | Is it important to know about which command |

Leave a Reply