I am learning linux CLI, I created a file app.txt in home directory. Now I am copying it through CLI to Documents and it is showing me an error:
cp: cannot create regular file '/home/Documents': Permission denied P.S (I have checked whoami and it is showing zain which is my root)
Can anyone confirm what is wrong with it ?
22 Answers
I will assume you attempted to copy app.txt while in your home directory.
Since your root directory is zain, specifying /home/Documents as the destination path will result in an error as the CLI will go back to zain directory (due to /) and then look for the home directory, which is absent under it.
Instead, you just need to specify Documents as the destination path as follows. Again, I am assuming you are still in your home directory.
cp app.txt Documents give 777 (readable, writable and executable) permissions to file or directory
sudo chmod -R 777 /folder-location