No bashrc file in my home directory












10















Here is what I noted down from my lecture:




  • Find file .bashrc in your home directory

  • do vi .bashrc

  • When you put an application folder somewhere, make sure that its address is in the
    path variable.


The problem is that I do not have a .bashrc file in my home directory. There is only a .bash_history file in my home.



If i go to the root, there is a etc/bash.bashrc file there but what i think is that it will make changes for all users and not just for me. I want to add this path just for myself. It shouldn't effect others. Also there is no $PATH variable in that bashrc file so I am even more confused.










share|improve this question















migrated from stackoverflow.com Apr 18 '13 at 14:29


This question came from our site for professional and enthusiast programmers.























    10















    Here is what I noted down from my lecture:




    • Find file .bashrc in your home directory

    • do vi .bashrc

    • When you put an application folder somewhere, make sure that its address is in the
      path variable.


    The problem is that I do not have a .bashrc file in my home directory. There is only a .bash_history file in my home.



    If i go to the root, there is a etc/bash.bashrc file there but what i think is that it will make changes for all users and not just for me. I want to add this path just for myself. It shouldn't effect others. Also there is no $PATH variable in that bashrc file so I am even more confused.










    share|improve this question















    migrated from stackoverflow.com Apr 18 '13 at 14:29


    This question came from our site for professional and enthusiast programmers.





















      10












      10








      10


      5






      Here is what I noted down from my lecture:




      • Find file .bashrc in your home directory

      • do vi .bashrc

      • When you put an application folder somewhere, make sure that its address is in the
        path variable.


      The problem is that I do not have a .bashrc file in my home directory. There is only a .bash_history file in my home.



      If i go to the root, there is a etc/bash.bashrc file there but what i think is that it will make changes for all users and not just for me. I want to add this path just for myself. It shouldn't effect others. Also there is no $PATH variable in that bashrc file so I am even more confused.










      share|improve this question
















      Here is what I noted down from my lecture:




      • Find file .bashrc in your home directory

      • do vi .bashrc

      • When you put an application folder somewhere, make sure that its address is in the
        path variable.


      The problem is that I do not have a .bashrc file in my home directory. There is only a .bash_history file in my home.



      If i go to the root, there is a etc/bash.bashrc file there but what i think is that it will make changes for all users and not just for me. I want to add this path just for myself. It shouldn't effect others. Also there is no $PATH variable in that bashrc file so I am even more confused.







      bash bashrc






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 22 '15 at 10:38









      7ochem

      157111




      157111










      asked Apr 18 '13 at 13:04









      detravellerdetraveller

      2802311




      2802311




      migrated from stackoverflow.com Apr 18 '13 at 14:29


      This question came from our site for professional and enthusiast programmers.









      migrated from stackoverflow.com Apr 18 '13 at 14:29


      This question came from our site for professional and enthusiast programmers.
























          5 Answers
          5






          active

          oldest

          votes


















          11














          Don't forget it is a hidden file inside your home directory (you would not be the first to do a ls -l and thinking it is not there).



          Do following ...



          ls -la ~/ | more


          There should be a .bashrc on the first page. If not just create it with



          vi ~/.bashrc


          And simply write following line into it.



          PATH=$PATH:~/bin




          OR
          Most of the distributions keep a standard .bashrc file in /etc/skel/ You can copy it to home directory.



          $cp /etc/skel/.bashrc ~





          share|improve this answer
























          • OK I get that now. On other computers, I can type lego and the software starts. On my system, the lego folder is in my ~/data/user1/bin folder. I have added this path to .bashrc file. Now what do I have to do so that when i type lego, it should start the software? Do i have to set up an alias? If yes, how? alias lego='<What do i put here???>'

            – detraveller
            Apr 18 '13 at 13:47











          • @detraveller Have you added ~/data/user1/bin to your PATH environment variable in the .bashrc file? (add this line: export PATH=$PATH:~/data/user1/bin) - if so, you should be able to just type lego in the terminal, and the program should start.

            – AcId
            Apr 18 '13 at 14:40













          • I added only PATH=$PATH:~/data/user1/bin. You didn't mention export so I didn't put it there. I will try again tomorrow when I go to Uni.

            – detraveller
            Apr 18 '13 at 18:12











          • But i was wondering how do i tell bash that lego is the word that starts the software?

            – detraveller
            Apr 18 '13 at 18:25



















          11














          Most distributions keep a standard .bashrc file in /etc/skel/ you can just copy to your home dir. Otherwise you could just make a new empty .bashrc file in your home dir.






          share|improve this answer

































            4














            Create Your Own Startup File for Interactive Shells



            About Bash Startup Files



            From the INVOCATION section of man 1 bash says:




            When an interactive shell that is not a login shell is started, bash
            reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
            these files exist.




            Note that these startup files are optional; Bash doesn't require them. Bash also differentiates between login shells and interactive shells. An interactive shell is defined thus:




            An interactive shell is one started without non-option arguments and
            without the -c option whose standard input and error are both connected
            to terminals (as determined by isatty(3)), or one started with the -i
            option.




            Many distributions source one type of startup file from the other, but some don't, so this issue can be difficult to address canonically. You need to examine all your startup files to see how and when your ~/.bashrc will be invoked on your system.



            Creating Your Per-User Interactive Shell Startup File



            If you're simply missing a user-specific ~/.bashrc file, just create one. This will be invoked by Bash for non-login shells (e.g. shells started without the --login flag), or whenever you force the shell to be interactive by invoking it with the -i flag.






            share|improve this answer































              0














              If you don't have a .bashrc, you can simply create one and add the lines you wish to it, such as:



              PATH=$PATH:~/bin


              to add your user bin directory to the end of the path.



              But you should be careful if there are other startup files. The rules as to what files get used are rather complex, but they're detailed in the bash man page. Enter man bash on a command line and look for INVOCATION.






              share|improve this answer































                0














                Short answers:




                1. find ~ -maxdepth 1 -name '.bashrc'

                2. vi ~/.bashrc

                3. echo $PATH | grep ~/MyNewCoolProgramFolder


                Detailed one:

                I take a more close literal interpretation.





                1. "Find file .bashrc in your home directory"

                  Since it exists the command find, maybe the treacherous editor would suggest you to use it:



                  find ~ -maxdepth 1 -name '.bashrc'


                  Search in the home directory ~, descend only of one level (no subdir -maxdepth 1). For all the options write man find.

                  The line below the will do the minimal job



                  ls ~/.bashrc   


                  Note: In case ~/.bashrc doesn't exist you can create it with a simple echo >> ~/.bashrc.



                  The >> will create the file if doesn't exists. If the ~/.bashrc instead exists it will append only the harmless output of empty echo, avoiding an unintentional deletion a such critical file, that is incidentally difficult to restore without a backup.



                  (The following is because seldom I have to honour the meaning of my nickname, do not execute if you are in doubt).



                  if [ ! -f ~/.bashrc ] ; 
                  then
                  cp -i /etc/skel/.bashrc ~/.bashrc ;
                  else ls -la ~/.bashrc;
                  fi || echo " # Auto Generated " >> ~/.bashrc


                2. "Do vi .bashrc"

                  Now you can do vi ~/.bashrc, the trap here is that you need to press : and q to exit !



                3. Application folder and $PATH

                  When you create an application folder, e.g. ~/MyNewCoolProgramFolder, the below line will only check if it is in the $PATH:



                  echo $PATH | grep ~/MyNewCoolProgramFolder


                  You do not need to add if is already there. If needed you can add to the $PATH with



                  PATH=$PATH:~/MyNewCoolProgramFolder


                  and to add that line to ~/.bashrc if you want to make it permanent.




                4. "4?!? How 4 if there were only 3 points?"- Workarounds.

                  There are some workarounds for the latter; let's suppose an executable file named CoolDetraveller exists only in your new application folder:



                  (a) You can try to execute it. Simply it will not start if it is not in the $PATH.




                  CoolDetraveller: command not found




                  (b) You can try its auto completion. Start to write CoolDetravelle and press Tab. If it is in the $PATH it will be auto completed (always if auto completion is enabled).



                  (c) You can ask to the bash shell which command will be used if you write the command CoolDetraveller.



                      which CoolDetraveller


                  Note:
                  If in your application path there is one or more spaces, which could be unable to find CoolDetraveller, although (here I honour my nickname again) the auto completion of CoolDetraveller as a valid parameter of the which command will work!



                  Ad nauseam: You cannot ask whereis CoolDetraveller because whereis




                  has a hard-coded path, so may not always find what you're looking for









                share|improve this answer























                  Your Answer








                  StackExchange.ready(function() {
                  var channelOptions = {
                  tags: "".split(" "),
                  id: "3"
                  };
                  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/3.0/"u003ecc by-sa 3.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%2fsuperuser.com%2fquestions%2f584540%2fno-bashrc-file-in-my-home-directory%23new-answer', 'question_page');
                  }
                  );

                  Post as a guest















                  Required, but never shown

























                  5 Answers
                  5






                  active

                  oldest

                  votes








                  5 Answers
                  5






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  11














                  Don't forget it is a hidden file inside your home directory (you would not be the first to do a ls -l and thinking it is not there).



                  Do following ...



                  ls -la ~/ | more


                  There should be a .bashrc on the first page. If not just create it with



                  vi ~/.bashrc


                  And simply write following line into it.



                  PATH=$PATH:~/bin




                  OR
                  Most of the distributions keep a standard .bashrc file in /etc/skel/ You can copy it to home directory.



                  $cp /etc/skel/.bashrc ~





                  share|improve this answer
























                  • OK I get that now. On other computers, I can type lego and the software starts. On my system, the lego folder is in my ~/data/user1/bin folder. I have added this path to .bashrc file. Now what do I have to do so that when i type lego, it should start the software? Do i have to set up an alias? If yes, how? alias lego='<What do i put here???>'

                    – detraveller
                    Apr 18 '13 at 13:47











                  • @detraveller Have you added ~/data/user1/bin to your PATH environment variable in the .bashrc file? (add this line: export PATH=$PATH:~/data/user1/bin) - if so, you should be able to just type lego in the terminal, and the program should start.

                    – AcId
                    Apr 18 '13 at 14:40













                  • I added only PATH=$PATH:~/data/user1/bin. You didn't mention export so I didn't put it there. I will try again tomorrow when I go to Uni.

                    – detraveller
                    Apr 18 '13 at 18:12











                  • But i was wondering how do i tell bash that lego is the word that starts the software?

                    – detraveller
                    Apr 18 '13 at 18:25
















                  11














                  Don't forget it is a hidden file inside your home directory (you would not be the first to do a ls -l and thinking it is not there).



                  Do following ...



                  ls -la ~/ | more


                  There should be a .bashrc on the first page. If not just create it with



                  vi ~/.bashrc


                  And simply write following line into it.



                  PATH=$PATH:~/bin




                  OR
                  Most of the distributions keep a standard .bashrc file in /etc/skel/ You can copy it to home directory.



                  $cp /etc/skel/.bashrc ~





                  share|improve this answer
























                  • OK I get that now. On other computers, I can type lego and the software starts. On my system, the lego folder is in my ~/data/user1/bin folder. I have added this path to .bashrc file. Now what do I have to do so that when i type lego, it should start the software? Do i have to set up an alias? If yes, how? alias lego='<What do i put here???>'

                    – detraveller
                    Apr 18 '13 at 13:47











                  • @detraveller Have you added ~/data/user1/bin to your PATH environment variable in the .bashrc file? (add this line: export PATH=$PATH:~/data/user1/bin) - if so, you should be able to just type lego in the terminal, and the program should start.

                    – AcId
                    Apr 18 '13 at 14:40













                  • I added only PATH=$PATH:~/data/user1/bin. You didn't mention export so I didn't put it there. I will try again tomorrow when I go to Uni.

                    – detraveller
                    Apr 18 '13 at 18:12











                  • But i was wondering how do i tell bash that lego is the word that starts the software?

                    – detraveller
                    Apr 18 '13 at 18:25














                  11












                  11








                  11







                  Don't forget it is a hidden file inside your home directory (you would not be the first to do a ls -l and thinking it is not there).



                  Do following ...



                  ls -la ~/ | more


                  There should be a .bashrc on the first page. If not just create it with



                  vi ~/.bashrc


                  And simply write following line into it.



                  PATH=$PATH:~/bin




                  OR
                  Most of the distributions keep a standard .bashrc file in /etc/skel/ You can copy it to home directory.



                  $cp /etc/skel/.bashrc ~





                  share|improve this answer













                  Don't forget it is a hidden file inside your home directory (you would not be the first to do a ls -l and thinking it is not there).



                  Do following ...



                  ls -la ~/ | more


                  There should be a .bashrc on the first page. If not just create it with



                  vi ~/.bashrc


                  And simply write following line into it.



                  PATH=$PATH:~/bin




                  OR
                  Most of the distributions keep a standard .bashrc file in /etc/skel/ You can copy it to home directory.



                  $cp /etc/skel/.bashrc ~






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 18 '13 at 13:13









                  MangeshBiradarMangeshBiradar

                  3711310




                  3711310













                  • OK I get that now. On other computers, I can type lego and the software starts. On my system, the lego folder is in my ~/data/user1/bin folder. I have added this path to .bashrc file. Now what do I have to do so that when i type lego, it should start the software? Do i have to set up an alias? If yes, how? alias lego='<What do i put here???>'

                    – detraveller
                    Apr 18 '13 at 13:47











                  • @detraveller Have you added ~/data/user1/bin to your PATH environment variable in the .bashrc file? (add this line: export PATH=$PATH:~/data/user1/bin) - if so, you should be able to just type lego in the terminal, and the program should start.

                    – AcId
                    Apr 18 '13 at 14:40













                  • I added only PATH=$PATH:~/data/user1/bin. You didn't mention export so I didn't put it there. I will try again tomorrow when I go to Uni.

                    – detraveller
                    Apr 18 '13 at 18:12











                  • But i was wondering how do i tell bash that lego is the word that starts the software?

                    – detraveller
                    Apr 18 '13 at 18:25



















                  • OK I get that now. On other computers, I can type lego and the software starts. On my system, the lego folder is in my ~/data/user1/bin folder. I have added this path to .bashrc file. Now what do I have to do so that when i type lego, it should start the software? Do i have to set up an alias? If yes, how? alias lego='<What do i put here???>'

                    – detraveller
                    Apr 18 '13 at 13:47











                  • @detraveller Have you added ~/data/user1/bin to your PATH environment variable in the .bashrc file? (add this line: export PATH=$PATH:~/data/user1/bin) - if so, you should be able to just type lego in the terminal, and the program should start.

                    – AcId
                    Apr 18 '13 at 14:40













                  • I added only PATH=$PATH:~/data/user1/bin. You didn't mention export so I didn't put it there. I will try again tomorrow when I go to Uni.

                    – detraveller
                    Apr 18 '13 at 18:12











                  • But i was wondering how do i tell bash that lego is the word that starts the software?

                    – detraveller
                    Apr 18 '13 at 18:25

















                  OK I get that now. On other computers, I can type lego and the software starts. On my system, the lego folder is in my ~/data/user1/bin folder. I have added this path to .bashrc file. Now what do I have to do so that when i type lego, it should start the software? Do i have to set up an alias? If yes, how? alias lego='<What do i put here???>'

                  – detraveller
                  Apr 18 '13 at 13:47





                  OK I get that now. On other computers, I can type lego and the software starts. On my system, the lego folder is in my ~/data/user1/bin folder. I have added this path to .bashrc file. Now what do I have to do so that when i type lego, it should start the software? Do i have to set up an alias? If yes, how? alias lego='<What do i put here???>'

                  – detraveller
                  Apr 18 '13 at 13:47













                  @detraveller Have you added ~/data/user1/bin to your PATH environment variable in the .bashrc file? (add this line: export PATH=$PATH:~/data/user1/bin) - if so, you should be able to just type lego in the terminal, and the program should start.

                  – AcId
                  Apr 18 '13 at 14:40







                  @detraveller Have you added ~/data/user1/bin to your PATH environment variable in the .bashrc file? (add this line: export PATH=$PATH:~/data/user1/bin) - if so, you should be able to just type lego in the terminal, and the program should start.

                  – AcId
                  Apr 18 '13 at 14:40















                  I added only PATH=$PATH:~/data/user1/bin. You didn't mention export so I didn't put it there. I will try again tomorrow when I go to Uni.

                  – detraveller
                  Apr 18 '13 at 18:12





                  I added only PATH=$PATH:~/data/user1/bin. You didn't mention export so I didn't put it there. I will try again tomorrow when I go to Uni.

                  – detraveller
                  Apr 18 '13 at 18:12













                  But i was wondering how do i tell bash that lego is the word that starts the software?

                  – detraveller
                  Apr 18 '13 at 18:25





                  But i was wondering how do i tell bash that lego is the word that starts the software?

                  – detraveller
                  Apr 18 '13 at 18:25













                  11














                  Most distributions keep a standard .bashrc file in /etc/skel/ you can just copy to your home dir. Otherwise you could just make a new empty .bashrc file in your home dir.






                  share|improve this answer






























                    11














                    Most distributions keep a standard .bashrc file in /etc/skel/ you can just copy to your home dir. Otherwise you could just make a new empty .bashrc file in your home dir.






                    share|improve this answer




























                      11












                      11








                      11







                      Most distributions keep a standard .bashrc file in /etc/skel/ you can just copy to your home dir. Otherwise you could just make a new empty .bashrc file in your home dir.






                      share|improve this answer















                      Most distributions keep a standard .bashrc file in /etc/skel/ you can just copy to your home dir. Otherwise you could just make a new empty .bashrc file in your home dir.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jun 22 '15 at 10:39









                      7ochem

                      157111




                      157111










                      answered Apr 18 '13 at 13:07









                      AcIdAcId

                      60449




                      60449























                          4














                          Create Your Own Startup File for Interactive Shells



                          About Bash Startup Files



                          From the INVOCATION section of man 1 bash says:




                          When an interactive shell that is not a login shell is started, bash
                          reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
                          these files exist.




                          Note that these startup files are optional; Bash doesn't require them. Bash also differentiates between login shells and interactive shells. An interactive shell is defined thus:




                          An interactive shell is one started without non-option arguments and
                          without the -c option whose standard input and error are both connected
                          to terminals (as determined by isatty(3)), or one started with the -i
                          option.




                          Many distributions source one type of startup file from the other, but some don't, so this issue can be difficult to address canonically. You need to examine all your startup files to see how and when your ~/.bashrc will be invoked on your system.



                          Creating Your Per-User Interactive Shell Startup File



                          If you're simply missing a user-specific ~/.bashrc file, just create one. This will be invoked by Bash for non-login shells (e.g. shells started without the --login flag), or whenever you force the shell to be interactive by invoking it with the -i flag.






                          share|improve this answer




























                            4














                            Create Your Own Startup File for Interactive Shells



                            About Bash Startup Files



                            From the INVOCATION section of man 1 bash says:




                            When an interactive shell that is not a login shell is started, bash
                            reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
                            these files exist.




                            Note that these startup files are optional; Bash doesn't require them. Bash also differentiates between login shells and interactive shells. An interactive shell is defined thus:




                            An interactive shell is one started without non-option arguments and
                            without the -c option whose standard input and error are both connected
                            to terminals (as determined by isatty(3)), or one started with the -i
                            option.




                            Many distributions source one type of startup file from the other, but some don't, so this issue can be difficult to address canonically. You need to examine all your startup files to see how and when your ~/.bashrc will be invoked on your system.



                            Creating Your Per-User Interactive Shell Startup File



                            If you're simply missing a user-specific ~/.bashrc file, just create one. This will be invoked by Bash for non-login shells (e.g. shells started without the --login flag), or whenever you force the shell to be interactive by invoking it with the -i flag.






                            share|improve this answer


























                              4












                              4








                              4







                              Create Your Own Startup File for Interactive Shells



                              About Bash Startup Files



                              From the INVOCATION section of man 1 bash says:




                              When an interactive shell that is not a login shell is started, bash
                              reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
                              these files exist.




                              Note that these startup files are optional; Bash doesn't require them. Bash also differentiates between login shells and interactive shells. An interactive shell is defined thus:




                              An interactive shell is one started without non-option arguments and
                              without the -c option whose standard input and error are both connected
                              to terminals (as determined by isatty(3)), or one started with the -i
                              option.




                              Many distributions source one type of startup file from the other, but some don't, so this issue can be difficult to address canonically. You need to examine all your startup files to see how and when your ~/.bashrc will be invoked on your system.



                              Creating Your Per-User Interactive Shell Startup File



                              If you're simply missing a user-specific ~/.bashrc file, just create one. This will be invoked by Bash for non-login shells (e.g. shells started without the --login flag), or whenever you force the shell to be interactive by invoking it with the -i flag.






                              share|improve this answer













                              Create Your Own Startup File for Interactive Shells



                              About Bash Startup Files



                              From the INVOCATION section of man 1 bash says:




                              When an interactive shell that is not a login shell is started, bash
                              reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
                              these files exist.




                              Note that these startup files are optional; Bash doesn't require them. Bash also differentiates between login shells and interactive shells. An interactive shell is defined thus:




                              An interactive shell is one started without non-option arguments and
                              without the -c option whose standard input and error are both connected
                              to terminals (as determined by isatty(3)), or one started with the -i
                              option.




                              Many distributions source one type of startup file from the other, but some don't, so this issue can be difficult to address canonically. You need to examine all your startup files to see how and when your ~/.bashrc will be invoked on your system.



                              Creating Your Per-User Interactive Shell Startup File



                              If you're simply missing a user-specific ~/.bashrc file, just create one. This will be invoked by Bash for non-login shells (e.g. shells started without the --login flag), or whenever you force the shell to be interactive by invoking it with the -i flag.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Apr 18 '13 at 13:18









                              CodeGnomeCodeGnome

                              1,766821




                              1,766821























                                  0














                                  If you don't have a .bashrc, you can simply create one and add the lines you wish to it, such as:



                                  PATH=$PATH:~/bin


                                  to add your user bin directory to the end of the path.



                                  But you should be careful if there are other startup files. The rules as to what files get used are rather complex, but they're detailed in the bash man page. Enter man bash on a command line and look for INVOCATION.






                                  share|improve this answer




























                                    0














                                    If you don't have a .bashrc, you can simply create one and add the lines you wish to it, such as:



                                    PATH=$PATH:~/bin


                                    to add your user bin directory to the end of the path.



                                    But you should be careful if there are other startup files. The rules as to what files get used are rather complex, but they're detailed in the bash man page. Enter man bash on a command line and look for INVOCATION.






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      If you don't have a .bashrc, you can simply create one and add the lines you wish to it, such as:



                                      PATH=$PATH:~/bin


                                      to add your user bin directory to the end of the path.



                                      But you should be careful if there are other startup files. The rules as to what files get used are rather complex, but they're detailed in the bash man page. Enter man bash on a command line and look for INVOCATION.






                                      share|improve this answer













                                      If you don't have a .bashrc, you can simply create one and add the lines you wish to it, such as:



                                      PATH=$PATH:~/bin


                                      to add your user bin directory to the end of the path.



                                      But you should be careful if there are other startup files. The rules as to what files get used are rather complex, but they're detailed in the bash man page. Enter man bash on a command line and look for INVOCATION.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Apr 18 '13 at 13:07







                                      user53528






























                                          0














                                          Short answers:




                                          1. find ~ -maxdepth 1 -name '.bashrc'

                                          2. vi ~/.bashrc

                                          3. echo $PATH | grep ~/MyNewCoolProgramFolder


                                          Detailed one:

                                          I take a more close literal interpretation.





                                          1. "Find file .bashrc in your home directory"

                                            Since it exists the command find, maybe the treacherous editor would suggest you to use it:



                                            find ~ -maxdepth 1 -name '.bashrc'


                                            Search in the home directory ~, descend only of one level (no subdir -maxdepth 1). For all the options write man find.

                                            The line below the will do the minimal job



                                            ls ~/.bashrc   


                                            Note: In case ~/.bashrc doesn't exist you can create it with a simple echo >> ~/.bashrc.



                                            The >> will create the file if doesn't exists. If the ~/.bashrc instead exists it will append only the harmless output of empty echo, avoiding an unintentional deletion a such critical file, that is incidentally difficult to restore without a backup.



                                            (The following is because seldom I have to honour the meaning of my nickname, do not execute if you are in doubt).



                                            if [ ! -f ~/.bashrc ] ; 
                                            then
                                            cp -i /etc/skel/.bashrc ~/.bashrc ;
                                            else ls -la ~/.bashrc;
                                            fi || echo " # Auto Generated " >> ~/.bashrc


                                          2. "Do vi .bashrc"

                                            Now you can do vi ~/.bashrc, the trap here is that you need to press : and q to exit !



                                          3. Application folder and $PATH

                                            When you create an application folder, e.g. ~/MyNewCoolProgramFolder, the below line will only check if it is in the $PATH:



                                            echo $PATH | grep ~/MyNewCoolProgramFolder


                                            You do not need to add if is already there. If needed you can add to the $PATH with



                                            PATH=$PATH:~/MyNewCoolProgramFolder


                                            and to add that line to ~/.bashrc if you want to make it permanent.




                                          4. "4?!? How 4 if there were only 3 points?"- Workarounds.

                                            There are some workarounds for the latter; let's suppose an executable file named CoolDetraveller exists only in your new application folder:



                                            (a) You can try to execute it. Simply it will not start if it is not in the $PATH.




                                            CoolDetraveller: command not found




                                            (b) You can try its auto completion. Start to write CoolDetravelle and press Tab. If it is in the $PATH it will be auto completed (always if auto completion is enabled).



                                            (c) You can ask to the bash shell which command will be used if you write the command CoolDetraveller.



                                                which CoolDetraveller


                                            Note:
                                            If in your application path there is one or more spaces, which could be unable to find CoolDetraveller, although (here I honour my nickname again) the auto completion of CoolDetraveller as a valid parameter of the which command will work!



                                            Ad nauseam: You cannot ask whereis CoolDetraveller because whereis




                                            has a hard-coded path, so may not always find what you're looking for









                                          share|improve this answer




























                                            0














                                            Short answers:




                                            1. find ~ -maxdepth 1 -name '.bashrc'

                                            2. vi ~/.bashrc

                                            3. echo $PATH | grep ~/MyNewCoolProgramFolder


                                            Detailed one:

                                            I take a more close literal interpretation.





                                            1. "Find file .bashrc in your home directory"

                                              Since it exists the command find, maybe the treacherous editor would suggest you to use it:



                                              find ~ -maxdepth 1 -name '.bashrc'


                                              Search in the home directory ~, descend only of one level (no subdir -maxdepth 1). For all the options write man find.

                                              The line below the will do the minimal job



                                              ls ~/.bashrc   


                                              Note: In case ~/.bashrc doesn't exist you can create it with a simple echo >> ~/.bashrc.



                                              The >> will create the file if doesn't exists. If the ~/.bashrc instead exists it will append only the harmless output of empty echo, avoiding an unintentional deletion a such critical file, that is incidentally difficult to restore without a backup.



                                              (The following is because seldom I have to honour the meaning of my nickname, do not execute if you are in doubt).



                                              if [ ! -f ~/.bashrc ] ; 
                                              then
                                              cp -i /etc/skel/.bashrc ~/.bashrc ;
                                              else ls -la ~/.bashrc;
                                              fi || echo " # Auto Generated " >> ~/.bashrc


                                            2. "Do vi .bashrc"

                                              Now you can do vi ~/.bashrc, the trap here is that you need to press : and q to exit !



                                            3. Application folder and $PATH

                                              When you create an application folder, e.g. ~/MyNewCoolProgramFolder, the below line will only check if it is in the $PATH:



                                              echo $PATH | grep ~/MyNewCoolProgramFolder


                                              You do not need to add if is already there. If needed you can add to the $PATH with



                                              PATH=$PATH:~/MyNewCoolProgramFolder


                                              and to add that line to ~/.bashrc if you want to make it permanent.




                                            4. "4?!? How 4 if there were only 3 points?"- Workarounds.

                                              There are some workarounds for the latter; let's suppose an executable file named CoolDetraveller exists only in your new application folder:



                                              (a) You can try to execute it. Simply it will not start if it is not in the $PATH.




                                              CoolDetraveller: command not found




                                              (b) You can try its auto completion. Start to write CoolDetravelle and press Tab. If it is in the $PATH it will be auto completed (always if auto completion is enabled).



                                              (c) You can ask to the bash shell which command will be used if you write the command CoolDetraveller.



                                                  which CoolDetraveller


                                              Note:
                                              If in your application path there is one or more spaces, which could be unable to find CoolDetraveller, although (here I honour my nickname again) the auto completion of CoolDetraveller as a valid parameter of the which command will work!



                                              Ad nauseam: You cannot ask whereis CoolDetraveller because whereis




                                              has a hard-coded path, so may not always find what you're looking for









                                            share|improve this answer


























                                              0












                                              0








                                              0







                                              Short answers:




                                              1. find ~ -maxdepth 1 -name '.bashrc'

                                              2. vi ~/.bashrc

                                              3. echo $PATH | grep ~/MyNewCoolProgramFolder


                                              Detailed one:

                                              I take a more close literal interpretation.





                                              1. "Find file .bashrc in your home directory"

                                                Since it exists the command find, maybe the treacherous editor would suggest you to use it:



                                                find ~ -maxdepth 1 -name '.bashrc'


                                                Search in the home directory ~, descend only of one level (no subdir -maxdepth 1). For all the options write man find.

                                                The line below the will do the minimal job



                                                ls ~/.bashrc   


                                                Note: In case ~/.bashrc doesn't exist you can create it with a simple echo >> ~/.bashrc.



                                                The >> will create the file if doesn't exists. If the ~/.bashrc instead exists it will append only the harmless output of empty echo, avoiding an unintentional deletion a such critical file, that is incidentally difficult to restore without a backup.



                                                (The following is because seldom I have to honour the meaning of my nickname, do not execute if you are in doubt).



                                                if [ ! -f ~/.bashrc ] ; 
                                                then
                                                cp -i /etc/skel/.bashrc ~/.bashrc ;
                                                else ls -la ~/.bashrc;
                                                fi || echo " # Auto Generated " >> ~/.bashrc


                                              2. "Do vi .bashrc"

                                                Now you can do vi ~/.bashrc, the trap here is that you need to press : and q to exit !



                                              3. Application folder and $PATH

                                                When you create an application folder, e.g. ~/MyNewCoolProgramFolder, the below line will only check if it is in the $PATH:



                                                echo $PATH | grep ~/MyNewCoolProgramFolder


                                                You do not need to add if is already there. If needed you can add to the $PATH with



                                                PATH=$PATH:~/MyNewCoolProgramFolder


                                                and to add that line to ~/.bashrc if you want to make it permanent.




                                              4. "4?!? How 4 if there were only 3 points?"- Workarounds.

                                                There are some workarounds for the latter; let's suppose an executable file named CoolDetraveller exists only in your new application folder:



                                                (a) You can try to execute it. Simply it will not start if it is not in the $PATH.




                                                CoolDetraveller: command not found




                                                (b) You can try its auto completion. Start to write CoolDetravelle and press Tab. If it is in the $PATH it will be auto completed (always if auto completion is enabled).



                                                (c) You can ask to the bash shell which command will be used if you write the command CoolDetraveller.



                                                    which CoolDetraveller


                                                Note:
                                                If in your application path there is one or more spaces, which could be unable to find CoolDetraveller, although (here I honour my nickname again) the auto completion of CoolDetraveller as a valid parameter of the which command will work!



                                                Ad nauseam: You cannot ask whereis CoolDetraveller because whereis




                                                has a hard-coded path, so may not always find what you're looking for









                                              share|improve this answer













                                              Short answers:




                                              1. find ~ -maxdepth 1 -name '.bashrc'

                                              2. vi ~/.bashrc

                                              3. echo $PATH | grep ~/MyNewCoolProgramFolder


                                              Detailed one:

                                              I take a more close literal interpretation.





                                              1. "Find file .bashrc in your home directory"

                                                Since it exists the command find, maybe the treacherous editor would suggest you to use it:



                                                find ~ -maxdepth 1 -name '.bashrc'


                                                Search in the home directory ~, descend only of one level (no subdir -maxdepth 1). For all the options write man find.

                                                The line below the will do the minimal job



                                                ls ~/.bashrc   


                                                Note: In case ~/.bashrc doesn't exist you can create it with a simple echo >> ~/.bashrc.



                                                The >> will create the file if doesn't exists. If the ~/.bashrc instead exists it will append only the harmless output of empty echo, avoiding an unintentional deletion a such critical file, that is incidentally difficult to restore without a backup.



                                                (The following is because seldom I have to honour the meaning of my nickname, do not execute if you are in doubt).



                                                if [ ! -f ~/.bashrc ] ; 
                                                then
                                                cp -i /etc/skel/.bashrc ~/.bashrc ;
                                                else ls -la ~/.bashrc;
                                                fi || echo " # Auto Generated " >> ~/.bashrc


                                              2. "Do vi .bashrc"

                                                Now you can do vi ~/.bashrc, the trap here is that you need to press : and q to exit !



                                              3. Application folder and $PATH

                                                When you create an application folder, e.g. ~/MyNewCoolProgramFolder, the below line will only check if it is in the $PATH:



                                                echo $PATH | grep ~/MyNewCoolProgramFolder


                                                You do not need to add if is already there. If needed you can add to the $PATH with



                                                PATH=$PATH:~/MyNewCoolProgramFolder


                                                and to add that line to ~/.bashrc if you want to make it permanent.




                                              4. "4?!? How 4 if there were only 3 points?"- Workarounds.

                                                There are some workarounds for the latter; let's suppose an executable file named CoolDetraveller exists only in your new application folder:



                                                (a) You can try to execute it. Simply it will not start if it is not in the $PATH.




                                                CoolDetraveller: command not found




                                                (b) You can try its auto completion. Start to write CoolDetravelle and press Tab. If it is in the $PATH it will be auto completed (always if auto completion is enabled).



                                                (c) You can ask to the bash shell which command will be used if you write the command CoolDetraveller.



                                                    which CoolDetraveller


                                                Note:
                                                If in your application path there is one or more spaces, which could be unable to find CoolDetraveller, although (here I honour my nickname again) the auto completion of CoolDetraveller as a valid parameter of the which command will work!



                                                Ad nauseam: You cannot ask whereis CoolDetraveller because whereis




                                                has a hard-coded path, so may not always find what you're looking for










                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered Oct 14 '15 at 11:11









                                              HasturHastur

                                              13.2k53268




                                              13.2k53268






























                                                  draft saved

                                                  draft discarded




















































                                                  Thanks for contributing an answer to Super User!


                                                  • 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%2fsuperuser.com%2fquestions%2f584540%2fno-bashrc-file-in-my-home-directory%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

                                                  If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                                                  Alcedinidae

                                                  Can an atomic nucleus contain both particles and antiparticles? [duplicate]