Questions tagged [alias]
An alias is essentially nothing more than a keyboard shortcut, an abbreviation, a means of avoiding typing a long command sequence. This can save a great deal of typing at the command-line and avoid having to remember complex combinations of commands and options.
903
questions
0
votes
1
answer
34
views
Get a list of all user's commands from a non-interactive shell
I am writing a script that would automatically suggest some new aliases/functions to be added to a user's shell config. Before doing that, however, I would like to make sure the aliases being ...
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. ...
0
votes
2
answers
79
views
How to write an alias or bash script that renames a single file using the same syntax as the `ren` command of Windows?
I am a long-term a Windows user, so I find the syntax of the ren command both simple and convenient:
ren C:\pathTo\myFile\oldFileName.txt newFileName.txt
I want to be able to use the same syntax on ...
4
votes
1
answer
997
views
Are there alternatives to alias I'm not aware of?
Today I started to notice weird behavior running a local command for a binary installed through Go. It seems the command is aliased, but consulting alias, it isn't.
The command buf somehow executes cp!...
3
votes
2
answers
296
views
how to alias the `history` function in fish shell
I'm trying to set the fish history pager to be bat -l fish for syntax highlighting.
(i.e. set the PAGER environment variable bat -l fish just for the history command).
I tried:
# 1:
alias history &...
0
votes
2
answers
37
views
How to escape both single quotes and exclamation marks in bash
I have a long command and I just want to use alias to shorten it. But the command contains single quotes and exclamation marks.
The origin command is ldapsearch -x -H ... -w 'abc!123'.
I tried 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
2
answers
83
views
Is it possible to use a command with an argument to trigger a bash alias?
I have a program that tries to trigger a screenlock using the following commands:
xdg-screensaver lock
xscreensaver -lock
cinnamon-screensaver-command --lock
The problem is that I'm using ...
0
votes
1
answer
76
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 ...
0
votes
1
answer
57
views
Is there a way I can use .bash_aliases in a shell-scripts? [duplicate]
Is there a way I can use bash aliases from my .bash_aliases file within a shell-scripts?
I thought of something like including
source "$HOME/.bash_aliases into my script
but it does not work.
0
votes
1
answer
54
views
How can I call git's built-in diff command directly after configuring a different visual "git diff" substitute?
I have configured git diff to be a command that calls substitute diff for viewing file differences i.e /usr/bin/vim -dR "$2" "$3" and that doesn't work when I want to create a ...
0
votes
1
answer
92
views
Can I reprogram the pwd command to add a trailing slash?
WHen I use the pwd command, it prints e.g /opt instead of /opt/. I would like it to print the trailing slash. However, I tried adding the following line to my ~/.bash_aliases file:
alias pwd=" ...
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 ...
0
votes
1
answer
68
views
Can i used these aliases in some sort of config file?
I have many of these kinds of aliases, the part before = is the host in ssh config
alias sshConfigHost='ssh -t hostname docker exec -it containerName bash'
Could I add these to some sort of config ...