I'm trying to change my directory to /boot/efi, but running sudo cd /boot/efi does nothing. I'm on fedora 23. Is there a more powerful command for this?


cd is a shell builtin, and sudo only works with programs.

Try using either su - or sudo -i before changing directory. These will elevate your login session to that of the root user. Once finished making changes, make sure to type exit to return to being a normal user.

  • That works, thanks, but there's a file in there, grub.cfg, and i'm trying to copy it to my home folder, which works after doing sudo -i and using the cp command, however i don't have permission to open that file (it does work with sudo vim, but how do i change permissions on that file?) Jul 4 '16 at 20:31
  • sudo chown username filename should work.
    – clk
    Jul 4 '16 at 20:34
  • Can i also keep root as the owner but add me as readwrite permissions? Jul 4 '16 at 20:37
  • sudo chmod 666 filename then to allow rw- permissions to everyone.
    – clk
    Jul 4 '16 at 20:39
  • Cool, that works! I also looked it up and you can also do: sudo chown :frederik grub.cfg to change the group And sudo chmod g+r grub.cfg to give that group read permission Thanks a lot! sudo chmod 640 grub.cfg also works for changing the permissions (in this case rw for root and r for group, none for others. Jul 4 '16 at 20:50

You can do this to cd as super user:

sudo -s
cd directory
  • Please note that this does not maintain the environment.
    – FelixJN
    Jan 28 '21 at 11:05

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.