All Questions
115
questions
100
votes
7
answers
37k
views
How to use `which` on an aliased command?
Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance,
alias vim='vim -X'
alias grep='grep -E'
alias ls='ls -G'
The problem is ...
50
votes
5
answers
47k
views
Is it possible to include file in config file of zsh? How?
I'd like to have a file eg. f with only zsh aliases (pureness reasons). Then I'd like to include f file in my .zshrc file, so that the aliases defined in f are visible in .zshrc.
Is it possible?
If ...
40
votes
2
answers
38k
views
alias vs export for simple commands
For simple commands like less, is it better to make an alias or to export the options? Is there any benefit of one over the other?
For example, if I want less to always use the -R option to show raw ...
37
votes
2
answers
79k
views
How to reset a shell environment?
This issue has been bugging me for a while, and although I've thought I've found my answer through EnvWatcher, unfortunately it only works on Bash. And I use zsh.
I would like to replicate the things ...
29
votes
3
answers
30k
views
Escaping quotes in zsh alias
Following on from this question about stripping newlines out of text, I want to turn this into a zsh alias as follows:
alias striplines=' awk " /^$/ {print \"\n\"; } /./ {printf( \" %s \",$0);}"'
I'...
29
votes
2
answers
4k
views
How to make the zsh "correct" functionality remember my spell-correction decisions
I have enabled correction (I wouldn't call it autocorrection specifically because of this issue) in zsh by enabling setopt correct in my .zshrc.
Now, when I type dtae in a terminal, I get:
dtae ...
26
votes
5
answers
14k
views
Clear or disable aliases in zsh
I installed oh-my-zsh to make terminal use a bit easier. One thing that bugs me though is the prolific aliases added by it, like "ga", "gap", "gcmsg", "_", which are harder to remember than the ...
25
votes
4
answers
15k
views
Share aliases and PATH setting between zsh and bash
The shell that I normally use is zsh. I have several aliases to enable color in some programs such as ls and grep. I've also set my custom path so that I can execute programs in non-standard place (...
25
votes
1
answer
5k
views
how to find file defining an alias
I am having a problem I'm not sure how to get around.
Somehwhere on my system, I have an alias defined as such:
alias subl=\''/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'\'
I ...
15
votes
4
answers
13k
views
Using zsh autocompletion for alias
I have created a few aliases for git in zsh. For example: gch = git checkout, grb = git rebase --committer-date-is-author-date and some more complex useful zsh functions for git commands. But how can ...
14
votes
3
answers
8k
views
Resolve all aliases in a zsh command line
I have nested aliases and I want to resolve all of them before executing the command. How do I do that?
If there is a function that is not bound to any keys then M-x foobar is fine for me too. I ...
12
votes
5
answers
1k
views
How can I "stack" shell aliases?
In my .profile (sourced in sh emulation mode from my .zshrc) I have the following snippet:
if [ -f /usr/bin/pacmatic ]; then
alias pacman=pacmatic
fi
# Colorized Pacman output
alias pacman="...
11
votes
3
answers
6k
views
Difference between alias in zsh and alias in bash
I have searched around but could not find anything conclusive. Is there a difference between the alias command in zsh and the alias command in bash? If not, does it mean I can share a set of aliases ...
11
votes
3
answers
1k
views
Defining an alias and immediately use it
In zsh this works fine:
alias foo=ls
foo
But this does not:
alias foo=ls; foo
Pressing enter an extra time is not an issue when running interactively. But when running through ssh it suddenly ...
9
votes
3
answers
6k
views
sudo: nocorrect: command not found
I am using zsh and oh-my-zsh on Arch Linux. I am not able to make directory using mkdir
edward@ArchLinux ~ $ sudo mkdir -p /samba/raspberry
[sudo] password for edward:
sudo: nocorrect: command ...