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

35
votes
6answers
63k 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 ...
24
votes
2answers
6k 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' ...
20
votes
4answers
8k 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
19
votes
3answers
3k views

How to see the command attached to a bash alias?

Suppose I have an alias in the bash shell. Is there a simple command to print out what command the alias will run?
18
votes
5answers
4k 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?
15
votes
4answers
20k 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), ...
15
votes
6answers
1k views

Which aliases do you find most useful or helpful to your Ubuntu experience?

Since first becoming an Ubuntu user I have developed a growing list of aliases, and there are some that I cannot imagine being without. This makes me think that there are probably still tons of ...
8
votes
2answers
538 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?
8
votes
5answers
6k 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?
7
votes
1answer
652 views

Bash alias -=… (alias name should be a simple dash) not working

I want to create an alias for cd - which should be just a dash (-). I tried without success: alias -='cd -' # bash: alias: -=: Invalid option alias \-='cd -' # bash: alias: -=: Invalid option ...
6
votes
2answers
128 views

Is there a way to shorten(not remove) the path displayed in the terminal by an alias

I want something like this: "vivek@grishma:~/xxx/yyy/zzz/src$" to be shown as "vivek@grishma:datasource$" where I would somehow have predefined "datasource" to be an alias for the long path above. ...
6
votes
1answer
4k views

How to remove an alias?

I want to remove gs alias from my PC. When type gs it will open the Ghost Script. But I checked everywhere in the home directory .alias .bash_aliases .bashrc I also overwrite the gs with my custom ...
6
votes
2answers
973 views

How can I create an alias so that when I enter “kt” it executes “killall gnome-terminal”?

How can I create an alias so that when I enter "kt" it executes "killall gnome-terminal"?
4
votes
2answers
118 views

Create alias with paramater in the middle

I want to create an alias for grep like this: grep argX ~/myfile where argX is a parameter and myfile is always the same. How can I do this?
4
votes
6answers
208 views

Overriding a executable to add a default flag

Here's my boggle. I use gmplayer to play all my videos. 99.9% of the time everything works fine but in that 1-in-1000 case, a video might be corrupted. gmplayer plays the video but it cries like an ...
4
votes
2answers
6k views

bypass the yes/no prompt in apt-get upgrade

in order avoid typing out all of the apt-get commands when updating my computer i have made a simple alias command to do it. But i really want to be able to just type in my alias and let it do its ...
4
votes
2answers
2k 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 ...
4
votes
2answers
152 views

How can I create something similar to an alias, that does properly expand to the initial command?

I have set up aliases for apt-get update, apt-get install, and so on. Thats quite convenient. But what I really would like to have is something like this: type agi TAB vi and have it automatically ...
4
votes
1answer
2k 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 ...
4
votes
1answer
255 views

How to run some alias command in bash's non-interactive mode

I want to run some alias command in bash's non-interactive mode. But seems Ubuntu ignore BAHS_ENV. How can I make it work? la is a alias command. And I tested in other linux. it is work fine. Just ...
3
votes
3answers
1k views

Is there a way to echo an alias?

I have set some aliases in my .bashrc file and for some reason one of them does not behave as expected. Since I don't remember the exact command assigned to that alias, I would like to see the ...
3
votes
1answer
210 views

Why doesn't this command work as an alias?

I've been using the following command to list the ten largest files, at any depth, under the current directory: find -type f -size +10M -exec ls -gGsSh1 {} + | awk 'NR<=10 {print $0}' (I use awk ...
3
votes
1answer
209 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 ...
3
votes
1answer
232 views

When I open Terminal it says command alias not found and closes

