Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ZSH not recognizing my aliases?

Using iTerm2 with zsh and it isn't recognizing my aliases. Sometimes I have to work in an IDE and can't just easily vim something and the stupid people thought it a good idea to name their applications like MyReallyLongApplicationName.app and since .html files open by default in browsers, I have to:

open -a MyReallyLongApplicationName.app something.html 

I have an alias in my .zshrc like:

alias ide="open -a MyReallyLongApplicationName.app" 

But zsh won't recognize my aliases. I tried another one just to see if it was me but none of the aliases I create are recognized. Just get "zsh: command not found: ide" or whatever.

So I'm not sure what I'm doing wrong and I've been searching around all day trying to fix things in zsh and the like. As a note, I'm not a pro at Linux/Unix systems so if you're too technical and vague I probably won't understand what you're telling me.

Thanks!

like image 798
o_O Avatar asked Jan 11 '13 21:01

o_O


People also ask

How do I add an alias to zsh?

To set up a simple alias, edit the ~/. zshrc file using your text editor and add an alias at the bottom. It is good to keep all your aliases in a single section of the file to avoid confusion and ease of edit. alias ginit="git init ."

Is zsh better than bash?

Zsh is more interactive and customizable than Bash. Zsh has floating-point support that Bash does not possess. Hash data structures are supported in Zsh that are not present in Bash. The invocation features in Bash is better when comparing with Zsh.

Where do I put shell aliases?

You need to put bash shell aliases in the ~/. bashrc file ($HOME/. bashrc) file executed by bash for non-login shells. On most modern Linux distros, you may want to put all your bash alias definitions into a separate file like ~/.

Which shells support aliases?

An bash shell alias is nothing but the shortcut to commands. The alias command allows the user to launch any command or group of commands (including options and filenames) by entering a single word. Use alias command to display a list of all defined aliases. You can add user-defined aliases to ~/.


1 Answers

if you do a very simple alias in zsh, does it work? open your .zshrc file, and add the following line:

alias ls='ls -GpF' 

after adding that line, type this line in your Terminal:

source ~/.zshrc 

tell us what happens. Also, just for shiggles, make sure you are using single quotes vs. double quotes, I have seen that make a difference in the past on different versions of shells/OS/whatnot.

like image 156
ShawnW. Avatar answered Oct 06 '22 08:10

ShawnW.