In shells, an alias is an alternate name for a command. For instance, "ll" is an alias for "ls -l" on many systems.

learn more… | top users | synonyms

90
votes
7answers
168k views

How do I create a permanent Bash alias?

I would like to create an alias to rm command in order to have a confirmation message after executing this command. So I am creating an alias like this alias rm='rm -i'. But as far as I know this is a ...
11
votes
6answers
20k views

How to add an alias to a command in terminal?

By typing a manually specified command in terminal i want to do some. How could add an alias to a command? Can i do that with the help of the terminal or should i edit some kind of file?
49
votes
3answers
13k views

Aliases not available when using sudo

I was playing around with aliases today and I noticed that aliases don't seem to be available whilst using sudo: danny@kaon:~$ alias alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' ...
23
votes
6answers
9k views

How can I create an alias for cd and ls?

I frequently run the ls command after running the cd command. How can I create an alias (like cs) for this operation?
21
votes
4answers
18k views

How save my “alias” entries forever [duplicate]

I want to save my alias commands forever like the default ones when I type "alias" so I don't retype them every time I leave my bash
4
votes
1answer
3k views

Aliases don't work after restart terminal

I have create few new aliases in ~/.bashrc then run source ~/.bashrc and it worked. But after restart terminal it does not work. I looked back and found the advice: create ~/.bash_aliases and in ...
7
votes
2answers
8k views

Undertanding .bashrc and .bash_profile

On a server when I login as root I see .bashrc (ubuntu 10.10). On my Mac I have a .bash_profile, does ubuntu always have only a .bashrc file and not .bash_profile? (just confused so asking, I realize ...
6
votes
2answers
9k views

How to protecting cd command to deal with parentheses?

I asked here how to make cd protect spaces. Tab completion is great, but sometimes you paste the path from the clipboard so this is useful. The solution breaks with parentheses however. No matter how ...
5
votes
1answer
3k views

Ubuntu alias not applied in bashrc

I am under Ubuntu 12.04 LTS. I have added such line to ~/.bashrc alias myconf="sudo nano /opt/nginx/conf/sites-available/efiling" I tried with single quotes too: alias myconf='sudo nano ...
3
votes
2answers
200 views

Can alias command pass arguments?

I want to know if i can pass an argument with an alias command. for example: alias d="dmesg|grep -iw usb|tail -5" Now d will print the last 5 lines. if i want to use d to print a different number ...
3
votes
1answer
938 views

Why must I do `. .bash_profile` every time I create a new alias?

Every time I add a new alias in my .bash_profile file, I found that I must do the command . .bash_profile in my terminal to make it work. Why does the alias not work automatically?
16
votes
3answers
562 views

My .bashrc alias not run in .desktop file

I've added the following line to the .bashrc file: alias midos="sh /home/erkanmdr/Belgeler/midos/midos.sh" This command works fine in the terminal and tty. But not working in my .desktop shortcut ...
3
votes
2answers
4k views

Differences between fish and bash to pass commandline arguments to alias functions?

From the answers to my other question here i learned about the possibility to pass commandline arguments to a alias function in Bash. In Fish i can edit an alias by editing the file config.fish in ...
28
votes
6answers
47k views

How to run an alias in a shell script?

I have an executable file mpiexec, whose full path is ~/petsc-3.2-p6/petsc-arch/bin/mpiexec. Since I want to execute this command in different directories (without having to retype the entire path), ...
9
votes
2answers
1k views

What does the first '.' mean in '. ~/.bashrc'? [duplicate]

I saw a post about fix your alias in .bashrc. And he says after you put your alias in .bashrc , you need to use: . ~/.bashrc I do not quite understand what the first dot(' . ') does here. What's ...
3
votes
1answer
278 views

Saw an interesting command but can't alias it

Saw an command from this post http://askubuntu.com/a/266839/75967 that I would like to alias find {,/usr}/{,s}bin -printf '%f\0' | xargs -0 whatis | sort | less I assume the less or the | is ...
4
votes
1answer
3k views

Aliases: difference between .bash_rc, .bash_aliases and /usr/local/bin

Playing around with Terminal, I noticed that there are many ways to create permanent aliases. I'm a Linux newbie, and from what I know, doing: sudo ln -s /path/to/esecutable ...
2
votes
1answer
451 views

How to make ubuntu understand a windows-style folder path as a folder on windows partition?

I have ubuntu and Win7 on dual boot. On windows, a use a program that is set to save things on a given windows folder (like "D:\some folder"). On ubuntu, I can run this exact same program (it's not a ...
9
votes
2answers
1k views

What does the l command do?

There is a command l available on my machine which appears to do nothing. which l also produces no output. Is this a real command, and does it actually do anything?
5
votes
2answers
301 views

How to easily make an alias command permanent? [duplicate]

I search everywhere and almost everyone was suggesting to open the ~/.bashrc or ~/.bash_aliases, then put the alias command there, I created a function name palias as permanent alias function and put ...
3
votes
2answers
262 views

Create an alias to a desidred directory to use within terminal [duplicate]

I constantly need to type cd /home/geo/Geant4/geant4.10.00.p02-install/lib/Geant4-10.0.2 How do i create an alias to that directory so I could just type cd $geant (or any other word i decide to ...
2
votes
1answer
59 views

Alias and executable file [duplicate]

I have lmp_fedora executable file located in /src. I use this command: mpirun -np 4 lmp_fedora < in.stdinfile to execute the job. However it is only able to run if I copy lmp_fedora into the ...
2
votes
1answer
150 views

Is there a way to alias the command cd so that it protects the arguments?

When I run cd My folder There is an error because I have not protected the string. bash: cd: My: No such file or directory But this works fine cd "My folder" Is there a way to redefine cd as an ...
1
vote
1answer
390 views

Bash alias permanent <without running bash or . ~/.bashrc>

I'm used to putting my alias in .bashrc, but Ubuntu suggests putting them in .bash_aliases. So that's fine, I put my alias there in the .bash_aliases file. However I want to run my aliases once I ...
0
votes
0answers
23 views

Aliases don't work [duplicate]

I can't get this to work at all. I am running ubuntu 12.04 in virtual box and am trying to follow this tutorial. I have realised that I have .profile not .bash_profile. I typed: alias ...