About Linux FAQ

Browse More FAQs:

Find out if shell command is aliased or not

Posted by Vivek Gite [Last updated: May 1, 2006]

Q. Sometime I get confuges whether command is an alias or it is real command. How do I find out if shell command is aliased?

A: You need to use type command. It rells whether command is an alias, function, buitin command or executable command file.

For example:

$ type --all ls

Output:

ls is aliased to `ls --color=auto'
ls is /bin/ls

OR

$ type alias

alias is a shell builtin

So for each command, it indicate how it would be interpreted if used as a command name. You can also try out following options:

  • If the -t option is used, `type' outputs a single word which is one of alias, keyword, function, builtin, file etc
  • If the -p flag is used, `type' either returns the name of the disk file that would be executed, or nothing if `type -t NAME' would not return `file'.
  • If the -a flag is used, `type' displays all of the places that contain an executable named `file'. This includes aliases, builtins, and functions, if and only if the -p flag is not also used.
  • The -f flag suppresses shell function lookup.
  • The -P flag forces a PATH search for each NAME, even if it is an alias, builtin, or function, and returns the name of the disk file that that would be executed.

See also:

E-mail this to a friend      Printable version

Related Other Helpful FAQs:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.