All Questions
116
questions
0
votes
1
answer
40
views
zsh alias does not complete fully if not sourced once a day
vi ~/.zsh
alias k='kubectl'
complete -o default -F __start_kubectl k
alias kga='k get all,ingress'
If I do not source .zsh every day it does not take into account the ingress part of the kga alias. ...
2
votes
0
answers
45
views
Can't unalias then redefine as a function in the same conditional [duplicate]
Here is a simplified implementation of an issue in my bash/zsh aliases file:
alias foobar='echo bar' # this is out of my control
if true; then
unalias foobar
echo we got inside the conditional
...
0
votes
1
answer
75
views
Zsh zinit load OhMyZsh plugin skipping aliases
I want to use these plugins using zinit to load git completions in zsh
zinit wait lucid for \
OMZL::git.zsh \
OMZP::git
But I don't care about the aliases, there are really too much aliases I ...
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 ...
1
vote
2
answers
124
views
alias defined in .zshrc does not propagate to shell script
I have python installed on my system as python3. In my .zshrc file I defined following alias:
alias python=python3
With this, I am able to run python3 using python on the command-line:
$ python
...
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 ...
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 ...
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 ...
0
votes
1
answer
240
views
zsh: alias'd commands stop working
This keeps happening and I'm not sure why. How do I trace what zsh is actually trying to do, and why it starts ignoring my alias?
************@*******-MacBook-Pro$ reload
zsh: command not found: ...
2
votes
1
answer
75
views
Alias + and - in zsh?
For years I've used + and - as aliases for pushd and popd in both csh and bash. I've finally given up on my Macs and want to switch to zsh but I haven't been able to find a way to make these aliases. ...
0
votes
1
answer
448
views
How to list only the aliases defined by the user?
I'm using the ZSH and defined some aliases (stored in multiple fines, that are loaded in the ~/.zshrc). That is working fine. Executing the command alias allows to list all available aliases.
Now I'd ...
2
votes
1
answer
361
views
Alias piping into awk
I am trying to create an ll with awk pipe alias. I am trying to escape the apostrophes using the following answers.
alias lh= `ll -h | awk {'print $9, \"-\" ,$5, \"-\", $8, \"...
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
0
answers
116
views
can we trigger some action if we `cd` into directory? [duplicate]
I have multiple projects over various languages like JavaScript, Python. I wonder if Linux provides some functionality to trigger some actions automatically if we cd into a particular directory?
For ...
1
vote
2
answers
1k
views
/etc/zshrc is not applied when log in
I have no idea why having aliases that are applied to all interactive terminal (i.e., my user account and sudo) is so difficult. Most web search result were about BASH, but my shell is ZSH (Manjaro ...
0
votes
0
answers
302
views
Custom alias outside .zshrc but ZSH_CUSTOM doesn't work in kali
For reference this is not a duplicate: I reviewed other Q and A like this but it doesn't work for me.
Background:
I'm using Kali in parallels.
To keep my .zshrc file tidy I decided to mkdir ...
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
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. ...
0
votes
1
answer
324
views
Add heredoc (<<) to end of alias within function call
I have an alias which is my psql connection string for a database, let's say the alias is this:
alias GQQ='psql "host=$host user=$redshift_uname dbname=$redshift_dbname port=$port pass word=$...
1
vote
2
answers
397
views
zsh: alias or shell function to only echo its command line, including shell control characters
Using zsh, I'd like to create an alias or a shell function that operates as follows:
I want this alias or shell function to echo its command line without honoring any shell control characters such as &...
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 ...
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 ...
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
303
views
!!: command not found
Recently, I was getting a bit frustrated about not running commands as admin, and started using sudo !! a lot. I decided that, for ease of use, I'd create an alias ffs for that exact line. I added the ...
0
votes
2
answers
151
views
How to get 'man gfind' when I enter 'man find'?
On my new-ish mac os/Darwin system, my find tool is an 11-year-old BSD version. I have used MacPorts to install a more current version: GNU's find, which MacPorts has named gfind, and placed in /opt/...
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
...
0
votes
1
answer
195
views
Usig zsh glob variable not expanding inside alias
I want to list and sort by time, all the files matching a certain pattern and then get only the first 20:
ls -laths *.txt | head -20
This works well, for example if I create two files:
touch 1.txt
...
1
vote
0
answers
796
views
When does /usr/share/zsh/vendor-completions get loaded?
As far as I can tell, my .zshrc doesn't manually source anything in /usr/share/zsh/vendor-completions. If I try to write, in my .zshrc, an alias for a command that has completions set up in /usr/share/...
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,...
1
vote
1
answer
772
views
How can I get aliases and functions descriptions?
I use oh-my-zsh and I have many aliases and functions I can't remember, so I use alias ag="alias | grep" to find out what an alias does. I also use alias-tips. But instead of getting the ...