No bashrc file in my home directory
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 ~
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.
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.