FAQ: Environment - Bash Profile

This community-built FAQ covers the “Bash Profile” exercise from the lesson “Environment”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn the Command Line

FAQs on the exercise Bash Profile

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I can’t seem to move forward from the alias pd=“pwd” can someone assist me with this command?

3 Likes

I had trouble also, but I was putting spaces on either side of the = sign. Once I took those out it worked.

2 Likes

Thank you, that solved my problem.
[no offers of a solution and no way to move on!!]

I am going in a loop around writing the alias pd for pwd. I am, I think following directions and the given solution perfectly, including above mentioned spacing but still get stuck here. resetting work are doesn’t seem to help.
Any suggestions??? stubbornness in multiple attempts is not helping:sweat_smile:

When I reset the lesson, the cursor is above the greeting. How do I move it to below the greeting? Trying to work above definitely does not work.

Thanks:

Cursor…? If you’re talking about the text editor Nano, then I imagine arrow keys let you move the cursor (a bit crude perhaps, but for a small edit it hardly matters)

No clue what is wrong for you, but I suggest running the alias command directly in the shell before you put it in the file, until you’ve got the right command.

For example:

$ alias 'derp=echo hello world'
$ derp
hello world

clearly that worked, now I can add the command to my profile file, and then I can reload bash (both to clear the alias that was just created, and to run the profile file again)

Thank you. I did figure out the arrows would move the cursor
I will try testing aliases before I exit

I was sent to take the command line course about 25% way thru Python course.The teaching environment is very different Rather than giving helpful hints like you did above, it just ticks off the lesson boxes so I can go to the next section , so I never see how the code should be written properly, so thank you, i needed the visual to see proper code as a learning tool

Do any experienced developers have any thoughts on creating aliases for commands?

I can see the use in creating aliases for commands in order to make them more memorable for you, however, I think this could be counterproductive particularly for new developers. If you get used to your own aliases, you’re liable to forget the actual standard commands that are used by everyone else. So just wondering where most developers stand on that use of aliases.

alias pd=“pwd”
I type the above and followed the instructions but nothing happens. I cannot move forward

1 Like

Hey, I’m having the same issue atm, let me know if you have any solution, I will do the same :slight_smile:

Okay found my mistake, so I typed the source ~/.bash_profile line inside the dir. Make sure there are only the echo “Hello World” and the pd=“pwd” in the bash_profile, save it with ctr+o and exit with ctr +x and type source ~/.bash_profile in the command line and clear it and the box will tick! :slight_smile:

This lesson talks about ‘Environment Settings’. What is it? Why is it saved inside the Bash file?

whoever created this part made a disorganized mess out of it

1 Like

I have done something like this and I can’t get out of it! Is there a way to reset the exercise?

Help please, what am I doing wrong that this is not showing the right thing in the command line? I’m stuck and can’t move on until I resolve it. Thanks

I am currently going through the same thing and it is so annoying because there’s no way of restarting it. If you mess up a previous step, you’re doomed

There isn’t a method to reset the exercise since you are using a terminal and not a code editor. It isn’t clear from the screenshots the problem you are having. Please explain the issue and post all relevant screenshots from the exercise.

Ahh I was definitely having some issue before because it was saying that the bash_profile couldn’t be found. I started from the beginning (as I was only on the 3rd exercise) and now I can see that it is working fine, so it is in the screenshot above. I just didn’t realise what pwd was trying to do :woman_facepalming: Thank you for taking a look anyway!

2 Likes