.profile missing in Unix (bash shell)

  • Thread starter Arnoldjavs3
  • Start date
  • Tags
    Shell Unix
In summary: They wrote the book in 1984, and the language has been around since the 1970s. I actually found it in /etc/skell/.
  • #1
Arnoldjavs3
191
3

Homework Statement


I'm playing around in UNIX and I wanted to modify my .profile file in my home directory, but It's not there. I know you type in ls -a to view the hidden files but it's simply not there. Do I just create one? I want it to just display my name every time i log in.

Homework Equations

The Attempt at a Solution


I'm new with bash, i don't know much of its scripting but I think all I have to do is write an echo statement at the end of it - after creating the file in vim or something?

#!/bin/bash

echo "blablabla"

I've tried this and it doesn't work.
 
Physics news on Phys.org
  • #2
In bash, you should have files called ~/.bashrc and ~/.bash_profile. Depending on what you want to do, you need to edit one of these.
 
  • #3
There are lots of unix sites that will tutor you through this. Shells can get fairly involved if you want a nice working environment. Although the web is fine for answers for this sort of stuff, when I got into Linux some years back, I bought a few O'Reilly books to help me; they have a https://www.amazon.com/dp/0596009658/?tag=pfamazon01-20 that was very helpful.
 
Last edited by a moderator:
  • #4
I actually found it in /etc/skell/. It sucks because I have several books and they all point to different things; It's not a very uniform platform for me :(.

I simply added in echo$(user) and it worked.

if you have a book similar to C by brian and ritchie I'm all ears - I have unix shell programming(3rd edition) and one oreilly book as a ebook.
 
  • #5
Arnoldjavs3 said:
I actually found it in /etc/skell/.

Never hear of that before!

Are you literally using unix, or a linux distro? If the latter, you can go to its forums & people there should be able to tell you how exactly things differ from the more standard setups..
 
  • #6
UNIX and bash shell. Someone had guided me there from unix.stackexchange.

Although I'm feeling a lot more confident now, found a couple online tutorials that are great
 
  • #7
Arnoldjavs3 said:
book similar to C by brian and ritchie I'm all ears
Often referred to as "K & R," (but not B & R) for Brian Kernighan and Dennis Ritchie.
 

1. What is the ".profile" file in Unix?

The .profile file in Unix is a hidden configuration file that is used to set environment variables and define user-specific settings for the Unix operating system.

2. Why is the ".profile" file missing in my bash shell?

There are several reasons why the .profile file may be missing in your bash shell. It could have been accidentally deleted, renamed, or moved to a different location. Sometimes, it may also not be created by default for new user accounts.

3. How can I check if the ".profile" file exists in my bash shell?

You can use the command "ls -a" to view all the files, including hidden ones, in your current directory. If the .profile file exists, it will be listed in the output.

4. What happens if the ".profile" file is missing in my bash shell?

If the .profile file is missing, your bash shell will use the system-wide default settings. This means that any environment variables or user-specific settings defined in the .profile file will not be applied.

5. How can I create a ".profile" file in my bash shell?

If the .profile file is missing, you can create a new one by using a text editor such as vi or nano. Make sure to save the file in your home directory with the name ".profile". You can then add any necessary environment variables or settings to the file.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
  • Programming and Computer Science
Replies
10
Views
1K
Replies
16
Views
2K
  • Programming and Computer Science
Replies
11
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
14
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
15
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Programming and Computer Science
Replies
19
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
Back
Top