which command in Linux Ubuntu with example

1. 'which' command in linux / Ubuntu with example

‘which’ command in linux or ubuntu systems is basically use to locate the executable file stored somewhere in the filesystems or locate by using the PATH variable.

‘which’ returns the path of the executable file in current environment.  ‘which echo’ returns the path of the echo command.

$ which echo

if you want to print all matching pathnames of each argument. then you type which -a fileName

$ which -a echo

You can use multiple filename while using the which command. For example

$ which -a echo date cal

That’s all folks !! for the easy understanding of the ‘which’ command. Hope you learnt something new today and if you find any difficulty, you can write in the below comment section and I’ll get back to you. Bye take care !!

Leave a Reply