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.
927 questions
326
votes
25
answers
284k
views
How to have tail -f show colored output
I'd like to be able to tail the output of a server log file that has messages like:
INFO
SEVERE
etc, and if it's SEVERE, show the line in red; if it's INFO, in green. What kind of alias can I setup ...
442
votes
16
answers
90k
views
In Bash, when to alias, when to script and when to write a function?
Noone should need 10 years for asking this question, like I did. If I were just starting out with Linux, I'd want to know: When to alias, when to script and when to write a function?
Where aliases are ...
0
votes
2
answers
208
views
How to prevent side effects when using an alias (e.g. cat aliased to batcat)?
I want to alias cat to batcat. Yet I do not want to break any script on my system that may depend on cat.
How to ensure that it won't break existing scripts?
I am on an Ubuntu machine on a bash ...
134
votes
36
answers
76k
views
Quick directory navigation in the bash shell
I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/.
But I don't want to type cd /[full-path]/...
0
votes
1
answer
136
views
How to wrap source command in tcsh
I need a solution only for tcsh.
Say I have a source file that sources other files which in their turn can source other files. My goal is to track which files were eventually sourced. One way I can do ...
1
vote
2
answers
180
views
How can I temporarily bypass an alias of a keyword in Bash?
If I alias a keyword, I can't figure out how to bypass it.
$ alias if='echo "GOTCHA!"; if'
$ if true; then echo y; fi
GOTCHA!
y
The usual tools for bypassing an alias, like escaping, ...
5
votes
3
answers
2k
views
'which' vs. 'type -a'
There is a 2022 article by a guy who is a senior developer, and there he has the following alias in his zsh config:
alias which='type -a'
But zsh has which by default, and if we use this which like ...
-1
votes
2
answers
211
views
Unable to Execute Multiple Alias Commands Simultaneously
I'm encountering an issue where I'm unable to execute multiple alias commands at the same time in my shell environment. For example, when I try to run two alias commands together, only one seems to ...
-1
votes
1
answer
118
views
Why doesn't bash recognize alias in interactive mode?
How is this possible?
styx@LouSTyx:…$ GCOM "\pushdict now ignores prefix macro."
GCOM : commande introuvable
styx@LouSTyx:…$ type GCOM
GCOM est un alias vers « git commit -a -m »
0
votes
1
answer
140
views
Unavailable executable still remains
Please note: This is not a question related to pip or python.
I am trying to make sense of why I see a "permission error" instead of "path not found" error.
I have done many ...
0
votes
2
answers
232
views
In a bash alias, how do I run "apt autoremove" automatically after "apt upgrade" only if needed?
I have two alias in my Debian's .bashrc:
alias upd='sudo apt update && apt list --upgradable'
alias upg='sudo apt upgrade'
Then I use upd to update and display all upgradable packages, and ...
225
votes
9
answers
58k
views
Run a command that is shadowed by an alias
Let's say I have the following alias in bash - alias ls='ls --color=auto' - and I want to call ordinary ls without options. Is the only way to do that is to unalias, do the command and then alias ...
355
votes
5
answers
305k
views
Why doesn't my Bash script recognize aliases?
In my ~/.bashrc file reside two definitions:
commandA, which is an alias to a longer path
commandB, which is an alias to a Bash script
I want to process the same file with these two commands, so I ...
0
votes
1
answer
94
views
Alias for rm does not include file name with @$ [duplicate]
I am trying to create an alias for the rm command in the /root/.bashrc file on a VirtualBox Redhat VM (running RHEL 9). I cannot get it to work properly. This is an excerpt of my .bashrc file:
alias ...
1
vote
1
answer
169
views
Bash profile seems not to be loaded when -c option is present
There are a fair bit of similar questions, but I can't find spec for this particular case.
I'm writing a shell script to verify bash configuration. For exmaple, I add test_alias to ~/.bashrc, which is ...