The alias built-in in shells, used to define shortcuts for frequently used commands.

learn more… | top users | synonyms

1
vote
1answer
161 views

how to check if the kernel support for ip alias?

it surprisingly that I get no explicit results when I googled "kernel ip alias support", and I have looked up the linux network administrator, 3rd edition, it says: check that you have a ...
8
votes
1answer
786 views

Can rm recursively remove empty directories?

In an old version of Unix, the rm command would delete directories if they were empty. From the Research Unix Eighth Edition man page for rm: "If an entry is a directory it is removed only if empty." ...
5
votes
2answers
201 views

Why does !! inside an alias not work?

I have this alias set in my system /etc/bashrc file: alias root="sudo !!" The intention of this being to run the last used command using sudo of course. When used, it of course appears to ...
1
vote
1answer
780 views

ssh into a server using .ssh/config alias & run an alias on the server in the same time

On my laptop Inside ~/.ssh/config file I have this: Host <serverAlias> HostName 127.0.0.1 #Server IP User <username> PreferredAuthentications publickey IdentityFile ...
1
vote
0answers
25 views

Use an alias with watch command [duplicate]

The post repeat command every x seconds shows that watch is the utility that is useful for the invoking a command at fixed interval repeatedly. Now, I have very long commands, and have used aliases ...
3
votes
1answer
83 views

code review: automatic completion for bash aliases

I was reading How do I get bash completion for command aliases? and I thought, that the answer Shawn J. Goff needed a little something: less user setup so I wrote a little script that is intended to ...
0
votes
1answer
310 views

Using alias in another script (ksh)

I'm writing a ksh script, and I'd like to use a command define by an alias in my .profile file, in my script. I tried this command in the folder containing my script, and it works. However, in my ...
1
vote
2answers
191 views

.bashrc execute command after “/bin/bash --login”

I have this alias in my .bashrc: alias s='cd ~/Documents/projects/s && /bin/bash --login && rvm use ruby-1.9' How can I execute the right part after it enters login shell (/bin/bash ...
1
vote
1answer
54 views

How to print a partial list of alias definitions in tcsh?

I'm working on Fedora 18 with tcsh on a network with a lot of pre-defined aliases. I'm adding my own personal aliases as well, but I want to be able to display these in a separate list. Right now I ...
1
vote
1answer
59 views

Making an alias which maps arguments to the middle of the command

I want to alias killapp X to pidof X | xargs kill or kill `pidof X`, but I can't think of a way to do this with just an alias on killapp. How could I do this so I don't have to do killapp X` ?
2
votes
3answers
97 views

How to create a function based on commands not defined yet?

I have some scripts (that are out of my control) that loads some environment settings to my session. So whenever I want to load I have to execute a series of commands: export ...
2
votes
2answers
36 views

alias for 'emacs /usr/local/nagios/etc/objects'

I'm trying to get the following working: alias banana='emacs /usr/local/nagios/etc/objects/' So i want to just type "banana firewall.cfg" to edit this ...
0
votes
2answers
313 views

zsh alias being overridden somehow

I'm on a system running OS X 10.8.5. I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon ...
1
vote
1answer
305 views

Aliases in scripts are not set globally

I know this sound really wierd but this is exactly what happens. I have my .profile and .bashrc file set up in a way that the .bash_aliases file gets executed (checked it with a echo). I do not get ...
0
votes
1answer
467 views

Why alias does not work in AIX (korn shell, .profile)?

I have these files in my home directory: drwxr-xr-x 3 meuser staff 256 Oct 12 13:11 . drwxr-xr-x 102 bin bin 4096 Sep 30 12:28 .. -rw------- 1 meuser staff ...
3
votes
3answers
299 views

How to create a short path?

We have so many useful folders, which are in different path, for our working in Linux. For example : $ cd ~/Documents/Courses/EDX/physics2013/ $ cd ~/Documents/Company/OpenGL/Proj/... $ cd ...
1
vote
1answer
254 views

How to create alias to kill processes running on a TCP/IP port? [duplicate]

What I have: alias killport='sudo kill -9 `sudo fuser -n tcp $1 2> /dev/null`' Problem: Running e.g. killport 8000 doesn't appear to work, though. However, simply running... sudo kill -9 `sudo ...
1
vote
2answers
52 views

What happens to argument in alias after using it once? [duplicate]

Why does this only print arg out once? $ alias test="echo $1 $1 $1" $ test arg arg This is on GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu).
1
vote
1answer
99 views

Find where a bash command is defined or sourced from? [duplicate]

Sometimes I want to know what a command I type into bash actually evaluates to. Usually I can figure out the location of the executable very easily with which. $ which vim /usr/bin/vim But what if ...
3
votes
4answers
425 views

Bash aliases/functions and command line options

I want to set an alias to start nedit together with command line option -noautosave (due to text files up to 500MB). What seemed to be easy: alias nn="nedit -noautosave $1 &" just raises some ...
1
vote
3answers
64 views

Extend one alias in second alias

It is possible to do this: alias tm=cd /opt/tomcat alias tmbin=tm/bin $ tmbin $pwd /opt/tomcat/bin ?? I know that I can do: alias tmbin=tm;cd bin
2
votes
1answer
38 views

Can I set defaults for rsync in non daemon mode?

Can I set defaults for rsync in non daemon mode? I know the daemon mode has this configuration file: /etc/rsyncd.conf But I typically use the non daemon version in this sort of manner: rsync -avzcO ...
4
votes
2answers
371 views

How to test if command is alias, function or binary?

I have command foo, how can I know if it's binary, a function or alias?
0
votes
2answers
473 views

How to list existing alias for a certain linux user?

Does anyone know how do I list existing alias for a certain Unix/Linux user on Debian? For example I have an Unix/Linux user 1001 and want to know which alias for login it has?
2
votes
3answers
172 views

Simplified navigation in terminal

I know IDEs are the wave of the future, but I always find myself coding in vim in a Linux terminal. Old dog. New tricks. Anyway, navigation becomes challenging when dealing with long package names. ...
3
votes
2answers
137 views

Preventing accidental directory deletion. Making an alias that contains options?

I use an alias to prevent me from accidentally deleting files, and I would like to do something similar for directories. For files, I have the following added to my .bashrc: alias rm="rm -i" I ...
14
votes
1answer
651 views

How can I `alias sudo !!`?

I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal !! and prints sudo: !!: command not found If I use double quotes, it substitutes ...
3
votes
2answers
89 views

Can I run a command after the user uses Ctrl-C to kill a command?

So at my position we use a shared set of aliases to do builds. Something like... alias 'build'='cd $BUILD_ROOT; m; cp ...; cp...; deploy; deploy; deploy; cd -' This is super irritating because the ...
10
votes
1answer
492 views

How many different ways can you create an “alias” in Bash?

I only know of two ways: alias foo=bar and function foo() { bar }. The reason I'm asking is that - all of a sudden in one of my bash sessions - I cannot run the ln command because bash is erroring ...
2
votes
3answers
2k views

How to copy or move files without being asked to overwrite?

What I've tried: root@host [/home1]# cp -f hello /home3 cp: omitting directory `hello' root@host [/home1]# cp -rf hello /home3 cp: overwrite `/home3/hello/.buildpath'? y cp: overwrite ...
3
votes
3answers
2k views

What does ll alias to?

ll is a common alias in many linux distros. How can you tell what it aliases to? I've tried checking my .bashrc, but I am not able tell what ll is equivalent to.
0
votes
1answer
77 views

Problem Aliasing a Command With a Pipeline and an Argument

Note: I use tcsh. I am trying make an alias that will use the mutt command to send an email with a pre-written body and subject line but that will take the alias argument and attach it to the email. ...
3
votes
2answers
241 views

How can I use aliases in commands?

I have created aliases in my .bashrc for various frequently used long paths but I can not seem to be able to use them inside vim or with commands such as find or grep. E.g the following: db in cli ...
0
votes
3answers
89 views

I need to turn a series of commands piped together into an alias in .bashrc

sudo ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' The above command when run from terminal outputs the right "internal" ip address. When I try to pass as alias like: alias ...
4
votes
2answers
2k views

in which file is hostname alias persistent, if not /etc/hosts?

In order to have an alias for my server, which can be seen in a "hostname -a" command, I edited the /etc/hosts file to add the alias at the end of the entry containing the hostname. For example, my ...
5
votes
3answers
264 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.
0
votes
1answer
234 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 ...
1
vote
2answers
1k 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
292 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
273 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
137 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
114 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
45 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
570 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
244 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 ...
2
votes
2answers
178 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
602 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
355 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
162 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
4answers
490 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 ...