Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9124477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:34:48+00:00 2026-06-17T06:34:48+00:00

By using zsh for some time along with oh-my-zsh framework, I noticed that which

  • 0

By using zsh for some time along with oh-my-zsh framework, I noticed that which command behaves different in zsh, than in bash.

What I mean:

# on zsh
ilias@ilias-pc ~  ➜ which ls
ls: aliased to ls --color=auto
ilias@ilias-pc ~  ➜ which which
which: shell built-in command
ilias@ilias-pc ~  ➜ bash
[ilias@ilias-pc ~]$ which ls
/usr/bin/ls
[ilias@ilias-pc ~]$ which which
/usr/bin/which
[ilias@ilias-pc ~]$ 

Why does this happen and how can I “fix” it?

PS. I reproduce this on Arch Linux (not sure whether it matters but I mention it).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:34:49+00:00Added an answer on June 17, 2026 at 6:34 am
    $ zsh -c 'type which'
    which is a shell builtin
    $ bash -c 'type which'
    which is /usr/bin/which
    

    The solution is to not use which(1), which is a non-standard and not very useful command. The question of what you should use instead isn’t the most straightforward due to the alternatives being poorly specified and inconsistently implemented, but they are better than which.

    Depending on your requirements, you want command (see the -v option), type, or whence. See POSIX for the former two, or your shell manual for the latter. (Bash doesn’t support whence, but it is supported by most other ksh derivatives, albeit inconsistently. It typically has the most features).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am usually using zsh, which provides the chpwd() hook. That is: If the
I'm using oh-my-zsh and wanted to write a small plugin which would executes command
I've recently switched over from using the Bash command prompt to Zsh on Mac
I want to adjust zsh so that I can tab complete: myprog <tab> using
I've just started using ZSH with Cygwin/rxvt today (along with a default install of
I am using Makefiles. However, there is a command (zsh script) I want executed
How do I iterate over all the lines output by a command using zsh,
I've been using Zsh as a Bash replacement for a while now. One thing
I'm new to zsh and am using the ZSH_THEME=jnrowe, which works great for a
I have been using 'bash' since the time I have been using Unix- Linux/Solaris.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.