There is a line in ~/.profile which is


I'm not sure about the last i.

  • Should I remove it??
  • Isn't it a syntax error??
  • 3
    Possible duplicate of Adding custom path by updating ~/.profile with not working
    – dessert
    Dec 7 '17 at 9:33
  • 4
    @dessert I'm not sure that's a duplicate. I agree both are about the $PATH environment variable, but they are not duplicates at all. At most, they are related. This question is an issue in ~/.profile which just happens to be an extra character in the line where the $PATH environment is assigned.
    – Dan
    Dec 7 '17 at 10:07
  • @Dan The highest voted(!) answer in the duplicate question explains how a PATH= line in ~/.profile should look like to be valid – which is the real question here.
    – dessert
    Dec 7 '17 at 10:08
  • 1
    @dessert what the OP has here is perfectly valid, it isn't a problem of an invalid format. This works, it just doesn't do anything useful.
    – terdon
    Dec 7 '17 at 10:37
  • 2
    Yes I use vi editor. Possibly I accidently put the 'i' in the file like dessert said. But then I had to :wq to make it effective. I think I didn't do it, but considering my level I might have done some stupid thing.
    – Smile
    Dec 7 '17 at 10:53

No, it's not a syntax error; it's just a letter which is appended after the expansion of $PATH, because the shell removes quotes...

$ PATH="$HOME/bin:$HOME/.local/bin:$PATH"i
$ echo $PATH

So, as well as prepending local directories, it has effectively removed the existing /snap/bin from my PATH, and added the non-existent /snap/bini.

You can remove the i to repair your PATH.

To see the change, you will need to log out and back in or run source ~/.profile in any shell you are using (or launch the shell with bash -l), because .profile is read by login shells only.

If you did not make this change to your .profile yourself, you may want to restore the default file by running

mv ~/.profile{,.old}
cp /etc/skel/.profile ~/.profile

This renames the old .profile .profile.old (you could also delete the file if you wanted to) and replaces it with the default version for your system from /etc/skel.


I think here is unclear what the following expression means:


The first part PATH= means we assign a new value to the (environment) variable $PATH.

The second part is the new value of that variable. In the current case the variable $HOME will be expanded with its current value and to that value will be appended the string /bin:. The same goes for the next part of the string $HOME/.local/bin:. Finally the current (previous) value of the $PATH variable will be expanded and appended. The colon : plays a role of delimiter in the PATH expression.

The goal is ultimately to write: PATH=<some additional paths>+<the the current value of $PATH>. We put these additional paths in front of the string, because we want the shell to search for executables first in these locations and only then system wide.

The character i is unnecessary. It will be appended to the new value of $PATH and will make a mess, as @Zanna explains in her answer.


Yes it is a syntax error, the actual .profile should look like this unless you changed things around (this is the 17.10 version, see notes below it):

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then

This might look different in older versions of Ubuntu where the check if the users bin directory is present was not included into the .profile. Eaisiest way to check how it should look like is taking a look at /etc/skel/.profile.

So to add as you asked in your comment simply place this at the end of your profile file:

# Manual addition for swift development snapshot
export PATH="$PATH:/home/jeremy/swift-4.0-DEVELOPMENT-SNAPSHOT-2017-06-29-a-ubuntu16.04/usr/bin"

If you ever mess up your profile completely, there is a copy where you can get a new one from in /etc/skel/.

  • 1
    I have one extra line "export PATH=$PATH:/home/jeremy/swift-4.0-DEVELOPMENT-SNAPSHOT-2017-06-29-a-ubuntu16.04/usr/bin" cause I installed it. Is it fine??
    – Smile
    Dec 7 '17 at 9:34
  • 3
    This line is fine i included it into my example to show where to place it.
    – Videonauth
    Dec 7 '17 at 9:36
  • 1
    Please note that /etc/skel/.profile in 16.04 looks different, without a test whether "$HOME/bin" exists. Even if that was a better variant (IMO), it seems to have been changed back in 17.10 - for a reason or by mistake. Dec 7 '17 at 11:41
  • @GunnarHjalmarsson will note that in my post,and yes this is the skel/.profile from 17.10 I'm running at.
    – Videonauth
    Dec 7 '17 at 11:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.