bash alias disappears when opening new terminal [duplicate]












0















This question already has an answer here:




  • About .bash_profile, .bashrc, and where should alias be written in? [duplicate]

    4 answers




im setting up a new alias by typing this command:



vi ~/.bashrc 


and then placing my alias:



alias school='ssh -Y username@linux.student.cs.uwaterloo.ca'


followed by exiting the file using: wq



however when i close my terminal and open my terminal, i get a "command can't be found." error message.



if i type source ~/.bash_aliases, it will work, the alias will work, but when i open a new terminal it won't.



is my .bashrc supposed to be empty when i vi into it?










share|improve this question















marked as duplicate by melpomene, shellter, codeforester, l0b0, tripleee bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 at 5:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 1




    What's the exact error message you get?
    – melpomene
    Nov 12 at 22:25






  • 1




    so .bashrc is not sourced when you login. Search for .bash_bashrc or .bash_profile or .profile etc.
    – Kamil Cuk
    Nov 12 at 22:41










  • See lhunath's very useful answer to understand how these things work: About .bash_profile, .bashrc, and where should alias be written in?.
    – codeforester
    Nov 12 at 23:50


















0















This question already has an answer here:




  • About .bash_profile, .bashrc, and where should alias be written in? [duplicate]

    4 answers




im setting up a new alias by typing this command:



vi ~/.bashrc 


and then placing my alias:



alias school='ssh -Y username@linux.student.cs.uwaterloo.ca'


followed by exiting the file using: wq



however when i close my terminal and open my terminal, i get a "command can't be found." error message.



if i type source ~/.bash_aliases, it will work, the alias will work, but when i open a new terminal it won't.



is my .bashrc supposed to be empty when i vi into it?










share|improve this question















marked as duplicate by melpomene, shellter, codeforester, l0b0, tripleee bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 at 5:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 1




    What's the exact error message you get?
    – melpomene
    Nov 12 at 22:25






  • 1




    so .bashrc is not sourced when you login. Search for .bash_bashrc or .bash_profile or .profile etc.
    – Kamil Cuk
    Nov 12 at 22:41










  • See lhunath's very useful answer to understand how these things work: About .bash_profile, .bashrc, and where should alias be written in?.
    – codeforester
    Nov 12 at 23:50
















0












0








0








This question already has an answer here:




  • About .bash_profile, .bashrc, and where should alias be written in? [duplicate]

    4 answers




im setting up a new alias by typing this command:



vi ~/.bashrc 


and then placing my alias:



alias school='ssh -Y username@linux.student.cs.uwaterloo.ca'


followed by exiting the file using: wq



however when i close my terminal and open my terminal, i get a "command can't be found." error message.



if i type source ~/.bash_aliases, it will work, the alias will work, but when i open a new terminal it won't.



is my .bashrc supposed to be empty when i vi into it?










share|improve this question
















This question already has an answer here:




  • About .bash_profile, .bashrc, and where should alias be written in? [duplicate]

    4 answers




im setting up a new alias by typing this command:



vi ~/.bashrc 


and then placing my alias:



alias school='ssh -Y username@linux.student.cs.uwaterloo.ca'


followed by exiting the file using: wq



however when i close my terminal and open my terminal, i get a "command can't be found." error message.



if i type source ~/.bash_aliases, it will work, the alias will work, but when i open a new terminal it won't.



is my .bashrc supposed to be empty when i vi into it?





This question already has an answer here:




  • About .bash_profile, .bashrc, and where should alias be written in? [duplicate]

    4 answers








bash alias






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 23:53









codeforester

17.4k83864




17.4k83864










asked Nov 12 at 22:24









SqR_08

1




1




marked as duplicate by melpomene, shellter, codeforester, l0b0, tripleee bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 at 5:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by melpomene, shellter, codeforester, l0b0, tripleee bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 at 5:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    What's the exact error message you get?
    – melpomene
    Nov 12 at 22:25






  • 1




    so .bashrc is not sourced when you login. Search for .bash_bashrc or .bash_profile or .profile etc.
    – Kamil Cuk
    Nov 12 at 22:41










  • See lhunath's very useful answer to understand how these things work: About .bash_profile, .bashrc, and where should alias be written in?.
    – codeforester
    Nov 12 at 23:50
















  • 1




    What's the exact error message you get?
    – melpomene
    Nov 12 at 22:25






  • 1




    so .bashrc is not sourced when you login. Search for .bash_bashrc or .bash_profile or .profile etc.
    – Kamil Cuk
    Nov 12 at 22:41










  • See lhunath's very useful answer to understand how these things work: About .bash_profile, .bashrc, and where should alias be written in?.
    – codeforester
    Nov 12 at 23:50










1




1




What's the exact error message you get?
– melpomene
Nov 12 at 22:25




What's the exact error message you get?
– melpomene
Nov 12 at 22:25




1




1




so .bashrc is not sourced when you login. Search for .bash_bashrc or .bash_profile or .profile etc.
– Kamil Cuk
Nov 12 at 22:41




so .bashrc is not sourced when you login. Search for .bash_bashrc or .bash_profile or .profile etc.
– Kamil Cuk
Nov 12 at 22:41












See lhunath's very useful answer to understand how these things work: About .bash_profile, .bashrc, and where should alias be written in?.
– codeforester
Nov 12 at 23:50






See lhunath's very useful answer to understand how these things work: About .bash_profile, .bashrc, and where should alias be written in?.
– codeforester
Nov 12 at 23:50














1 Answer
1






active

oldest

votes


















0














The reason your alias is getting lost is because you dont have your bashrc sourced in a new terminal.



Same will happen even if you create a new alias file and source it in bashrc because its scope gets limited to the terminal you are editing in.



