The alias built-in in shells, used to define shortcuts for frequently used commands.
8
votes
2answers
309 views
Change directory without typing cd?
Is it possible to make bash change directory in command line simply by typing that directory without any commands like cd?
For example is it possible instead of writing this:
$ cd /tmp
I just want ...
10
votes
1answer
2k views
How do I get bash completion for command aliases?
I am looking to get tab-completion on my command line aliases, for example, say I defined the following alias :
alias apt-inst='sudo aptitude install'
Is there a way to get the completions ...
10
votes
1answer
905 views
bash functions vs scripts
This site says, "Shell functions are faster [than aliases]. Aliases are looked up after functions and thus resolving is slower. While aliases are easier to understand, shell functions are preferred ...
16
votes
3answers
4k views
How to pass parameters to an alias?
For bash script, I can use "$@" to access arguments. What's the equivalent when I use an alias?
12
votes
3answers
1k 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 ...
3
votes
2answers
686 views
How can I simulate keyboard shortcuts in a bash alias?
For example, one of my bash aliases is this
alias p='clear;ls -lt;pwd;'
clear also clears the history which I don't want. I just want to clear the screen momentarily.
Ctrl+L however does exactly ...
15
votes
5answers
9k 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 ...