Skip to main content

All Questions

Tagged with
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 ...
Adam Katz's user avatar
  • 4,012
0 votes
1 answer
65 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 ...
fchastanet's user avatar
1 vote
2 answers
109 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 ...
morpheus's user avatar
  • 115
1 vote
1 answer
105 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 ...
swishkin's user avatar
1 vote
1 answer
140 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 ...
leparc's user avatar
  • 13
0 votes
1 answer
233 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: ...
Harv's user avatar
  • 2,144
2 votes
1 answer
74 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. ...
sfjac's user avatar
  • 123
0 votes
1 answer
440 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 ...
automatix's user avatar
  • 219
2 votes
1 answer
356 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, \"...
zerberus's user avatar
1 vote
1 answer
267 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 ...
Alfie Stoppani's user avatar
1 vote
0 answers
115 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 ...
Visrut's user avatar
  • 137
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 ...
Damn Vegetables's user avatar
1 vote
2 answers
247 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 $...
user avatar
0 votes
1 answer
315 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=$...
amstergc20's user avatar
1 vote
2 answers
907 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. ...
Daniel Kaplan's user avatar
1 vote
2 answers
389 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 &...
HippoMan's user avatar
  • 647
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 ...
pahohu's user avatar
  • 111
0 votes
0 answers
301 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 ...
ShifraSec's user avatar
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=...
Ramita's user avatar
  • 11
1 vote
1 answer
170 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 ...
Jamm Utkarsh's user avatar
0 votes
2 answers
150 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/...
Seamus's user avatar
  • 3,062
0 votes
1 answer
193 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 ...
Santiago's user avatar
  • 418
1 vote
0 answers
791 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/...
2rs2ts's user avatar
  • 163
1 vote
0 answers
21 views

Unable to iterate over files using ZSH alias [duplicate]

I have simple command to iterate JPG files for f in *.JPG;do echo "Processing $f";done The terminal output is as follows: Processing IMG_0316.JPG Processing IMG_0317.JPG Processing IMG_0318....
xssknix's user avatar
  • 11
0 votes
1 answer
63 views

How can I know which are my most used aliases?

I would like to know which aliases I use most often, in both zsh and vim, so I can rename them to have more or fewer letters depending on the use. And also to remove aliases I never use, because I ...
user avatar
1 vote
1 answer
757 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 ...
user avatar
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,...
mtk's user avatar
  • 27.8k
9 votes
1 answer
6k views

How to overwrite aliases in my shell (Oh My Zsh)?

I would like to alias my ls command, but there is a previously defined alias for it which I believe gets invoked first before my definition! I am using .zshrc to define my alias, and here is what I ...
Farhad's user avatar
  • 93
0 votes
1 answer
501 views

zsh alias not being unaliased in zshrc

[leading dots elided because I don't want to type them] An alias--gl--is set to git pull by a plugin in my zshrc. I want to set it to a git log command. I'm on macOS and, as expected, /etc/zshrc is ...
meangrape's user avatar
  • 136
2 votes
2 answers
400 views

create an alias on ZSH but need to type it twice

I'm trying to create an alias on ZSH. The aim of the alias is to activate a python virtualenv. I've put a line in my .zshrc alias SOU="source /home/andykw/.zshrc && source $(setopt ...
Andy K's user avatar
  • 179
1 vote
1 answer
286 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 ...
Dion's user avatar
  • 113
0 votes
1 answer
197 views

How to have everything following a ZSH alias be placed in the middle of its definition?

I have this file: /Users/MYUSERNAME/asciidots/asciidots/__main__.py I want to alias this so that it runs as if it was in my current directory. I was thinking something like this: alias asciidots=&...
CATboardBETA's user avatar
2 votes
2 answers
150 views

Create new set of aliases based on current set of aliases (eg. gst -> dst)?

I'm using git aliases from zsh plugins: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git So it has git aliases like: gst # git status ga # git add gc "commit" # git commit -v "...
Yuchen Zhang's user avatar
2 votes
2 answers
956 views

Why do I have to use this command twice to execute it?

I made an alias alias goto="cd $@ && source ~/.zshrc" and it works, but only if I execute it twice. Even after I execute it twice in one shell, and if I want to move to another dir, ...
Leo1807's user avatar
  • 23
0 votes
0 answers
19 views

Generate zsh aliases from zsh script [duplicate]

I wrote a simple script for generating aliases in zsh shell. Here it is: for subject in $(find $path -maxdepth 2 -type d -print) do dir=$(printf -- "$subject\n" | sed 's|.*/||') alias &...
Fedja's user avatar
  • 115
2 votes
2 answers
748 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 ...
Faraz Durrani's user avatar
0 votes
1 answer
736 views

Defining zsh aliases and functions systemwide

What's the most efficient way to export the functions/aliases defined in my .zshrc to be used anywhere. For example in my .zshrc _foo() { echo "bar" } And then invoke _foo in any script.
Belka h.j's user avatar
0 votes
0 answers
90 views

Conditional Git alias within zsh: "parse error: condition expected: cd" [duplicate]

I'm trying to implement a simple stack of git-related aliases for my personal dotfiles. alias gs="[[ $(git rev-parse --is-inside-work-tree &> /dev/null) ]] || cd $D && git status -...
bmilcs's user avatar
  • 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+...
fridavbg's user avatar
0 votes
1 answer
454 views

Do zsh aliases lower terminal performance?

I really make use of aliases and I've started to create some function aliases which are made of only one if..else case. For instance, I have the following alias to start my json-server: jsp() { ...
mddg's user avatar
  • 103
0 votes
1 answer
275 views

Setting an alias for copying the current path from shell to clipboard fails [duplicate]

I have added the following alias to my .zshrc: alias pwdc="echo -n $PWD | xclip -selection clipboard" it seems the present working directory is not getting updated, when I move to a ...
JammingThebBits's user avatar
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 ...
ItsDrike's user avatar
  • 123
1 vote
1 answer
425 views

gcloud setting up zsh alias

I was trying to set up some alias command and function for gcloud. I have written below function and running it in zsh in mac. It runs fine when I pass c and i as individual arguments but not when I ...
Learner's user avatar
  • 267
0 votes
1 answer
82 views

Scaping single quota in zsh alias

I like create any alias for docker commandas, and I need any alias use single quotes. I see post Escaping quotes in zsh alias but not work for me. Tried in .zshrc function dinfoip() { docker ...
Abdel Karim Mateos Sanchez's user avatar
2 votes
2 answers
1k views

Execute zsh alias when name contains a hyphen

A stock-standard zsh behaves as follows with an alias with a - in it, eg: a-a: % zsh -f svelte% alias a-a=date svelte% a-a Sun 19 Jul 2020 17:20:05 +07 My configuration has it behave as follows: % ...
Tom Hale's user avatar
  • 31.2k
3 votes
2 answers
941 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
vimdiesel's user avatar
2 votes
1 answer
943 views

Aliases don't work in interactive zsh

I have a curious problem where my aliases are listed when I type alias, but they are not executable. Here, I try to alias d to date: % which alias alias: shell built-in command % alias d=/usr/bin/...
Tom Hale's user avatar
  • 31.2k
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 ...
nonopolarity's user avatar
  • 3,109
1 vote
2 answers
4k 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 ...
Neil G's user avatar
  • 218
0 votes
1 answer
365 views

Having sudo and non-sudo parts in an alias - why does it not work with >>?

I was trying to use an alias which should run two commands, where the first is fine to be run with normal user privileges and the second one needs sudo privileges. alias hosts-get="scp [email protected]:...
Sono's user avatar
  • 131

15 30 50 per page