When I was not near my computer some guy got it and set an Alias for ls in my root folder. He set it to 'yes NeverGonnaGiveYouUp'. So now when im in my root folder and type ls I get an infinite loop of NeverGonnaGiveYouUp. It's driving me nuts and I don't know how to get rid of it.

I've already tried unalias and unalias -a but those just remove it temporarily. Once I close the shell and reopen it it comes back. How do I get rid of this crap?

  • 2
    Whats the output of grep -n 'NeverGonnaGiveYouUp' ~/.profile ~/.bashrc /etc/bash.bashrc /etc/profile ? There are some other files to look at too depending on your shell and distro..but this should give us a start..
    – heemayl
    Feb 8, 2016 at 4:49
  • 5
    That sounds like that rick roll kernel module LOL
    – moonbutt74
    Feb 8, 2016 at 5:11

3 Answers 3


If unalias removes the issue (even temporarily) we have confirmation it is an alias. It could be "brute forced" out by adding an unalias ls in ~/.bashrc.

echo "unalias ls" >> ~/.bashrc

That will get excuted every time bashrc is read and will remove the alias.
That will buy you some peace but will not resolve the actual issue that some file is still containing code to re-start the alias. You need to find which file contains the problem.

If using bash:

grep "NeverGonnaGiveYouUp" /etc/profile /etc/bash.bashrc \
      ~/.bashrc ~/.bash_profile ~/.profile \
      /root/.bashrc /root/.bash_profile /root/.profile

That's a good list of possible files that got the definition. If nothing shows up in that search, or you use some other shell, let us know to further help.


unalias command turned off alias for the duration of the current login session. the alias is not removed by unalias command from the .bashrc file, when the user logs in again, that alias is again in effect.

.bashrc is a hidden file, You can check the list of alias by typing:

$ alias

Check shell configuration file ~/.bashrc and you can remove required alias permanently:

 vi ~/.bashrc

To find Alias:

  $ type --all ls

Remove an alias:

unalias gs

More at Manual

Note: unalias -a will remove all alias definitions from the current shell execution environment.


For Ubuntu 16.04 LTS you can use following command

cat /dev/null > ~/.bash_aliases
  • That will remove anything defined in ~/.bash_aliases, not just the ls alias (which might not even be defined there anyway). Apr 23, 2018 at 8:44

You must log in to answer this question.

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