How Can I Stay in a Directory When Using Sudo in Linux?

0
6
Asked By TechieNinja42 On

Hey everyone, I'm pretty new to Linux and I've been running into a bit of a hassle. I often need to run applications as an admin using sudo, but whenever I use 'sudo -i', it takes me out of my current directory. This means I have to manually type in the directory path to get back each time, and that's starting to feel very tedious. Is there an easier way to run sudo commands without losing my current directory? Or is there a workaround that can help make this less annoying? I'd appreciate any tips!

2 Answers

Answered By HelpfulHacker88 On

Actually, not everything in Linux requires admin permissions. You might find that many tasks can be done without sudo. It might help to look into those to make your workflow smoother and avoid using sudo as often as possible.

Answered By LinuxLover99 On

You can try using `sudo su`. It switches you to the root user while keeping your current directory, so you won’t have to type the path again each time you need sudo access. It’s pretty straightforward!

TechieNinja42 -

Thank you! Glad it was something so simple!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.