Is `.bashrc` executed when ubuntu 18 logging in?What file is sourced/executed when logging in?Why ~/.bash_profile is not getting sourced when opening a terminal?Where is the script executed when logging into a shell?.bashrc not executed when opening new terminalCannot log into my Ubuntu 12.04 user accountScript in ~/.bashrc works when manually executed, but not otherwiseOversized swapfile preventing boot into Ubuntu

Should I still follow "programming to an interface not implementation" even if I think using concrete class members is the simpler solution?

Can a German employer force mandatory overtime and forbid salary discussion?

Did "2001: A Space Odyssey" make any reference to the names of companies, or show any evidence of the existence of advertisements?

Want to published unpublished work found in an auction storage unit

Is it academically dishonest to submit the same project to two different classes in the same semester?

Why did Oliver Cromwell ban Christmas in 1644?

What are the factors that decide on whether you die instantly or get knocked out in PUBG?

Arcane Adept: is this proposed Warlock feat balanced as compared to PHB feats?

What is the difference between scissors and shears?

Between while and do in shell script

How does an immortal vampire king hide his vampirism and immortality?

Intersection of sorted lists

How to pay less tax on a high salary?

Do Adventure cards count towards "number of instant and sorcery cards in your graveyard"?

Template not provided using create-react-app

Is there a material or method to allow "swimmable" coins?

Why try to impeach Trump now?

Evil plans - how do you come up with interesting ones?

Unpaid suspension due to management error

Is Jupiter still an anomaly?

Mostly One Way Travel : Says Grandpa

How do electric hot water heaters explode and what can be done to prevent that from happening?

A single word for "not allowed to be changed" or "must be this way"

Why are green parties so often opposed to nuclear power?



Is `.bashrc` executed when ubuntu 18 logging in?


What file is sourced/executed when logging in?Why ~/.bash_profile is not getting sourced when opening a terminal?Where is the script executed when logging into a shell?.bashrc not executed when opening new terminalCannot log into my Ubuntu 12.04 user accountScript in ~/.bashrc works when manually executed, but not otherwiseOversized swapfile preventing boot into Ubuntu






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









1


















I added a line at the beginning of .bashrc which is:



exit


No terminal will be opened (the usual way), but Ubuntu 18.04 never been able to log in (to the user interface).



I was able to log in later by editing .bashrc from the recovery mode root terminal interface and deleting the exit statement.



My question:




Does this mean that Ubuntu execute .bashrc when it logs in? ..



If so, how to write a condition (if statement) for the log_in or terminal_app case alone?











share|improve this question



























  • man bash | less -p ^FILES

    – Cyrus
    Sep 28 at 8:01






  • 1





    If your .bashrc is based on the default Ubuntu one, make sure any commands like exit are placed after the case $- in ... esac section if you want them to apply only in interactive shells

    – steeldriver
    Sep 28 at 14:33












  • @steeldriver , it's working, .. the comment above (in .bashrc) explains it. so, the .bashrc does execute in non-interactive way when logging in? (P.S: if you may explain this in an answer)

    – Yasin Yousif
    Sep 28 at 18:36












  • @YasinYousif TBH I don't really know enough to write a good answer - I think that it depends which display manager (lightdm,gdm etc.) is used and how exactly it invokes the user's chosen desktop session

    – steeldriver
    Sep 28 at 19:00

















1


















I added a line at the beginning of .bashrc which is:



exit


No terminal will be opened (the usual way), but Ubuntu 18.04 never been able to log in (to the user interface).



I was able to log in later by editing .bashrc from the recovery mode root terminal interface and deleting the exit statement.



My question:




Does this mean that Ubuntu execute .bashrc when it logs in? ..



If so, how to write a condition (if statement) for the log_in or terminal_app case alone?











share|improve this question



























  • man bash | less -p ^FILES

    – Cyrus
    Sep 28 at 8:01






  • 1





    If your .bashrc is based on the default Ubuntu one, make sure any commands like exit are placed after the case $- in ... esac section if you want them to apply only in interactive shells

    – steeldriver
    Sep 28 at 14:33












  • @steeldriver , it's working, .. the comment above (in .bashrc) explains it. so, the .bashrc does execute in non-interactive way when logging in? (P.S: if you may explain this in an answer)

    – Yasin Yousif
    Sep 28 at 18:36












  • @YasinYousif TBH I don't really know enough to write a good answer - I think that it depends which display manager (lightdm,gdm etc.) is used and how exactly it invokes the user's chosen desktop session

    – steeldriver
    Sep 28 at 19:00













1













1









1








I added a line at the beginning of .bashrc which is:



exit


No terminal will be opened (the usual way), but Ubuntu 18.04 never been able to log in (to the user interface).



I was able to log in later by editing .bashrc from the recovery mode root terminal interface and deleting the exit statement.



