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 it in ~/.bashrc:   function palias(){ echo "alias $1='$2'" &gt;&gt; /home/User/.bashrc;}   So now if I want to permanently alias some command I just :  palias update "sudo apt-get update"   I wonder if there is a built in command like this function, or anything like this to install from repositories?
10053
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 temporary alias and it lives until you close the terminal.  As it is explained  to save alias permanently I need to execute ~/.bash_aliases or ~/.bashrc commands in terminal and add my alias there. But when I execute ~/.bashrc I get following error message :  bash: /home/bakhtiyor/.bashrc: Permission denied   When I run ~/.bash_aliases I get another error message like this:  bash: /home/bakhtiyor/.bash_aliases: File or directory doesn't exist.   What is the actual problem and how can I solve it?
8029
I've searched the net for such information and found different command lines, like these ones:  sudo apt-get remove application sudo apt-get remove application*  sudo apt-get remove --purge application sudo apt-get remove --purge application*  sudo apt-get purge application sudo apt-get purge application*   So, what is the correct way? Is it necessary to use that "*"?  After that, I also found these commands:  sudo updatedb sudo locate application sudo rm -rf (file/folder name)
81980
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? (I'm just confused, so asking, I realize they are different o/s's but maybe there is a relationship somehow?)  On my server, I want to create an alias, should I put it in .bashrc?  What if I want this alias to be applied so all users can use it?
112843
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?
25210
When I log in, I see the error:     bash: alias: alias: not found   If I source my .bashrc file, the message appears again.  What is causing this?
87892
What's the difference between .bashrc and .bash_profile and which one should I use?
61254
Suppose I have an alias in the bash shell. Is there a simple command to print out what command the alias will run?
79731
I'm working on different Linux distributions.  In my .bashrc I'd like to set up an alias that opens a window of the default file manager (e.g. nautilus, nemo, pacman, ...).  Is there a way find out what the file-manager of a session is? (It does also depends on the session, doesn't it?)
110879
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 running or not, if it is not it does open notepad++ and either way, it opens whatever file I specify when I call  notepad++ someFile   However, if notepad++ was not running prior to that command, it gives me a      fixme:ole:RemUnknown_QueryInterface No interface for iid   {00000019-0000-0000-c000-000000000046}   and then blocks the calling terminal for as long as notepad is running.  How would I implement that alias correctly? For I have no idea what that fixme is supposed to tell me.  Also, I would prefer not having to open a second terminal after opening a file in notepad++ (ctrl+C reenables the terminal but closes notepad++).
66342
When I create  alias wd='ps -ef | grep java | awk {'print $2 " " $9'} | egrep "(A|B|C|D)"'   or  function wd () {     ps -ef | grep java | awk '{print $2}' ... }   in my .bashrc file, I get errors.  Interestingly, if I source my .bashrc file with the function, it 'compiles', but when executing, gives me:   context is      &gt;&gt;&gt; \ &lt;&lt;&lt; {\print     missing }   Can someone help me with this, and also answer when its better to put something in a function versus in an alias?
123780
I am trying to create a program which require such feature. The flow will be like:   User enter a bash command User hit the enter My script will get command, current directory,.. as variables. Program can optionally modify the command. Modified command will get executed normally.   Is there any way to do this?  Note: I need this for my personal use, I am not going to distribute this program.
34453
I recently installed the apache2 package using the Software Centre, I want to create an alias apacheres which will replace the more cumbersome command /etc/init.d/apache2 restart.  I opened the .bashrc file in my home directory, and it contains the following lines:  # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package.  if [ -f ~/.bash_aliases ]; then     . ~/.bash_aliases fi   So I created a .bash_aliases file in my home directory, and added only this line:  alias apacheres ='/etc/init.d/apache2 restart'  When I started my terminal, I get this error message:  bash: alias: apacheres: not found bash: alias: =/etc/init.d/apache2 restart: not found   The shell has obviously read the file, otherwise it wouldn't know of its existence. I have checked the directory path and I can find the file apache2 there. What do I need to do to make this alias work?
3794
I find that I often do the following:  %&gt; cd bla/bla %&gt; ls   I would like it that whenever I cd into a directory it automatically does an ls.  I fiddled with my .bashrc for a while, but couldn't figure out how to make it happen.
54920
Sometimes a command is aliased to itself. For example:  $ type ls ls is aliased to `ls -al'   How do I invoke type on the ls command itself (and not the alias)?
30221
Suppose I want a bash command to do something extra.  As a simple example, imagine I just want it to echo "123" before running.  One simply way to do this would be to alias the command.  Since we still need the original, we can just refer to it by its exact path, which we can find using which.  For example:  $ which rm /bin/rm $ echo "alias rm='echo 123 &amp;&amp; /bin/rm'" &gt;&gt; .bashrc   This was easy because I was able to look up the path to rm using which.  However, I am trying to do this with exit, and which doesn't seem to know anything about it.  $ which exit $ echo $? 1   The command did not output a path, and in fact it returned a non-zero exit code, which which does when a command is not in $PATH.  I thought maybe it's a function, but apparently that's not the case either:  $ typeset -F | grep exit $ echo $? 1   So the exit command is not defined anywhere as a function or as a command in $PATH, and yet, when I type exit, it closes the terminal.  So it clearly is defined somewhere but I can't figure out where.  Where is it defined, and how can I call to it explicitly?
44028
Usually, for some commands such as apt-get install xxx, I forget to add sudo first, then I need to retype it. What I want is in such cases, I just type a simple command, for example resudo. It will sudo my last command sudo apt-get install xxx. Is it possible in bash?
24279
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 if I provide an example:  I have program1.c written I want to be able to type (in the terminal) compile program1, and something like the following should be actually run:  clang -ggdb -std=c99 -Wall -Werror   program1.c -lcrypt -lcs50 -lm -o program1   For those who have taken Harvard's CS50 class, you will recognize this as their make command. So if the above is impossible, and you know another way to make this happen, I'm all ears. I'm trying to avoid using their VM, as my netbook isn't really up to par to handle a VM.