JCNuke
Posts: 8
Joined: Sat Dec 30, 2017 5:59 am

How to create ~/.profile

Sun Dec 31, 2017 5:57 pm

The project I am working on provided information that I should update my ~/.profile. The challenge was, I didn't have a ~/.profile
The project instructions indicated , that if I didn't have ~/.profile, that I should create one. I do not know how to do that? Any help?

ProjectYell0wJack3t
Posts: 8
Joined: Fri Dec 29, 2017 1:41 am
Location: Canada

Re: How to create ~/.profile

Mon Jan 01, 2018 12:02 am

Lets begin by setting our Directory to Home with:

cd ~

Now type:

sudo nano .bash_profile

(If you know how to use 'vi' you can use that instead of 'nano')
This will open up a text editor where you can put your Aliases.
When you're done use CTRL + O Enter, and CTRL + X to save and quit.
Finally use:

source ~/.bash_profile

to reload the Terminal and it will read what you put in those files. :)

.bash_profile , will only run on login shells. For non-login shells you have to create a .bashrc file, like so:

sudo nano .bashrc

k-pi
Posts: 930
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: How to create ~/.profile

Mon Jan 01, 2018 3:30 pm

Also,

Code: Select all

touch filename
will create an empty file named 'filename' in the directory you are in. :)

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to create ~/.profile

Mon Jan 01, 2018 3:39 pm

JCNuke wrote:
Sun Dec 31, 2017 5:57 pm
The project I am working on provided information that I should update my ~/.profile. The challenge was, I didn't have a ~/.profile
The project instructions indicated , that if I didn't have ~/.profile, that I should create one. I do not know how to do that? Any help?
Copy in the sample file from /etc/skel/.profile
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
Paeryn
Posts: 2966
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: How to create ~/.profile

Mon Jan 01, 2018 7:20 pm

ProjectYell0wJack3t wrote:
Mon Jan 01, 2018 12:02 am
Lets begin by setting our Directory to Home with:

cd ~

Now type:

sudo nano .bash_profile
Do not use sudo, by doing so the created file will be owned by root rather than the user, there is absolutely no sane reason to do that.
She who travels light — forgot something.

Return to “Troubleshooting”