Skip to main content

All Questions

Tagged with
9 votes
1 answer
6k views

How to overwrite aliases in my shell (Oh My Zsh)?

I would like to alias my ls command, but there is a previously defined alias for it which I believe gets invoked first before my definition! I am using .zshrc to define my alias, and here is what I ...
Farhad's user avatar
  • 93
8 votes
2 answers
2k views

zsh alias expansion

Is it possible to configure zsh to expand global aliases during tab completion? For example, I have the common aliases: alias -g '...'='../..' alias -g '....'='../../..' but when I type for example ...
Bryan Ward's user avatar
7 votes
5 answers
6k views

Get the expansion of an alias (in both bash and zsh)

I want to get the expansion of an alias. For example, if I have: alias g=hub alias cdh='cd $HOME' I want to have: expand_alias g == hub expand_alias cdh == cd $HOME The tricky thing is that the two ...
Tom Hale's user avatar
  • 31.2k
7 votes
3 answers
1k views

What is causing `diff` to run `git diff`?

I'd like to use diff as described here and in the documentation I see when I type man diff. However, when I type diff, what I get is this: ~ ❯❯❯ diff usage: git diff --no-index <path> <path&...
Ben Saufley's user avatar
7 votes
5 answers
6k views

Is it possible to define directory-sensitive aliases in zsh (or any other shell)?

I want to use different aliases (or perhaps: the same alias differently) depending on the current working directory. For example, I might want to use l as a shorthand for ls with some extra options. ...
k.stm's user avatar
  • 719
7 votes
1 answer
6k views

Zsh - alias -s with parameter

In zsh, I can specify default program to open which file extension like alias -s {mkv,mpg}='mplayer' . I runs fine but what I really want is to run mplayer <filename> & so it won't produce ...
Dzung Nguyen's user avatar
6 votes
2 answers
4k views

Make "." and "source" default to ~/.zshrc

I would like to source my ~/.zshrc by running . with no arguments. So this: $ . should do this: $ . ~/.zshrc I would like the normal functionality of . to remain unchanged. The only difference ...
Resigned June 2023's user avatar
6 votes
1 answer
3k views

What's the intended use case for COMPLETE_ALIASES in zsh?

For some months now, I have had setopt completealiases in my .zshrc. I haven't the faintest idea why I added it - most other things have comments or can be understood from neighbouring settings. ...
muru's user avatar
  • 73.9k
6 votes
1 answer
3k views

Run one command after another in zsh when Ctrl-C is pressed

I have recently moved to zsh from bash (on OSX). I have an bash alias I have used to run one program then another (even if previous program exits with error) on bash. I can't work out how to ...
ravenshill's user avatar
5 votes
3 answers
6k views

Automatically put an alias into ~/.bashrc or ~/.zshrc [duplicate]

Is there a command line util/script that automatically saves aliases? E.g. save-alias my-ip="curl ipecho.net/plain" and that will define an alias, then add/update it in ~/.bashrc or ~/.zshrc I was ...
Don Manley's user avatar
5 votes
2 answers
3k views

Forward aliases to child process

I have some aliases which are defined in /etc/zprofile (or /etc/profile for bash). Also $PATH gets manipulated there. I want to start an interactive shell from a shell which avoids the $PATH ...
pseyfert's user avatar
  • 888
4 votes
1 answer
584 views

How to trigger a 2nd command when a specific command is run in the shell?

I'll explain my question with example. I run $ python manage.py to perform some action. I want to run another command $ xyz , just when any user runs the previous command. Thus, from now on, ...
yask's user avatar
  • 153
4 votes
3 answers
8k views

zsh alias being overridden somehow

I'm on a system running OS X 10.8.5. I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon ...
Jules's user avatar
  • 2,104
4 votes
3 answers
2k views

Automatically source a file when `cd` into a specific directory

I have couple of utility commands-and-aliases that are generic enough in any directory for my own requirement. But there are certain directory e.g. 'build', where I need a custom behaviour. To do this,...
mtk's user avatar
  • 27.8k
4 votes
4 answers
5k views

Does Bash and Zsh have a mode to echo what the alias expands to upon pressing Enter?

For example, if I have a alias dbmigrate='rails db:migrate' is there a mode or simple way to configure in Bash and Zsh so that when I type in the shell: $ dbmigrate # press Enter it will echo ...
nonopolarity's user avatar
  • 3,109

15 30 50 per page
1
2
3 4 5
8