The alias built-in in shells, used to define shortcuts for frequently used commands.
0
votes
0answers
48 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$
...
1
vote
2answers
92 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 ...
2
votes
0answers
57 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
...
4
votes
5answers
121 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 ...
1
vote
3answers
75 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
39 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
30 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
76 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
51 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 ...
3
votes
2answers
60 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 ...
18
votes
6answers
474 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 ...
1
vote
1answer
64 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
66 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?
2
votes
3answers
159 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 ...
2
votes
1answer
214 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 ...
1
vote
1answer
78 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 ...
1
vote
2answers
125 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 ...
4
votes
2answers
302 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 ...
1
vote
2answers
68 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
121 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
163 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 ...
2
votes
3answers
185 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 ...
9
votes
5answers
287 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
2answers
253 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
116 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 ...
12
votes
4answers
749 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 ...
3
votes
2answers
217 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
148 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
2answers
141 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 ...
2
votes
2answers
220 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 ...
5
votes
1answer
99 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 ...
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
150 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
676 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 ...
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 ...
5
votes
3answers
287 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.
2
votes
1answer
327 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 ...
1
vote
1answer
91 views
How can I add an alias for my pwd to an existing file?
I want to add another alias to my "aliases" file for the directory I'm currently in (Present Working Directory)
I've tried
printf "alias aaa=cd " + pwd >> myfile
It's close, but I end up ...
60
votes
6answers
2k 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 ...
2
votes
1answer
89 views
creating shortcuts to executables on IRIX64 6.5
I'm telnetting into an IRIX 64 server and I'm trying to create shortcuts to emacs, gvim, and other executables that are stored in a certain directory. I tried using the alias command on the command ...
3
votes
1answer
275 views
creating abbreviations for commonly used paths
I am new to linux and was wondering whether it is possible to create abbreviations that can be used in terminal. I know about alias command, but am not sure whether that can be used for what I am ...
7
votes
3answers
271 views
How can I find a rogue alias declaration?
I'm trying to find where a specific alias has been declared. I've searched all the usual places I know to look for aliases:
~/.bashrc
~/.bash_profile
/etc/bashrc
/etc/profile
With no luck.
I know ...
3
votes
2answers
220 views
List only temporary aliases in bash
I know that to list all aliases in a given bash session with alias -p. Is there a way to get a list of all the temporary aliases in a given bash session, i.e. all aliases that aren't in my bash ...
3
votes
1answer
156 views
Why are these aliases failing?
I am attempting to put some alias definitions in .bashrc. Like this:
#Convienience aliases
alias ll='ls -l'
alias ldir='ls -p | grep "/"'
#Temporary aliases
alias mvFooLog='mv ~/Projects/Foo/Log.txt ...
2
votes
0answers
247 views
How to enable `sudo` with custom functions?
Recently I learned you can enable sudo for custom aliases as follows:
alias sudo='sudo ' # note: the space is required!
The reason this works is the following:
If the last character of the ...
2
votes
1answer
176 views
Alias in .bashrc doesn't seem to accept an argument [duplicate]
Possible Duplicate:
In Bash, when to alias, when to script, and when to write a function?
I'm trying to setup an alias in my .bashrc file, but it's not working as expected.
I have this ...
3
votes
1answer
428 views
How can I alias to `!!` (last command)?
!! in bash runs last command. I find it too difficult to type given how much I use it. alias to the rescue, I presumed.
Or not. I tried:
$ alias dl='!!' # Aliasing
$ echo Testing123 ...
2
votes
1answer
384 views
Bash: Use an alias in a variable
I am writing a bash script that runs each of its arguments as a command. This works for commands in my PATH, but not for aliases. I can directly call an alias in the script, but I can't call an alias ...
48
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 ...
87
votes
9answers
5k 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 ...