1

I made an alias earlier today that I saved in my .bash_profile. The alias was called date. I had momentarily forgotten that date is already a native command on OS X (and Linux) in /bin. I removed the alias that I had saved, but now, to use the date command, I have to type /bin/date instead of just date. How can I fix this?

5
  • In Terminal, type echo $PATH and post the results. I am betting /bin is not in your path system environment variable
    – Allan
    Jun 1, 2016 at 2:23
  • @Allan here is the result: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Developer/Panda3D/bin:/Library/TeX/texbin
    – K. Shores
    Jun 1, 2016 at 2:25
  • 1
    It seems /bin is in there. Execute these two commands: which date and alias Either there is a problem with date or you have a blank alias set up for date
    – Allan
    Jun 1, 2016 at 2:33
  • Got it. date was still set to the alias I had set before. I ran unalias date and it works now. Than you!
    – K. Shores
    Jun 1, 2016 at 2:36
  • 3
    Go ahead and answer your own question with the result. I'll up vote ya...
    – Allan
    Jun 1, 2016 at 2:38

1 Answer 1

1

Firstly, check your $PATH (run echo $PATH)
If /bin isn't there, then run export PATH=/bin:$PATH

After that run which date and you should see /bin/date

If you still don't have any output, check if date isn't alias (run alias date)
It should say bash: alias: date: not found.

But in your case it may be alias date='some-command'
If it is, run unalias date and it should fix the problem.

Thanks Allan for the comments with answer.

You must log in to answer this question.

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