0

I am trying to copy a bashrc file from one folder to another.

For example, the bashrc file is in Data/user/user1 and I am trying to copy it to Data/user/user2 with the following cp command:

cp Data/user/user1/.bashrc Data/user/user2

but it says that the file is not found.

I have also tried omitting the dot before bashrc and got the same error.

The file is there for sure, I have executed ls -la ~/ | more and saw it so I am probably referencing it wrong.

Could you point out what I am doing wrong?

4
  • 1
    Are you sure that the path is correct? It is strange that the path begins with "Data" without a "/" at the beginning. To check the path, you can use this trick: navigate the folder with your file manager (i.e. nautilus), press Ctrl + L and use that path in your command. Aug 21, 2020 at 7:25
  • 1
    What OS/release are you using? Your command looks incorrect to me, as you've used relative paths to both, so was your $PWD (present working directory) correct for that command to work? as I suspect not. Alternatively I'd use a command that doesn't use relative paths (ie. provide full path names).
    – guiverc
    Aug 21, 2020 at 7:26
  • now that you put the / at the beginning, is the issue still present? Aug 21, 2020 at 7:38
  • @LorenzKeel No, that fixed my issue. Aug 21, 2020 at 7:42

1 Answer 1

1

As guiverc noticed simultaneously with me, the path you are using is inconsistent: or a / is missing at the beginning of the paths, or you are using a relative path that does not exist in your current working directory.

According to your feedback, the solution consists in putting a / at the beginning of the paths.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .