Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8185317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:48:19+00:00 2026-06-07T01:48:19+00:00

I have aliases in a ~/.bash_aliases file on a remote ubuntu server. The file

  • 0

I have aliases in a ~/.bash_aliases file on a remote ubuntu server. The file is loaded in the standard way from a ~/.bashrc file, like so:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

That ~/.bashrc file in turn is loaded (also in a standard way) from a ~/.profile file which looks like this:

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    source ~/.bashrc
    echo ".profile loaded .bashrc"
  fi
fi
mesg n

I’ve found that my aliases were unavailable in my fabric commands, e.g. when I do this in a fabric script:

run("aliased_command")

I get this output:

run: aliased_command
out: .profile loaded .bashrc
out: /bin/bash: aliased_command: command not found
Fatal error: run() encountered an error (return code 127) while executing 'aliased_command'

Now I managed to reproduce this outside of fabric by logging into the server with ssh, and running :

~# /bin/bash -l -c aliased_command 

from the shell (n.b. /bin/bash -l -c is fabric’s default, see here) I get the same output:

.profile loaded .bashrc:
/bin/bash: aliased_command: command not found

After a fair bit of searching on related topics, I read somewhere that aliases aren’t exported for non-interactive shells, and I then managed to fix this using /bin/bash -l -c -i (-i sets bash to interactive mode).

I then added the following to my fabfile.py:

env.shell = "/bin/bash -l -c -i" 

Now I can use aliases in my fabric commands… just great!


So my questions are:

  • Are there any problems with this solution? If so, what should I be doing?

  • Does anyone else have a problem running aliases in their fabfiles?

  • Is there any obvious reason why I might have this issue and others wouldn’t?

  • Can anyone point me to links etc. that describe this problem and a resolution? And also explain how they found them… : )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:48:20+00:00Added an answer on June 7, 2026 at 1:48 am

    Here is the quick answer to the main issue, to save someone reading my long question, just
    add

    env.shell = "/bin/bash -l -i -c" 
    

    to your fabfile.py and you should be able use aliases in your fabric commands just great!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set inside .bashrc some aliases that I need to be seen inside
I have one server, server.domain.local that hosts 3+ web applications. I have aliases for
I have a bunch of aliases that I would like to share with co-workers
I have put some aliases in my .bashrc to open a group of project
I have a number of aliases defined in my .bashrc . E.g: alias ls='ls
I have a .bash_profile script that sets up some aliases for me based on
Given my two db tables aliases and subscriber have entries like this: aliases.username =
I have an application that reads emails from ONE email account (gmail application account)
I have two domains that are aliases, domain1.com and domain2.com Currently they are both
I have a site, that has aliases: site1.com site2.com site3.com But they are all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.