All Questions
116
questions
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 ...