0

I was trying to copy and paste the file named libstdc++.so.6.0.2 from

/home/a11111/anaconda3/lib/libstdc++.so.6.0.21 on linux

using the command

cp ~/anaconda3/lib/libstdc++.so.6.0.21 /lib64/

However, the terminal keep returning me the error message

'cp: cannot stat '/home/a11111/anaconda3/lib/libstdc++.so.6.0.21': No such file or directory' 

I thought the terminal might not able to find the file because the file name has special characters, therefore I tried

cp ~/anaconda3/lib/libstdc\+\+\.so\.6\.0\.21 /lib64/

But I got the same error message. How do I copy the file from the terminal?

Thank you.

Xuan Ren
  • 11
  • 1
  • 5
  • Instead of escaping you can just use quotes around the name. Obviously, you know that this file exists in the filesystem, correct? What is the output of `ls "~/anaconda3/lib/libstdc*"`? – qmeeus May 12 '21 at 10:08
  • the output includes the filename that I am looking for "/home/a11111/anaconda3/lib/libstdc++.so.6.0.21", so why can't i copy it? – Xuan Ren May 12 '21 at 10:24
  • I also tried 'cp ~/anaconda3/lib/libstdc* /lib64/', the terminal tell me that 'cp: cannot stat '/home/a1796450/anaconda3/lib/libstdc++.so.6.0.21': No such file or directory ' and 'cp: cannot create regular file '/lib64/libstdc++.so.6.0.22': Permission denied' – Xuan Ren May 12 '21 at 10:28
  • see instead https://stackoverflow.com/q/830542/1216776 – stark May 12 '21 at 11:51

1 Answers1

0

Just add double quotes around the filename:

cp "~/anaconda3/lib/libstdc++.so.6.0.21" /lib64/

NB: You probably will need sudo in front of it because /lib64 is owned by root

qmeeus
  • 2,341
  • 2
  • 12
  • 21
  • what can I do if I do not have permission to perform sudo operation? I am using ssh(Secure Shell Protocol). – Xuan Ren May 12 '21 at 10:48
  • Then you cannot copy the file to `/lib64` – qmeeus May 12 '21 at 11:34
  • You probably need libstdc++.so.6.0.21 to run some program. The new `libstdc++.so.6.0.21 <- libstdc++.so.6` can have any location in /home/[name]. ..... Run a program: `export LD_LIBRARY_PATH=new-location:$LD_LIBRARY_PATH && start-command` – Knud Larsen May 12 '21 at 12:30