What you can do is logout once and then log in back so that bashrc entries gets updated for your user account or you can source in each terminal by typing



source ~/.bashrc


By adding the same entry to '''.profile''' you are making sure the alias is set on each system boot.



So its better to set the alias in .bashrc rather than .profile



Another major point to nite here is to make sure you dont delete anything in bashrc since that will do catastrophic changes to you session.






share|improve this answer





















  • is there a way to make my alias permanent instead of doing "source ~/.bashrc" every time?
    – SqR_08
    Nov 14 at 2:43










  • As i commented in my answer you do a logout/login session and that should work for you.
    – Amit Bhardwaj
    Nov 14 at 10:56










  • how exactly do i logout/login? i closed the terminal, opened a new one and it didnt work. also tried restarting my computer
    – SqR_08
    Nov 15 at 18:28


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The reason your alias is getting lost is because you dont have your bashrc sourced in a new terminal.



Same will happen even if you create a new alias file and source it in bashrc because its scope gets limited to the terminal you are editing in.



What you can do is logout once and then log in back so that bashrc entries gets updated for your user account or you can source in each terminal by typing



source ~/.bashrc


By adding the same entry to '''.profile''' you are making sure the alias is set on each system boot.



So its better to set the alias in .bashrc rather than .profile



Another major point to nite here is to make sure you dont delete anything in bashrc since that will do catastrophic changes to you session.






share|improve this answer





















  • is there a way to make my alias permanent instead of doing "source ~/.bashrc" every time?
    – SqR_08
    Nov 14 at 2:43










  • As i commented in my answer you do a logout/login session and that should work for you.
    – Amit Bhardwaj
    Nov 14 at 10:56










  • how exactly do i logout/login? i closed the terminal, opened a new one and it didnt work. also tried restarting my computer
    – SqR_08
    Nov 15 at 18:28
















0














The reason your alias is getting lost is because you dont have your bashrc sourced in a new terminal.



Same will happen even if you create a new alias file and source it in bashrc because its scope gets limited to the terminal you are editing in.



What you can do is logout once and then log in back so that bashrc entries gets updated for your user account or you can source in each terminal by typing



source ~/.bashrc


By adding the same entry to '''.profile''' you are making sure the alias is set on each system boot.



So its better to set the alias in .bashrc rather than .profile



Another major point to nite here is to make sure you dont delete anything in bashrc since that will do catastrophic changes to you session.






share|improve this answer





















  • is there a way to make my alias permanent instead of doing "source ~/.bashrc" every time?
    – SqR_08
    Nov 14 at 2:43










  • As i commented in my answer you do a logout/login session and that should work for you.
    – Amit Bhardwaj
    Nov 14 at 10:56










  • how exactly do i logout/login? i closed the terminal, opened a new one and it didnt work. also tried restarting my computer
    – SqR_08
    Nov 15 at 18:28














0












0








0






The reason your alias is getting lost is because you dont have your bashrc sourced in a new terminal.



Same will happen even if you create a new alias file and source it in bashrc because its scope gets limited to the terminal you are editing in.



What you can do is logout once and then log in back so that bashrc entries gets updated for your user account or you can source in each terminal by typing



source ~/.bashrc


By adding the same entry to '''.profile''' you are making sure the alias is set on each system boot.



So its better to set the alias in .bashrc rather than .profile



Another major point to nite here is to make sure you dont delete anything in bashrc since that will do catastrophic changes to you session.






share|improve this answer












The reason your alias is getting lost is because you dont have your bashrc sourced in a new terminal.



Same will happen even if you create a new alias file and source it in bashrc because its scope gets limited to the terminal you are editing in.



What you can do is logout once and then log in back so that bashrc entries gets updated for your user account or you can source in each terminal by typing



source ~/.bashrc


By adding the same entry to '''.profile''' you are making sure the alias is set on each system boot.



So its better to set the alias in .bashrc rather than .profile



Another major point to nite here is to make sure you dont delete anything in bashrc since that will do catastrophic changes to you session.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 at 5:32









Amit Bhardwaj

1638




1638












  • is there a way to make my alias permanent instead of doing "source ~/.bashrc" every time?
    – SqR_08
    Nov 14 at 2:43










  • As i commented in my answer you do a logout/login session and that should work for you.
    – Amit Bhardwaj
    Nov 14 at 10:56










  • how exactly do i logout/login? i closed the terminal, opened a new one and it didnt work. also tried restarting my computer
    – SqR_08
    Nov 15 at 18:28


















  • is there a way to make my alias permanent instead of doing "source ~/.bashrc" every time?
    – SqR_08
    Nov 14 at 2:43










  • As i commented in my answer you do a logout/login session and that should work for you.
    – Amit Bhardwaj
    Nov 14 at 10:56










  • how exactly do i logout/login? i closed the terminal, opened a new one and it didnt work. also tried restarting my computer
    – SqR_08
    Nov 15 at 18:28
















is there a way to make my alias permanent instead of doing "source ~/.bashrc" every time?
– SqR_08
Nov 14 at 2:43




is there a way to make my alias permanent instead of doing "source ~/.bashrc" every time?
– SqR_08
Nov 14 at 2:43












As i commented in my answer you do a logout/login session and that should work for you.
– Amit Bhardwaj
Nov 14 at 10:56




As i commented in my answer you do a logout/login session and that should work for you.
– Amit Bhardwaj
Nov 14 at 10:56












how exactly do i logout/login? i closed the terminal, opened a new one and it didnt work. also tried restarting my computer
– SqR_08
Nov 15 at 18:28




how exactly do i logout/login? i closed the terminal, opened a new one and it didnt work. also tried restarting my computer
– SqR_08
Nov 15 at 18:28



Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?