4. Alias I 2. alias hy issue

I have been struggling with this exercise for some time now, but am still unable to progress to part 3.

Thanks in advance…

Give us a couple screenshots of your whole web browser so that we can see what you see.

The Course started with…

Each time we launch the terminal application, it creates a =new= session.
The session immediately loads settings and preferences
that make up the command line environment.

We can configure the environment to support the commands and programs we create.
This enables us to
customize greetings
customize command aliases,
create variables
to share across commands and programs.

You can reference the filesystem for this lesson here.

You created a file in nano called ~/.bash_profile in your /home directory
( the =home directory= can be identified by using ~ )
and added a greeting. How does this work?
$ nano ~/.bash_profile

~/.bash_profile is the name of file used to store environment settings.
It is commonly called the “bash profile”.

When a session starts,
it will load the contents of the bash profile before executing commands.
:black_medium_square:The ~ represents the user’s home directory.
:black_medium_square:The . indicates a hidden file.
:black_medium_square:The name ~/.bash_profile is important,
since this is how the command line recognizes the bash profile.

  • 1.The command nano ~/.bash_profile opens up ~/.bash_profile in nano.
  • 2.The text echo "Welcome, Jane Doe" creates a greeting in the bash profile, which is saved. It tells the command line to echo the string “Welcome, Jane Doe” when a terminal session begins.
  • 3.The command source ~/.bash_profile
    activates the changes in ~/.bash_profile for the current session.
    Instead of closing the terminal and needing to start a new session,
    source makes the changes available right away in the session we are in.


  • 1.Now that we know what bash profile is, let’s continue configuring the environment by adding command aliases.
    Open ~/.bash_profile in nano.

  • 2… In ~/.bash_profile, beneath the greeting you created, type
    alias pd="pwd"

What happens when you store this alias in ~/.bash_profile?
alias pd=“pwd”

The alias command allows you to create keyboard shortcuts, or aliases, for commonly used commands.
1.Here alias pd="pwd" creates the alias pd for the pwd command,
which is then saved in the bash profile.
Each time you enter pd, the output will be the same as the pwd command.
2.The command source ~/.bash_profile
makes the alias pd available in the current session.

Each time we open up the terminal, we can use the pd alias.

  • 1… Let’s practice aliases some more. Open ~/.bash_profile in nano.

  • 2… In the bash profile, beneath the previous alias, add
    alias hy="history"

Save the file. Press Enter to write the filename.

  • 3… Add another alias
    alias ll="ls -la"

Save the file. Press Enter to write the filename. Exit nano
Clear the terminal window.

  • 4…In the command line, use source to activate the changes to the bash profile for the current session.

  • 5…Let’s try out the aliases. In the command line, type

  • 6…Now type

What happens when you store the following aliases in ~/.bash_profile?
alias hy="history"
hy is set as alias for the history command in the bash profile.
The alias is then made available in the current session through source.
_source ~/.bash_profile
By typing hy,
the command line outputs a history of commands that were entered in the current session.

alias ll="ls -la"
ll is set as an alias for the command ls -la
and made available in the current session through source ~/.bash_profile.
By typing ll, the command line now outputs
all contents and directories in long format, including all hidden files.


Now that you are familiar with configuring greetings and aliases, let’s move on to setting environment variables.
Open ~/.bash_profile in nano.

In the bash profile, beneath the aliases, on a new line, type
export USER="Jane Doe"
Feel free to use your own name.
Save the file.
Press Enter to write the filename.
Exit nano.
Finally, clear the terminal.

1 Like

Thanks guys, I changed my browser and that seemed to do the trick. I am stuck at 84 percent…

Hi ive did this im still stuck on 2 :expressionless: do i save the file. as the name or leave it as .bash profile? i have them both added and saved them and the x keeps popping up im stuck :confused: