No bashrc file in my home directory
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
migrated from stackoverflow.com Apr 18 '13 at 14:29
This question came from our site for professional and enthusiast programmers.
add a comment |
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
migrated from stackoverflow.com Apr 18 '13 at 14:29
This question came from our site for professional and enthusiast programmers.
add a comment |
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
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
bash bashrc
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.
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
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 ~
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 typelego
in the terminal, and the program should start.
– AcId
Apr 18 '13 at 14:40
I added onlyPATH=$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 thatlego
is the word that starts the software?
– detraveller
Apr 18 '13 at 18:25
add a comment |
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.
add a comment |
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.
add a comment |
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
.
add a comment |
Short answers:
find ~ -maxdepth 1 -name '.bashrc'
vi ~/.bashrc
echo $PATH | grep ~/MyNewCoolProgramFolder
Detailed one:
I take a more close literal interpretation.
"Find file .bashrc in your home directory"
Since it exists the commandfind
, 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 writeman 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 simpleecho >> ~/.bashrc
.
The
>>
will create the file if doesn't exists. If the~/.bashrc
instead exists it will append only the harmless output of emptyecho
, 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
"Do
vi .bashrc
"
Now you can dovi ~/.bashrc
, the trap here is that you need to press : and q to exit !
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?!? How 4 if there were only 3 points?"- Workarounds.
There are some workarounds for the latter; let's suppose an executable file namedCoolDetraveller
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 commandCoolDetraveller
.
which CoolDetraveller
Note:
If in your application path there is one or more spaces,which
could be unable to findCoolDetraveller
, although (here I honour my nickname again) the auto completion ofCoolDetraveller
as a valid parameter of thewhich
command will work!
Ad nauseam: You cannot ask
whereis CoolDetraveller
becausewhereis
has a hard-coded path, so may not always find what you're looking for
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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 ~
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 typelego
in the terminal, and the program should start.
– AcId
Apr 18 '13 at 14:40
I added onlyPATH=$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 thatlego
is the word that starts the software?
– detraveller
Apr 18 '13 at 18:25
add a comment |
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 ~
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 typelego
in the terminal, and the program should start.
– AcId
Apr 18 '13 at 14:40
I added onlyPATH=$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 thatlego
is the word that starts the software?
– detraveller
Apr 18 '13 at 18:25
add a comment |
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 ~
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 ~
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 typelego
in the terminal, and the program should start.
– AcId
Apr 18 '13 at 14:40
I added onlyPATH=$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 thatlego
is the word that starts the software?
– detraveller
Apr 18 '13 at 18:25
add a comment |
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 typelego
in the terminal, and the program should start.
– AcId
Apr 18 '13 at 14:40
I added onlyPATH=$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 thatlego
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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
edited Jun 22 '15 at 10:39
7ochem
157111
157111
answered Apr 18 '13 at 13:07
AcIdAcId
60449
60449
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Apr 18 '13 at 13:18
CodeGnomeCodeGnome
1,766821
1,766821
add a comment |
add a comment |
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
.
add a comment |
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
.
add a comment |
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
.
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
.
answered Apr 18 '13 at 13:07
user53528
add a comment |
add a comment |
Short answers:
find ~ -maxdepth 1 -name '.bashrc'
vi ~/.bashrc
echo $PATH | grep ~/MyNewCoolProgramFolder
Detailed one:
I take a more close literal interpretation.
"Find file .bashrc in your home directory"
Since it exists the commandfind
, 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 writeman 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 simpleecho >> ~/.bashrc
.
The
>>
will create the file if doesn't exists. If the~/.bashrc
instead exists it will append only the harmless output of emptyecho
, 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
"Do
vi .bashrc
"
Now you can dovi ~/.bashrc
, the trap here is that you need to press : and q to exit !
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?!? How 4 if there were only 3 points?"- Workarounds.
There are some workarounds for the latter; let's suppose an executable file namedCoolDetraveller
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 commandCoolDetraveller
.
which CoolDetraveller
Note:
If in your application path there is one or more spaces,which
could be unable to findCoolDetraveller
, although (here I honour my nickname again) the auto completion ofCoolDetraveller
as a valid parameter of thewhich
command will work!
Ad nauseam: You cannot ask
whereis CoolDetraveller
becausewhereis
has a hard-coded path, so may not always find what you're looking for
add a comment |
Short answers:
find ~ -maxdepth 1 -name '.bashrc'
vi ~/.bashrc
echo $PATH | grep ~/MyNewCoolProgramFolder
Detailed one:
I take a more close literal interpretation.
"Find file .bashrc in your home directory"
Since it exists the commandfind
, 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 writeman 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 simpleecho >> ~/.bashrc
.
The
>>
will create the file if doesn't exists. If the~/.bashrc
instead exists it will append only the harmless output of emptyecho
, 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
"Do
vi .bashrc
"
Now you can dovi ~/.bashrc
, the trap here is that you need to press : and q to exit !
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?!? How 4 if there were only 3 points?"- Workarounds.
There are some workarounds for the latter; let's suppose an executable file namedCoolDetraveller
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 commandCoolDetraveller
.
which CoolDetraveller
Note:
If in your application path there is one or more spaces,which
could be unable to findCoolDetraveller
, although (here I honour my nickname again) the auto completion ofCoolDetraveller
as a valid parameter of thewhich
command will work!
Ad nauseam: You cannot ask
whereis CoolDetraveller
becausewhereis
has a hard-coded path, so may not always find what you're looking for
add a comment |
Short answers:
find ~ -maxdepth 1 -name '.bashrc'
vi ~/.bashrc
echo $PATH | grep ~/MyNewCoolProgramFolder
Detailed one:
I take a more close literal interpretation.
"Find file .bashrc in your home directory"
Since it exists the commandfind
, 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 writeman 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 simpleecho >> ~/.bashrc
.
The
>>
will create the file if doesn't exists. If the~/.bashrc
instead exists it will append only the harmless output of emptyecho
, 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
"Do
vi .bashrc
"
Now you can dovi ~/.bashrc
, the trap here is that you need to press : and q to exit !
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?!? How 4 if there were only 3 points?"- Workarounds.
There are some workarounds for the latter; let's suppose an executable file namedCoolDetraveller
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 commandCoolDetraveller
.
which CoolDetraveller
Note:
If in your application path there is one or more spaces,which
could be unable to findCoolDetraveller
, although (here I honour my nickname again) the auto completion ofCoolDetraveller
as a valid parameter of thewhich
command will work!
Ad nauseam: You cannot ask
whereis CoolDetraveller
becausewhereis
has a hard-coded path, so may not always find what you're looking for
Short answers:
find ~ -maxdepth 1 -name '.bashrc'
vi ~/.bashrc
echo $PATH | grep ~/MyNewCoolProgramFolder
Detailed one:
I take a more close literal interpretation.
"Find file .bashrc in your home directory"
Since it exists the commandfind
, 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 writeman 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 simpleecho >> ~/.bashrc
.
The
>>
will create the file if doesn't exists. If the~/.bashrc
instead exists it will append only the harmless output of emptyecho
, 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
"Do
vi .bashrc
"
Now you can dovi ~/.bashrc
, the trap here is that you need to press : and q to exit !
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?!? How 4 if there were only 3 points?"- Workarounds.
There are some workarounds for the latter; let's suppose an executable file namedCoolDetraveller
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 commandCoolDetraveller
.
which CoolDetraveller
Note:
If in your application path there is one or more spaces,which
could be unable to findCoolDetraveller
, although (here I honour my nickname again) the auto completion ofCoolDetraveller
as a valid parameter of thewhich
command will work!
Ad nauseam: You cannot ask
whereis CoolDetraveller
becausewhereis
has a hard-coded path, so may not always find what you're looking for
answered Oct 14 '15 at 11:11
HasturHastur
13.2k53268
13.2k53268
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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