where can I find the description/details of the custom commands. In my linux server there is a custom command named qsubm
that I need to check, but I don't know where it is written.
5 Answers
If you're using bash, the best way to find out is
type -a qsubm
Whether it's a shell function, an alias, or an executable, this will tell you.
Let's pretend for a moment that you get the answer "qsubm is /usr/bin/local/qsubm". The next thing you should do is check what file type that is:
file /usr/bin/local/qsubm
If it's a binary executable, you're done. You can't look at it directly and your best bet is to check around on your system or on the internet for related man pages or for source code.
However, if it is "POSIX shell script executable" or "Bourne shell script" or similar, you can inspect the text file directly with less
:
less /usr/bin/local/qsubm
Use the space bar (or f
) to go forward, and b
to go back. Press q
to quit.
For alternatives to type
and more history than you probably ever wanted to read, check out:
-
To forestall inevitable corrections: Yes, I know you can inspect a binary executable directly. But for most people (unless you know machine code), that won't be useful. This is a beginner-level answer. – Wildcard Aug 09 '16 at 17:28
-
1even if you do know machine code, modern C compiler optimizations make it pretty hard to do. Not to mention modern amd64 architecture CPUs have about four gazillion instructions. – Wyatt Ward Aug 09 '16 at 19:07
-
-
1@Brambor you mean, how to locate the definition? See https://unix.stackexchange.com/q/322817/135943 – Wildcard Nov 30 '22 at 08:35
-
@Wildcard I found it by brute force, but yes. This is exactly what I was looking for :D. – Brambor Dec 04 '22 at 12:54
You can always look for command thanks to "whereis
" command and check it. If you find nothing, then this command is not a binary but rather alias. Try also write a
qsubm --help
or
man qsubm
By the way is qsubm this http://gridscheduler.sourceforge.net/htmlman/htmlman1/qsub.html ?

- 265
- 3
- 12
Also locate is a great tool to find files. It's part of the mlocate package if you're on a linux flavor. You'll have to make sure your locate database is up to date. I use /usr/libexec/updatedb to do it but updatedb might just be in your path. Then just execute:
$ locate qsubm

- 239
To amplify Wildcard's excellent answer, command -v qsubm is the POSIX-standard way to print the full pathname to an executable. That works in almost all Bourne shells nowadays, including bash. command -V qsubm produces a more verbose report if implemented, and will usually show alias definitions.
You want to use a shell built-in. The shell you're using has its own logic for executing commands, and is the best reference for what it will do. External commands such as locate and whereis do not have access to that logic, and can only make educated guesses based on common conventions.
-
locate indexes the entire filesystem and shows where the filename matches are without having to deal with $PATH. – jbrahy Aug 09 '16 at 23:14
Depends on what you mean by custom commands.
Sometimes I make custom commands by writing new bash
/sh
functions:
example ()
{
enter custom code here
}
You can retrieve the code, after the fact, with declare -f example
.
Hope that helps.

- 1,272
which qsubm
ortype qsubm
? – user4556274 Aug 09 '16 at 16:52tcsh
you may want to be careful usingwhich
– Eric Renouf Aug 09 '16 at 17:16