Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

which(1) [debian man page]

WHICH(1)						      General Commands Manual							  WHICH(1)

NAME
which - locate a command SYNOPSIS
which [-a] filename ... DESCRIPTION
which returns the pathnames of the files (or links) which would be executed in the current environment, had its arguments been given as commands in a strictly POSIX-conformant shell. It does this by searching the PATH for executable files matching the names of the argu- ments. It does not follow symbolic links. OPTIONS
-a print all matching pathnames of each argument EXIT STATUS
0 if all specified commands are found and executable 1 if one or more specified commands is nonexistent or not executable 2 if an invalid option is specified Debian 1 May 2009 WHICH(1)

Check Out this Related Man Page

which(1)							   User Commands							  which(1)

NAME
which - locate a command and display its pathname or alias SYNOPSIS
which [name]... DESCRIPTION
which takes a list of names and determines which alias or utility would be executed had these names been given as commands. For each name operand, if it names an alias the alias is expanded. Otherwise the user's path is searched for a utility name matching name. Aliases are taken from the user's .cshrc file. path is taken from the current shell execution environment. OPERANDS
The following operand is supported: name The name of a command to be located. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 One or more name operands were not located or an error occurred. FILES
~/.cshrc source of aliases and path values ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), attributes(5) DIAGNOSTICS
A diagnostic is given for names which are aliased to more than a single word, or if an executable file with the argument name was not found in the path. NOTES
The which utility is not a shell built-in command. BUGS
To compensate for ~/.cshrc files in which aliases depend upon the prompt variable being set, which sets this variable to NULL. If the ~/.cshrc produces output or prompts for input when prompt is set, which can produce some strange results. SunOS 5.11 30 Mar 2005 which(1)
Man Page

14 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find a date which is 7 days past when given current date

hii all. I have to get the date of the 7th day past from the current date. if i give the current date as sep 3 then i must get the date as 27th of august. can we get the values from the "cal" command. cal | awk '{print $2}' will this type of command work. actually my need is if today is... (17 Replies)
Discussion started by: ladtony
17 Replies

2. Shell Programming and Scripting

downsizing of strings which are returned by grep

hey every1, i am a very new shell programmer. what i am trying to do is to rename a music file using its metadata(using mminfo) the problem is, mminfo's output is very weird: my final filename should be "$artist - $title" however, when i use artist=` mminfo ~/Desktop/It\'s\ Not\ My\... (16 Replies)
Discussion started by: abhigyan91
16 Replies

3. What is on Your Mind?

Which OS you use for Desktop

I am on Solaris 10 cat /etc/release Solaris 10 10/09 s10x_u8wos_08a X86 Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms. Assembled 16 September 2009 (16 Replies)
Discussion started by: solaris_user
16 Replies

4. UNIX for Advanced & Expert Users

Which cut command is more efficient?

Hi, I've got a query regarding which of the following is more efficient & why - cat <filename>|cut -d'*' -f2- > <newfilename> or cut -d'*' -f2- <filename> > <newfilename> Thanks. (17 Replies)
Discussion started by: sumoka
17 Replies

5. Shell Programming and Scripting

Dont have a clue which program to use to process flying bat data

Hi, Im not a unix person but need to analyse some data. This is bat data (animals) from large roosts using data loggers. I think AWK is probably the best thing to use but dont really know so any help appreciated. (python, grep) whichever it is, I'll have to learn it! here is an example of... (27 Replies)
Discussion started by: cmp260
27 Replies

6. Solaris

How to check which type of storage is used in unix?

SunOS 5.10 Generic_142900-15 sun4v sparc SUNW,T5240 how can i check the storage type being used in unix solaris sparc system? please help me its urgnet.. thank you (22 Replies)
Discussion started by: aesgs
22 Replies

7. Shell Programming and Scripting

How to connect to FTP server which requires SSL authentication?

Hello, I tried searching through lot of threads for a solution but couldn't fetch the exact solution, so I am creating a new thread. I am trying to connect to a FTP server 1) using a simple FTP command, it gives the error : 534 Policy requires SSL. Login failed. 2) using SFTP... (19 Replies)
Discussion started by: amitshete
19 Replies

8. UNIX for Dummies Questions & Answers

Delete the file which crossed 2GB

Hi , I wants to create the bash script for deleting the specified 2gb file and wants to take the backup before doing that. please help me how to do the same,I use RHEL5 server (22 Replies)
Discussion started by: Rahulne25
22 Replies

9. UNIX for Dummies Questions & Answers

GREP function in ksh which ignores LINE Breaks

Hello I am using a grep command with two patterns in my KSH script. File has line breaks in it and both the patterns are in different lines. Here is the command grep -l 'RITE AID.*ST.820' natriter820u.20140914 Pattern1 - RITE AID Pattern2 - ST*820 I am not getting any results from... (24 Replies)
Discussion started by: Raghav Garg
24 Replies

10. Shell Programming and Scripting

Replace multiple positions in records which match crireria

I have a test file a.txt 001 123 456 789 002 This is just a 001 test data 003 file. I want to clear columns 5 and 6 if the first 3 characters are 001 using awk. I tried following but does not work. Any suggestions? awk 'BEGIN{OFS=FS=""} {if (substr($0,1,3)=="123") $5=" "; $6="... (20 Replies)
Discussion started by: Soham
20 Replies

11. Shell Programming and Scripting

Which shell can I use on Linux?

I have Linux x86_64 x86_64 x86_64 GNU/Linux I thought that Linux can use only bash shell however, when I wrote the code: #!/bin/sh NAME=`basename $0 .sh` Today=`date '+%Y%m%d'` TIMESTAMP=`date +%H:%M:%S` LOCAL_SERVER=`hostname` let countcla=0 countcla=`expr ${countcla} + 1` ... (18 Replies)
Discussion started by: digioleg54
18 Replies

12. Shell Programming and Scripting

Remove duplicate lines which has been repeated 4 times

Remove duplicate lines which has been repeated 4 times attached test.txt below command tried and not getting expect output. for i in `cat test.txt | uniq` do num=`cat test.txt | grep $i | wc -l` echo $i $num done test.txt ... (17 Replies)
Discussion started by: Kalia
17 Replies

13. What is on Your Mind?

Which category do you belong to?

Hello All, I was thinking to start this POLL, sometime back but couldn't get time so starting it today. So we all work either as an Admin or as a Developer or as a QA etc. So let's have a thread(POLL) where we could share our experiences(if it doesn't come anyone's privacy category) so that we... (17 Replies)
Discussion started by: RavinderSingh13
17 Replies

14. UNIX Desktop Questions & Answers

Which is your favourite desktop?

Most of the people think that they can not use Unix as desktop. By this poll we gone tell them that we not just use Unix as desktop but also love different display managers like GNOME, KDE etc..... (35 Replies)
Discussion started by: ynilesh
35 Replies