The alias built-in in shells, used to define shortcuts for frequently used commands.
5
votes
2answers
151 views
Mailman / Postfix Configuration Assistance
I am writing for some help regarding Postfix configuration.
I cannot seem to get Postfix configured properly to transfer mail to the mailing list installed on the same server. I followed many steps ...
4
votes
3answers
93 views
How to alias cp with cp -i by default
Is there a good way to alias the command cp file1 file2 to cp -i file1 file2?
Apologies if this is a dumb question, I'm a Unix novice.
2
votes
1answer
261 views
tcsh alias - find FreeBSD port
I am trying to create an alias for tcsh. I would like to find a program in ports (FreeBSD ports).
So far I made an alias, which works, but finds only ports which end in *port_name. I would like it to ...
0
votes
1answer
53 views
where to (apt-get) install aliases system-wide?
I am making a Debian package that contains bash aliases.
Where should these aliases be installed, so that they are available system-wide?
The "right" place would be /etc/bash.bashrc, but this file ...
0
votes
0answers
59 views
Using an alias or function to run process in background, with dot files [closed]
Drews-MacBook-Pro:5493040 drewgross$ function s() { subl "$@" & }
Drews-MacBook-Pro:5493040 drewgross$ s .profile
[1] 1268
-bash: .profile: command not found
Drews-MacBook-Pro:5493040 drewgross$
...
18
votes
5answers
10k 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 ...
1
vote
2answers
102 views
how to change `rm` to as a command like `mv ~/ .trash` [duplicate]
I like to use rm
but I often made mistakes so that I remove something mistakenly
so I want to make somthing like mv .trash
so that
rm file
is equal to
mv file ~/.trash
besides, I also ...
62
votes
12answers
13k 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 ...
4
votes
5answers
123 views
How to use ' in alias?
I have one-line that I want to call using alias.
while printf '%s ' "$(df -P / | awk 'NR==2 { print $(NF-1) }')"; do sleep 30; done
I tried to escape ' like \' but it didn't work.
What is the ...
2
votes
0answers
73 views
.bashrc alias not working [closed]
I have set up a few aliases in my .bashrc file, like the following:
alias ras='rails server'
alias res='redis-server'
alias rc='rails console'
alias be='bundle exec'
# git alias's are as follows
...
1
vote
3answers
78 views
In bash, how can I erase an alias without logout? [duplicate]
I had an alias in my .bashrc and I really don't want it anymore. I erased the alias, but my bash already has this alias loaded.
Can I erase this alias from this bash without logging out?
0
votes
2answers
46 views
Difference between eval and alias commands
what are the differences between eval and alias commands?
Examples:
x=‘ls -d -l $HOME’
$x
eval $x
alias y=‘ls -l -d $HOME’
y
2
votes
2answers
33 views
How can I set a bash alias that evaluates $() when run?
I set up an alias:
alias gpgagentexport="eval $(cat ~/.gpg-agent-info) ; export GPG_AGENT_INFO"
However when I source my .bashrc the $(cat ...) is evaluated at that point. But I want to evaluate ...
1
vote
2answers
97 views
How do I set bash aliases and variables from within vim?
In cmdline mode, the following examples do not work for me.
!alias lol='echo lol'
!lol='echo lol'
0
votes
1answer
66 views
Command substitution in alias resolved in bash profile? [duplicate]
I want to make an alias for randomly changing my mac address
alias chrandmac="sudo ifconfig en0 ether $(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')"
but the command substitution part is ...
1
vote
1answer
96 views
How to create an alias that takes an argument in KornShell
I am trying to create an alias which when given some argument will look for the folder with contains the argument as pattern. Let the alias name be gohf.
Now, I will be using this alias like gohf ...
3
votes
2answers
64 views
How to create an alias, but so I can enter in different info with the command [duplicate]
Hi I was wondering I have to run some rather long commands all day. I know how to create aliases for the commands, but the problem I am having is each command contains different IP address in the ...
19
votes
6answers
487 views
Why is aliasing over standard commands not recommended?
For example, a common alias I've seen in the ~/.bashrc file (or equivalents) is
alias rm='rm -i'
However, I've seen people recommend against this because
the alias might not exist on another ...
50
votes
21answers
4k views
Quick directory navigation in the terminal
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 ...
1
vote
1answer
83 views
Git Alias 'Permission Denied'
I'm getting a 'permission denied' error on a git alias. It works with root but not my user account:
$ andy@ubuntu:/usr/local/bin$ sudo git config --global alias.lg "log --color --graph ...
1
vote
1answer
69 views
How to make an address list in mutt
I use Mutt as my main client and use the alias command quite frequently.
How to group mail addresses, or—even better—aliases into a list I can then use like an alias to send mail to?
8
votes
2answers
328 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 ...
2
votes
3answers
181 views
What are commands to find shell keywords, built in functions and user defined functions?
I was discussing with my friend on how the commands are parsed in the shell, and he told me that bash searches the command in following order
List of aliases
List of shell keywords
List of ...
1
vote
2answers
145 views
Change command name in Linux [duplicate]
Possible Duplicate:
creating abbreviations for commonly used paths
I'm new to the Linux platform. Is there any way to rename the commands available in Linux.
For example, I use the clear ...
8
votes
3answers
939 views
Is there a 'rc' configuration file for grep/egrep? (~/.egreprc?)
I usually do some grep when developing, and there are some extensions that I always don't want to look for (like *.pyc).
Is it possible to create a ~/.egreprc or something like that, and put some ...
4
votes
2answers
443 views
cp -f cannot overwrite cp -i alias
In my /home/user/.bashrc file, I have those aliases to prevent mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
If I'm really sure of what I'm doing, I can overwrite rm and mv aliases ...
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 ...
1
vote
2answers
72 views
How can I create an alias synonym?
I have an alias pwd
How can I create another alias that is a synonym for it?
For example I have
alias cd1='cd ~/dir1'
I want a second alias cd01 that points to the same place but I don't want to ...
1
vote
3answers
135 views
How can I use grep to search for lines that start with a certain character in bash
I want an alias ('ggg') that will look through my existing set of aliases and tell me all the ones that begin with g. I have a lot of g* aliases :)
I tried this: alias ggg='alias | grep ^g' but ...
3
votes
2answers
185 views
How to set an alias on a per-directory basis?
Suppose you have an alias go, but want it to do different things in different directories?
In one directory it should run cmd1, but in another directory it should run cmd2
By the way, I have an ...
12
votes
4answers
857 views
How can I create an alias for a command that includes a space?
Most of my my aliases are of this form: alias p='pwd'
I want to alias git commit so that it does git commit -v
But trying to create an alias with a space gives an error:
$ alias 'git commit'='git ...
9
votes
5answers
296 views
How to test for possible conflicts while using alias in bashrc?
Is there a simple way to list all the command conflicts that have occurred in the system due to the bashrc update involving alias commands?
For example, someone writes alias ...
2
votes
3answers
213 views
How to add system alias?
I have this alias in my .zshrc:
alias grim='gvim --remote'
But this is not seen from ranger file manager, I believe that ranger runs a 'generic' shell skipping my .zshrc. I want to make this alias ...
3
votes
2answers
310 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 ...
1
vote
1answer
122 views
Is it possible to use a parameter within an alias command [duplicate]
Possible Duplicate:
How to pass parameters to an alias?
As answered in Can less retain colored output? I want to use git diff --color=always filename | less -r to get a colored output of my ...
2
votes
6answers
2k views
Show only hidden files (dot files) in ls alias
I'm using the command
ls -a | grep '^\.'
for showing only the hidden files.
I added the line
alias hidden='ls -a | grep '^\.'' # show only hidden files
to .bash_aliases file
but this does not ...
4
votes
3answers
264 views
Forcing an 'added' alias to every command
Is it possible to forcibly add a timing alias (for lack of a better way to phrase it) to every command in bash?
For example, I would like to have a specific user who whenever a command is run, it is ...
95
votes
9answers
7k views
In Bash, when to alias, when to script, and when to write a function?
It's taken me almost 10 years of Linux usage to ask this question. It was all trial and error and random late-night internet surfing.
But people shouldn't need 10 years for this. If I were just ...
3
votes
2answers
227 views
Are there any utilities to quickly add, list and remove command aliases?
I'd like to be able to quickly, on-the-fly add (and list/remove) command aliases so that they persist between shell restarts (as if they were added to .bashrc). Are there any ready ...
3
votes
2answers
151 views
place the aliased version of an existing command in /usr/bin/
I use Vim a lot, and I know how I can start vim in insert mode. So I have an alias named vii in my .bash_aliases file.
On other hand I use Git a lot too, and I have this line in my .gitconfig:
...
5
votes
1answer
100 views
ask for comfirmation when file is replaced using a redirection
I'm a careless terminal driver scared of accidentally deleting files, hence using some aliases like alias rm='rm -i' for rm, mv, cp. How can I get a similar confirmation behavior for file redirections ...
2
votes
2answers
225 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 ...
1
vote
2answers
201 views
Unix alias with parameters [duplicate]
Possible Duplicate:
How to pass parameters to an alias?
I'm wondering if it is possible to define an alias with parameters.
For example, when I have to compile a tex file I execute ...
1
vote
2answers
94 views
Cannot see aliases
I have my root user and another user testuser. Now in the .bashrc of testuser, there are some aliases like la for ls -a. But when I login to testuser and try running la, it gives me the error:
-sh: ...
2
votes
1answer
153 views
awk function with a number parameter for the column you want to print
I want to use my awk shortcut as a function, so that I can pass the column number which then prints me the output. My aliases are:
alias A="| awk '{print \$1}'
alias G="| grep -i'
Instad of typing:
...
2
votes
3answers
699 views
Issues with .bash_profile and terminal commands
I added some data to my .bash_profile to run two aliases ruby version 19 and the proper gems. As soon as I added the data I could not longer run any commands such as the MacPorts command port nor the ...
3
votes
2answers
3k views
How can I install the `ll` command on Mac OS X?
I'm using Mac OS X. When I SSH into servers I find the ll command useful, but it's not available on my local machine. How can I install it?
2
votes
2answers
84 views
How can I create a “base” for other aliases to refer to and enable cd base/x command directories?
I have .bash_aliases with:
alias c1='cd /home/me/code/php'
alias c2='cd /home/me/code/jquery'
alias c3='cd /home/me/code/ruby'
alias c4='cd /home/me/code/c'
How can I DRY this up and loosen the ...
4
votes
2answers
2k views
Refresh aliases after defining new command
When I define new alias in .bash_aliases file or new function in .bashrc file is there some refresh command to be able immediately use the new aliases or functions without closing terminal (in my case ...
5
votes
3answers
317 views
Aliases for 'sudo /etc/init.d/'
Are there any standards for aliasing sudo /etc/init.d/? I'm sure many people have considered cutting down these 17 characters to just 2 or so.


