All Questions
116
questions
1
vote
2
answers
5k
views
How do I search my zsh aliases?
Right now I do something like this:
cat ~/.oh-my-zsh/plugins/git/git.plugin.zsh | grep alias | grep rebase
to search, say, git aliases that have rebase. How do I search through all plugins that ...
1
vote
1
answer
826
views
alias -g '${1+"$@"}'='"$@"', what does it do?
Most makefile have this strange set of symbols '${1+"$@"}'. $@ is the makefile target filename. But why does, people try to use the complex symbol like '${1+"$@"}'?
1
vote
2
answers
20k
views
zsh: When running source I get zshrc:116: unmatched
So today I wanted to add some extra alias to zsh.
I did the usual
nano ~/.zshrc
and added my alias
ex:
alias desktop="cd desktop"
(I've doubled checked that all variables for typos)
Ctrl+...
1
vote
1
answer
864
views
How can bash aliases be configured to handle spaces in directory names? [duplicate]
The alias below works well in zsh when spaces in directory names are \ escaped, but bash doesn't handle them properly. What changes would be required to make them work with bash properly.
dum() {
...
1
vote
2
answers
926
views
How can I/Should I default flags when running a command?
For context, I'm using zsh. Every time I use locate, I want to pass the -i and -A flags.
Usually, if I can get away with it, I create an alias with the same name as the existing command to do this. ...
1
vote
3
answers
3k
views
How do I make an alias for a command with sudo
I want to add two aliases, so one executes a command when non sudo, and the other executes a command when sudo, like this:
alias v = 'nvim'
alias 'sudo v' = 'sudo -E nvim '
I also have set alias sudo=...
1
vote
1
answer
109
views
How can I remove aliases "which-command=whence" and "run-help=man"?
I'm running Artix Linux and using zsh, and these two aliases return no matter how many times I unalias them or remove them from my aliasrc:
run-help=man
which-command=whence
And they don't exist in ...
1
vote
2
answers
380
views
In zsh how to set an alias for `less` to get stderr output?
I find that there is a "global alias" for zsh. so when I set
alias -g L='| less'
command L will be replaced with command | less.
But it seems that it cannot work with stderr output when I set
...
1
vote
1
answer
144
views
Converting a tcsh alias into zsh
I had a tcsh alias as follows:
alias cdd 'cd `dirname \!*`'
I use this to change the directory to the one containing a certain file.
For instance,
cdd /Users/myself/Document/Folder/File.pdf
would ...
1
vote
1
answer
268
views
How to write a function that takes an argument string that does not need to be quoted?
I'm writing a function, adding it to ~/.zshrc on my Mac. It's in order to more quickly handle commands to youtube-dl.
I have this:
function dlv()
{
cd /Users/admin/Downloads
youtube-dl ...
1
vote
2
answers
249
views
Kill all processes macthing a pattern, ignoring case
I want to have an alias to do something like pkill -f PATTERN but ignoring the case of the pattern. This is what I have after looking around but it's not working
alias pkf="kill `ps ax | grep -i $...
1
vote
1
answer
157
views
How not to use nested strong quotes (')
I'm a relatively new user of zsh and don't know too much about shells (unfortunately). Nonetheless, I would like to define an alias in my .bashrc containing a hash. However, zsh doesn't seem to like ...
1
vote
1
answer
172
views
How to send output to next input line?
This my snippet alias hst="history 1 -1 | cut -c 8- | uniq | fzf ".
when I run hst
The output is
$ ~ hst
(the output from hst)
$
This is what I want
$ ~ hst
$ (the output from hst)
Example
...
1
vote
2
answers
189
views
Make alias from existing alias
I have 2 separate files, which are both sourced from my .zshrc, one of them (the first one) is defining this alias:
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
problem is that ...
1
vote
1
answer
443
views
Setting up aliases for a history expansion pattern
similar to the existing $_ which I learned stands for !-1:$, I would like to create aliases for $__, $___ and so on which refer to the 2nd or 3rd -last command. I have tried adding
alias "$__"='!-2:$'...