0

How do I enter the /root folder, not the / folder? I need to go into the /root folder to print the contents of the /root folder on a file in the home(~) folder. I tried to do 'sudo cd root'

Here's the response:

sudo: cd: command not found
sudo: "cd" is a shell built-in command, it cannot be run directly.
sudo: the -s option may be used to run a privileged shell.
sudo: the -D option may be used to run a command in a specific directory.

I also tried to do sudo ls root but it didn't work.

[sudo] password for piyush: 
snap

I tried attaching a screenshot but the website didn't allow me to post images. I am a beginner so please don't go too heavy with the answer.

Ajay
  • 2,241

2 Answers2

0

Try:

   exec sudo -i
   ls -a /root > /home/piyush/filesroot.txt
   chmod -R 777 /home/piyush/filesroot.txt
   exit
kyodake
  • 17,808
-1
  1. sudo su
  2. Enter the password.
  3. cd ~/

You need to have the appropriate permissions and password. If you don't, contact your system administrator and have them do what you need.

Tom
  • 21