I was messing around in Terminal (bad idea, I know, but I'm usually pretty good with it) and now it does what the title says. I know about pressing Control-C to stop it from running, but how do I just ...
3
votes
1answer
359 views

Bash aliases - how do I run a file in a different folder without losing my current location?

I have a nice little bash alias in my .bashrc folder that allows me to start Tomcat running without having to cd into the folder first, e.g. alias startTomcat="cd ~/apache-tomcat-7.0.34/bin/ ...
3
votes
2answers
153 views

Working directory when running command

I've got an executable, let's call it exec. It lives in a directory, for the sake of argument called dir. Let's say it's at the filesystem root. I can run this executable by doing cd /dir ./exec ...
3
votes
1answer
5k 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 ...
3
votes
1answer
157 views

Aliases - able to pass arguments?

I want to make an alias in my .bashrc or .bashrc_aliases file (probably the latter). Specifically, I want to call the clang command for my *.c file I'm writing. What I'm looking for is best summed up ...
3
votes
2answers
147 views

Batch Starting Servers

How I can create a batch alias for bash? I need to do this: cd /somefolder bundle exec unicorn -p 3000 rackup faye.ru -s thin -E production bundle and rackup - this is 2 servers for example I ...
3
votes
1answer
491 views

Autocomplete on .bash_aliases commands?

I have a whole bunch of aliased commands in .bash_aliases The most generic examples are alias apt-update="sudo apt-get update" alias apt-upgrade="sudo apt-get dist-upgrade" but then I also have ...
3
votes
3answers
327 views

How to run source on terminal start up?

I have alias ready on .bash_aliases. Problem I'm having right now is that I need to run source ~/.<filename> first before I can execute the alias command. My question would be how do I run ...
2
votes
1answer
128 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 ...
2
votes
2answers
126 views

How to add a password option in CLI?

I've googled extensively but haven't found how to add a password option so I don't have to type it in manually. I've created the following alias: alias int='sudo service network-manager restart' ...
2
votes
2answers
113 views

How do I create an alias that displays the contents of a `history list`?

How do I create a new alias command called cet103demo which displays the contents of the bash history list one page at a time, and also making sure the new alias is automatically loaded when the ...
2
votes
2answers
87 views

How to check if alias is not replacing an actual command?

How can I know if an alias I make (in .bash_aliases) is not replacing an actual command by same name? I don't want to do such things by accident. (I looked in "Questions that may already have your ...
2
votes
1answer
501 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?
2
votes
2answers
5k views

Configure hosts file to use aliases

I am running Ubuntu Desktop 12.04 and would like to be able to open a web browser (Firefox), type an alias into the address bar, hit enter, and have the browser take me to the site that the alias ...
2
votes
1answer
51 views

Alias adder script in terminal

Recently i was adding some command aliases to .bash_aliases file in user home folder. I am wondering if there is some script that i can run to add aliases to that file. What I mean is : some script ...
2
votes
2answers
1k views

trying to create an alias in Ubuntu 12.10 but its not working

I am trying to create an alias and I have added these lines in ~/.bash_aliases alias server-python='open http://localhost:8000 && python -m SimpleHTTPServer' alias ssh-saad='ssh ...
2
votes
1answer
138 views

Nonblocking bash commands?

So I just created the .bash_aliases and wrote the following: callNotepad(){ wine C:\\Program\ Files\\Notepad++\\notepad++.exe $1 } alias notepad++=callNotepad Now whether notepad++ is already ...
2
votes
1answer
316 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 ...
1
vote
3answers
6k views

Apache alias not working correctly

I have added these lines in my 000-default virtual host file: Alias /antoniocs/project "/home/antoniocs/www/project" <Directory "/home/antoniocs/www/project"> Options Indexes FollowSymLinks ...
1
vote
1answer
251 views

How can I force ubuntu to use font A instead font B in all applications and web pages?

i am new in linux, my question simply is: how i can force ubuntu to use font A instead font B in all application and web page? for example there is a web page that uses Tahoma Font, but I want my ...
1
vote
2answers
2k 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 ...
1
vote
1answer
604 views

Using alias to change ls to ls-l changes(or disables) the colors of ls output

I've used alias to change ls to ls -l, but the colours change to the normal font of the terminal (also tried ls -l before the alias command and the colours appeared fine). What is wrong? Thank you
1
vote
3answers
435 views

Trouble with aliases and opencv

I have an alias defined to compile an opencv program which goes like this alias gcv='g++ -I/usr/local/include/opencv -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_objdetect' Then I go on ...
1
vote
2answers
88 views

How do I execute a program with default variables?

How can I execute a program (specifically a bash alias) with the default environment variables? Consider this example: export test="something I dont want to exist" alias _xterm='xterm -fn 7x13 -fa ...
1
vote
1answer
89 views

“Trash” equivalent for 12.04

I recently updated my Ubuntu version to 12.04. I have aliased rm to the command trash, and now that I have upgraded, there is no longer a command called trash. Is there an equivalent for 12.04? I ...
1
vote
1answer
240 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 ...
1
vote
2answers
652 views

alias with parameters

I was recently starting to setup my usual alias. I ended up needing to pass more information than my alias originally needed $ alias runserver = 'python manage.py runserver' $ runserver 80 // turns ...