cd command is built into the default GNU Bourne-Again SHell (bash) shell and will not work with
sudo since the current directory is a attribute of a process. Any operations performed by
sudo and its descendants will not affect the parent process.
The workaround is to call the
cd command within an independent shell:
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.