Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I messed up a .profile and now I can't even get nano to work.

I was trying to add git to my environment variable whenever I start terminal, and I messed the command up obviously and no nothing works.

Not even the ls command works.

Where is nano so I can edit the file?

What should a standard .profile look like?

share|improve this question
Next time you should back up sensitive files before you edit them ;) I don't have a complete enough answer to throw in the answer section, but I would recommend creating a new user account and using that user's .profile as a "standard" .profile to see what you may have done wrong in your edits or at least restore what you had before. – Emory Bell Jun 5 '10 at 3:02
up vote 2 down vote accepted

You should still be able to use the full path to run commands. For example:



I'm not sure where ls is on a mac... it might be under /usr/bin/ls

I'm using Ubuntu 10.04. My .profile file in my home directory looks like this:

# ~/.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

Worth a shot i guess.

share|improve this answer
thanks a bundle! – user27449 Jun 5 '10 at 3:38
Glad it worked out (-: – James T Jun 5 '10 at 3:48

Where is this .profile you messed up? I have a .bash_profile, but no .profile file.

share|improve this answer
i created the following these directsion, but I put a ';' instead of a ':' in the line near the '$PATH' part. – user27449 Jun 5 '10 at 3:01
its in my 'home' folder, i.e.: cd ~ – user27449 Jun 5 '10 at 3:01

Does the GUI still function (Finder, Desktop, Dock, etc.)? If so, Open the .profile file in TextEdit and replace the ; with a : (you might have to turn on hidden files or type the name manually into the open file dialog)

If your GUI is no longer functioning, reboot the computer and hold Command+S as it reboots. This should dump you at a command line with root access. Use nano to fix your .profile file.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .