How to configure local terminal .bashrc in MobaXterm?

.bashrc is a shell file placed in the user home directory and sourced while you start an interactive shell in Linux terminals, such as local MobaXterm or in Cygwin. This file can be edited or created to customize bash behavior, for example, define ENV settings, aliases, functions, call scripts, etc.

How to configure local bash terminal bashrc in MobaXterm?

Let us have a look at how to configure the .bashrc file in your local mobaxterm.

Step #1: Open your local bash terminal

  • Open your MobaXterm
  • From Terminal Menu, “Open New TAB
  • Click Start Local Terminal
  • Your terminal window will open

You would get a window something like below with a banner message,

[20XX-XX-XX 10:24.13]  ~
[admin.codetryout] >

Step #2: Open or create the file .bashrc

Edit .bashrc file, using the command vim .bashrc
You can customize your settings there.

Step #3: Example customization

Let us enter a simple alias,

[admin.codetryout] > vim .bashrc
alias hello="hello codetryout world"

Step #4: Reloading the bashrc changes to the shell

It is required that you have to reload the .bashrc file in order to make the changes available in your current shell. (Note, the changes will be available all the time when you open a new terminal/shell).
To reload .bashrc, use any one of the following methods,

. .bashrc


source .bashrc

Step #5: Testing your new bashrc

[admin.codetryout] > hello
hello codetryout world

More example, creating a bashrc edit, adding an alias to MobaXterm local bashrc:

In this example, we will add an alias to .bashrc, named code1. This alias will curl one web page from, lets try now:

# Adding a new entry to MobaXterm .bashrc
# Alias name: code1
/home/mobaxterm> echo 'alias code1="curl --output code.html"' >> .bashrc

# Reloading the bashrc
/home/mobaxterm> . .bashrc

Testing the new alias from mobaxterm bashrc, calling your alias code1

/home/mobaxterm> code1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   311    0   311    0     0   2549      0 --:--:-- --:--:-- --:--:--  2549

Verifying your bashrc changes

/home/mobaxterm> cat code.html
    <h1></h1><br />
    This is a demo website for testing sample code experiments and demos at<br />
    Please visit <a href=""></a> for more information.

Similar way, you may add anything that works on a shell, to your bashrc, such as auto-login to a server using SSH, file copy using SCP, etc. Hope this helps