When I start my terminal the current working directory is always "/". I want it to start from "/home/<username>" i.e. my home.

Any solution for this?

  • i'm thinking this has something to do with the environment your window manager is setting up for you. i'm having the same problem now and haven't yet figured out the root cause. Jan 4, 2011 at 15:27
  • I think the terminal program usually asks the parent process what directory is the current working directory. I have this problem with xterms launched by keyboard shortcut from the window manager. It doesn't happen with gnome-terminal and it doesn't happen if I start in xterm from the command line. But I haven't figured out a solution to this... Jan 4, 2011 at 15:45
  • @SIDD: This sounds more like a bug report (it should be your home directory, unless it has been intentionally changed. Please file a bug on Launchpad. How are you starting the Terminal when you see the issue? What version of Ubuntu. Is it a key-sequence (eg. Ctrl-Alt-t)? Is it a menu? Is it something else? BTW, just typing cd on its own without any arguments should take you to your home directory—if that's not working, it could be indicative of the problem. Please include this in the bug report and link the bug number back here to help other people that are following along.
    – sladen
    Feb 5, 2012 at 19:10

4 Answers 4


When you open up a new terminal, the current working directory should be your home folder.

nevon@loltop:~$ echo ${PWD}

That said, if this is not the case for you, I suppose you could append the following to the end of your .bashrc file:

cd /home/username
  • 4
    It may worth to note that ~ is the abbreviation for your home dir. Aug 6, 2010 at 16:43
  • 1
    I verified that terminal was opening into root directory - "pwd" command. But after appending "cd"(changes directory to home) to .bashrc, as indicated by Tommy did the job. Thanks.
    – SIDD
    Aug 6, 2010 at 16:50
  • Adding cd to your .bashrc is a terrible idea. If you run a script that tries to find something in the current working directory and you don't run it from where you're cd'ing to then it will fail. This means a lot of common unix use cases will fail bizarrely. May 24 at 20:24

If the initial working directory for a terminal is not your home directory you are likely to have a serious configuration problem. Check the following:

grep $USER /etc/passwd # Should show /home/youruser before the shell location

Check your home dir permissions/owner:

ls -ltrd $HOME # You must be the owner

Make sure you are not doing a 'cd' on your shell startup scripts:

~/.profile ~/.bashrc
  • 7
    João is right: you shouldn't work around an obvious misconfiguration, but try to find the source of the problem.
    – loevborg
    Aug 6, 2010 at 17:18
  • I executed above commands. Here are the results: "sidd:x:1000:1000:Sagar,,,:/home/sidd:/bin/bash" "drwxr-xr-x 55 sidd sidd 4096 2010-08-17 13:51 /home/sidd" Any conclusion?
    – SIDD
    Aug 17, 2010 at 8:23

I would also check the configuration of the user account. Probably the home directory configuration of the user is set to "/" and not "/home/<username>".

  • It is /home/<username>. I verified using "cd" command which always sets current working directory as home of that user.
    – SIDD
    Aug 6, 2010 at 17:13
  • Then there is something else odd there. If the home directory is set correctly for the user, you should not need to manually set your home directory in the .bashrc file to automatically start in your home directory.
    – txwikinger
    Aug 6, 2010 at 17:32

I added --working-directory=~/ to the command executed by my keyboard shortcut in order to fix this.

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.