My question:




Does this mean that Ubuntu execute .bashrc when it logs in? ..



If so, how to write a condition (if statement) for the log_in or terminal_app case alone?











share|improve this question
















I added a line at the beginning of .bashrc which is:



exit


No terminal will be opened (the usual way), but Ubuntu 18.04 never been able to log in (to the user interface).



I was able to log in later by editing .bashrc from the recovery mode root terminal interface and deleting the exit statement.



My question:




Does this mean that Ubuntu execute .bashrc when it logs in? ..



If so, how to write a condition (if statement) for the log_in or terminal_app case alone?








command-line 18.04 bash login bashrc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 28 at 15:45







Yasin Yousif

















asked Sep 28 at 7:48









Yasin YousifYasin Yousif

1175 bronze badges




1175 bronze badges















  • man bash | less -p ^FILES

    – Cyrus
    Sep 28 at 8:01






  • 1





    If your .bashrc is based on the default Ubuntu one, make sure any commands like exit are placed after the case $- in ... esac section if you want them to apply only in interactive shells

    – steeldriver
    Sep 28 at 14:33












  • @steeldriver , it's working, .. the comment above (in .bashrc) explains it. so, the .bashrc does execute in non-interactive way when logging in? (P.S: if you may explain this in an answer)

    – Yasin Yousif
    Sep 28 at 18:36












  • @YasinYousif TBH I don't really know enough to write a good answer - I think that it depends which display manager (lightdm,gdm etc.) is used and how exactly it invokes the user's chosen desktop session

    – steeldriver
    Sep 28 at 19:00

















  • man bash | less -p ^FILES

    – Cyrus
    Sep 28 at 8:01






  • 1





    If your .bashrc is based on the default Ubuntu one, make sure any commands like exit are placed after the case $- in ... esac section if you want them to apply only in interactive shells

    – steeldriver
    Sep 28 at 14:33












  • @steeldriver , it's working, .. the comment above (in .bashrc) explains it. so, the .bashrc does execute in non-interactive way when logging in? (P.S: if you may explain this in an answer)

    – Yasin Yousif
    Sep 28 at 18:36












  • @YasinYousif TBH I don't really know enough to write a good answer - I think that it depends which display manager (lightdm,gdm etc.) is used and how exactly it invokes the user's chosen desktop session

    – steeldriver
    Sep 28 at 19:00
















man bash | less -p ^FILES

– Cyrus
Sep 28 at 8:01





man bash | less -p ^FILES

– Cyrus
Sep 28 at 8:01




1




1





If your .bashrc is based on the default Ubuntu one, make sure any commands like exit are placed after the case $- in ... esac section if you want them to apply only in interactive shells

– steeldriver
Sep 28 at 14:33






If your .bashrc is based on the default Ubuntu one, make sure any commands like exit are placed after the case $- in ... esac section if you want them to apply only in interactive shells

– steeldriver
Sep 28 at 14:33














@steeldriver , it's working, .. the comment above (in .bashrc) explains it. so, the .bashrc does execute in non-interactive way when logging in? (P.S: if you may explain this in an answer)

– Yasin Yousif
Sep 28 at 18:36






@steeldriver , it's working, .. the comment above (in .bashrc) explains it. so, the .bashrc does execute in non-interactive way when logging in? (P.S: if you may explain this in an answer)

– Yasin Yousif
Sep 28 at 18:36














@YasinYousif TBH I don't really know enough to write a good answer - I think that it depends which display manager (lightdm,gdm etc.) is used and how exactly it invokes the user's chosen desktop session

– steeldriver
Sep 28 at 19:00





@YasinYousif TBH I don't really know enough to write a good answer - I think that it depends which display manager (lightdm,gdm etc.) is used and how exactly it invokes the user's chosen desktop session

– steeldriver
Sep 28 at 19:00










1 Answer
1






active

oldest

votes


















-1



















~/.bashrc gets executed only when you open terminal window. Or in other words, when the bash program loads inside terminal. Same applies for ~/.zshrc as well.



I highly doubt some other issue is preventing you from logging in.






share|improve this answer




















  • 2





    You may want to reread your last sentence, I think you meant the opposite.

    – dessert
    Sep 28 at 8:17






  • 2





    "~/.bashrc gets executed only when you open terminal window" that's not quite true. It gets sourced directly when an interactive shell is invoked; however it's also sourced indirectly by login shells via the default ~/.profile file.

    – steeldriver
    Sep 28 at 10:51






  • 1





    @Yasin Yousif hey, check out this answer. serverfault.com/a/753459 If this helps, let me know. I'll update my answer. And thank you everyone for the clarification.

    – Abdus
    Sep 28 at 12:32












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1177229%2fis-bashrc-executed-when-ubuntu-18-logging-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown


























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









-1



















~/.bashrc gets executed only when you open terminal window. Or in other words, when the bash program loads inside terminal. Same applies for ~/.zshrc as well.



I highly doubt some other issue is preventing you from logging in.






share|improve this answer




















  • 2





    You may want to reread your last sentence, I think you meant the opposite.

    – dessert
    Sep 28 at 8:17






  • 2





    "~/.bashrc gets executed only when you open terminal window" that's not quite true. It gets sourced directly when an interactive shell is invoked; however it's also sourced indirectly by login shells via the default ~/.profile file.

    – steeldriver
    Sep 28 at 10:51






  • 1





    @Yasin Yousif hey, check out this answer. serverfault.com/a/753459 If this helps, let me know. I'll update my answer. And thank you everyone for the clarification.

    – Abdus
    Sep 28 at 12:32















-1



















~/.bashrc gets executed only when you open terminal window. Or in other words, when the bash program loads inside terminal. Same applies for ~/.zshrc as well.



I highly doubt some other issue is preventing you from logging in.






share|improve this answer




















  • 2





    You may want to reread your last sentence, I think you meant the opposite.

    – dessert
    Sep 28 at 8:17






  • 2





    "~/.bashrc gets executed only when you open terminal window" that's not quite true. It gets sourced directly when an interactive shell is invoked; however it's also sourced indirectly by login shells via the default ~/.profile file.

    – steeldriver
    Sep 28 at 10:51






  • 1





    @Yasin Yousif hey, check out this answer. serverfault.com/a/753459 If this helps, let me know. I'll update my answer. And thank you everyone for the clarification.

    – Abdus
    Sep 28 at 12:32













-1















-1











-1









~/.bashrc gets executed only when you open terminal window. Or in other words, when the bash program loads inside terminal. Same applies for ~/.zshrc as well.



I highly doubt some other issue is preventing you from logging in.






share|improve this answer














~/.bashrc gets executed only when you open terminal window. Or in other words, when the bash program loads inside terminal. Same applies for ~/.zshrc as well.



I highly doubt some other issue is preventing you from logging in.







share|improve this answer













share|improve this answer




share|improve this answer










answered Sep 28 at 8:01









AbdusAbdus

11 bronze badge




11 bronze badge










  • 2





    You may want to reread your last sentence, I think you meant the opposite.

    – dessert
    Sep 28 at 8:17






  • 2





    "~/.bashrc gets executed only when you open terminal window" that's not quite true. It gets sourced directly when an interactive shell is invoked; however it's also sourced indirectly by login shells via the default ~/.profile file.

    – steeldriver
    Sep 28 at 10:51






  • 1





    @Yasin Yousif hey, check out this answer. serverfault.com/a/753459 If this helps, let me know. I'll update my answer. And thank you everyone for the clarification.

    – Abdus
    Sep 28 at 12:32












  • 2





    You may want to reread your last sentence, I think you meant the opposite.

    – dessert
    Sep 28 at 8:17






  • 2





    "~/.bashrc gets executed only when you open terminal window" that's not quite true. It gets sourced directly when an interactive shell is invoked; however it's also sourced indirectly by login shells via the default ~/.profile file.

    – steeldriver
    Sep 28 at 10:51






  • 1





    @Yasin Yousif hey, check out this answer. serverfault.com/a/753459 If this helps, let me know. I'll update my answer. And thank you everyone for the clarification.

    – Abdus
    Sep 28 at 12:32







2




2





You may want to reread your last sentence, I think you meant the opposite.

– dessert
Sep 28 at 8:17





You may want to reread your last sentence, I think you meant the opposite.

– dessert
Sep 28 at 8:17




2




2





"~/.bashrc gets executed only when you open terminal window" that's not quite true. It gets sourced directly when an interactive shell is invoked; however it's also sourced indirectly by login shells via the default ~/.profile file.

– steeldriver
Sep 28 at 10:51





"~/.bashrc gets executed only when you open terminal window" that's not quite true. It gets sourced directly when an interactive shell is invoked; however it's also sourced indirectly by login shells via the default ~/.profile file.

– steeldriver
Sep 28 at 10:51




1




1





@Yasin Yousif hey, check out this answer. serverfault.com/a/753459 If this helps, let me know. I'll update my answer. And thank you everyone for the clarification.

– Abdus
Sep 28 at 12:32





@Yasin Yousif hey, check out this answer. serverfault.com/a/753459 If this helps, let me know. I'll update my answer. And thank you everyone for the clarification.

– Abdus
Sep 28 at 12:32


















draft saved

draft discarded















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1177229%2fis-bashrc-executed-when-ubuntu-18-logging-in%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown









Popular posts from this blog

Tamil (spriik) Luke uk diar | Nawigatjuun

Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?