Skip to main content

All Questions

Tagged with
5 votes
3 answers
6k views

Automatically put an alias into ~/.bashrc or ~/.zshrc [duplicate]

Is there a command line util/script that automatically saves aliases? E.g. save-alias my-ip="curl ipecho.net/plain" and that will define an alias, then add/update it in ~/.bashrc or ~/.zshrc I was ...
Don Manley's user avatar
14 votes
3 answers
8k views

Resolve all aliases in a zsh command line

I have nested aliases and I want to resolve all of them before executing the command. How do I do that? If there is a function that is not bound to any keys then M-x foobar is fine for me too. I ...
WeSenseASoulInSearchOfAnswers's user avatar
40 votes
2 answers
38k views

alias vs export for simple commands

For simple commands like less, is it better to make an alias or to export the options? Is there any benefit of one over the other? For example, if I want less to always use the -R option to show raw ...
skittleys's user avatar
  • 645
12 votes
5 answers
1k views

How can I "stack" shell aliases?

In my .profile (sourced in sh emulation mode from my .zshrc) I have the following snippet: if [ -f /usr/bin/pacmatic ]; then alias pacman=pacmatic fi # Colorized Pacman output alias pacman="...
strugee's user avatar
  • 15.1k
3 votes
3 answers
423 views

How to alias a command with '

I wanted to make an alias turn caps lock off: python -c 'from ctypes import *; X11 = cdll.LoadLibrary("libX11.so.6"); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display, c_uint(0x0100), ...
jinawee's user avatar
  • 187
3 votes
2 answers
856 views

Making an alias which maps arguments to the middle of the command

I want to alias killapp X to pidof X | xargs kill or kill `pidof X`, but I can't think of a way to do this with just an alias on killapp. How could I do this so I don't have to do killapp X` ?
aaazalea's user avatar
  • 193
4 votes
3 answers
8k views

zsh alias being overridden somehow

I'm on a system running OS X 10.8.5. I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon ...
Jules's user avatar
  • 2,104
50 votes
5 answers
47k views

Is it possible to include file in config file of zsh? How?

I'd like to have a file eg. f with only zsh aliases (pureness reasons). Then I'd like to include f file in my .zshrc file, so that the aliases defined in f are visible in .zshrc. Is it possible? If ...
xliiv's user avatar
  • 899
2 votes
3 answers
3k views

Executing zsh rehash after build

I have a build script that can change what binaries are in my $PATH (it doesn't edit $PATH itself, but it adds/deletes files to folders that are already in $PATH). zsh's autocompletion doesn't update ...
Joseph Garvin's user avatar
7 votes
1 answer
6k views

Zsh - alias -s with parameter

In zsh, I can specify default program to open which file extension like alias -s {mkv,mpg}='mplayer' . I runs fine but what I really want is to run mplayer <filename> & so it won't produce ...
Dzung Nguyen's user avatar
11 votes
3 answers
6k views

Difference between alias in zsh and alias in bash

I have searched around but could not find anything conclusive. Is there a difference between the alias command in zsh and the alias command in bash? If not, does it mean I can share a set of aliases ...
Zameer Manji's user avatar
37 votes
2 answers
79k views

How to reset a shell environment?

This issue has been bugging me for a while, and although I've thought I've found my answer through EnvWatcher, unfortunately it only works on Bash. And I use zsh. I would like to replicate the things ...
mhitza's user avatar
  • 566
101 votes
7 answers
37k views

How to use `which` on an aliased command?

Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance, alias vim='vim -X' alias grep='grep -E' alias ls='ls -G' The problem is ...
Adrian Petrescu's user avatar
29 votes
3 answers
30k views

Escaping quotes in zsh alias

Following on from this question about stripping newlines out of text, I want to turn this into a zsh alias as follows: alias striplines=' awk " /^$/ {print \"\n\"; } /./ {printf( \" %s \",$0);}"' I'...
Seamus's user avatar
  • 3,713
8 votes
2 answers
2k views

zsh alias expansion

Is it possible to configure zsh to expand global aliases during tab completion? For example, I have the common aliases: alias -g '...'='../..' alias -g '....'='../../..' but when I type for example ...
Bryan Ward's user avatar
25 votes
4 answers
15k views

Share aliases and PATH setting between zsh and bash

The shell that I normally use is zsh. I have several aliases to enable color in some programs such as ls and grep. I've also set my custom path so that I can execute programs in non-standard place (...
phunehehe's user avatar
  • 20.3k

15 30 50 per page
1 2
3