All Questions
25 questions
0
votes
1
answer
53
views
zsh, .bash_profile, and aliases
I have a script downloaded from the Internet, the beginning of which looks like this:
echo "alias myip='curl -s https://api.ipify.org/'" >> ~/.bash_profile
echo "alias myiplookup='...
2
votes
0
answers
47
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
...
1
vote
2
answers
620
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
...
2
votes
1
answer
85
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. ...
2
votes
1
answer
439
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
0
answers
125
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 ...
0
votes
1
answer
467
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
3
answers
4k
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=...
5
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,...
2
votes
2
answers
793
views
How to add an alias for 'git add **/'
I can't seem to add an alias for git add **/
I think those two asterisks is causing an issue, or it could be that forward slash. How do I solve this?
So far I have tried
alias ga='git add **/'
When ...
3
votes
2
answers
1k
views
How to create an alias that launches zathura with tabbed
So tabbed outputs it's xid when you run it. How could I put this into an alias dynamically?
I'm looking to do something like:
alias zathura = tabbed -c zathura -e ${tabbed Xid goes here} & disown
5
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 what ...
0
votes
1
answer
356
views
What is the best way for storing and versioning his aliases/functions/symlinks?
actually I have these lines (exemplary) in my .zshrc file:
. ${TOOLS_HOME}/cli/.cli_base
. ${TOOLS_HOME}/cli/.cli_functions
. ${TOOLS_HOME}/cli/.cli_symlinks
This works fine so far. My only problem ...
7
votes
6
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 ...
0
votes
2
answers
1k
views
Alias when not first word: `G='|grep'` then `command G grep-string`
I find myself typing | grep and | less a lot, and was wondering if there was any way to be able to do something like:
alias G='| grep -E' # egrep is deprecated
alias L='| less'
So I could do ...