如何在 Virtualbox 上的 Ubuntu 18.04 VM 上设置 Edx Stanford 编译器课程

如何在 Virtualbox 上的 Ubuntu 18.04 VM 上设置 Edx Stanford 编译器课程

https://courses.edx.org/courses/course-v1:StanfordOnline+SOE.YCSCS1+3T2020/6b750292e90d4950b895f621a5671b49/

我正在尝试解压下载的包但一直失败。

nyck33@nyck33-VirtualBox:/usr/class$ wget https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]
--2022-12-29 19:45:59--  https://courses.edx.org/asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]
Resolving courses.edx.org (courses.edx.org)... 104.16.177.84, 104.16.178.84, 104.16.179.84, ...
Connecting to courses.edx.org (courses.edx.org)|104.16.177.84|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5773538 (5.5M) [application/x-gzip]
Saving to: ‘asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]

asset-v1:StanfordOnlin 100%[=========================>]   5.51M  2.59MB/s    in 2.1s    

2022-12-29 19:46:03 (2.59 MB/s) - ‘asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]’ saved [5773538/5773538]

nyck33@nyck33-VirtualBox:/usr/class$ ls
asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]
asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]
nyck33@nyck33-VirtualBox:/usr/class$ tar -xf asset-v1:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]
tar: Cannot connect to [email protected]: resolve failed
nyck33@nyck33-VirtualBox:/usr/class$ tar -xf student-dist.tar.gz.1
tar: student-dist.tar.gz.1: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
nyck33@nyck33-VirtualBox:/usr/class$ 

我还可以尝试什么?

答案1

正如所指出的man tar

      An archive name that has a colon in it specifies a file  or  de‐
      vice on a remote machine.  The part before the colon is taken as
      the machine name or IP address, and the part  after  it  as  the
      file or device pathname, e.g.:

       --file=remotehost:/dev/sr0

GNU tar 提供了一个--force-local选项来覆盖此默认行为

   --force-local
          Archive file is local even if it has a colon.

因此

$ tar -xf asset-v1\:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]
tar: Cannot connect to [email protected]: resolve failed

失败,

$ tar --force-local -xf asset-v1\:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected]

成功。

答案2

您遇到的问题是由于文件名称太差造成的。您需要先重命名该文件,然后提取内容。

  1. 将文件重命名为更简单的名称:
    mv asset-v1\:StanfordOnline+SOE.YCSCS1+1T2020+type@[email protected] soe.tar.gz
    
  2. 提取内容:
    tar -xvf soe.tar.gz 
    
  3. 确认您有文件:
    ll
    total 5680
    drwxrwxr-x 10 jason jason    4096 12月 29 13:08 ./
    drwxr-xr-x 21 jason jason    4096 12月 29 13:06 ../
    drwxr-xr-x 11 jason jason    4096  6月 18  2011 assignments/
    drwxr-xr-x  3 jason jason    4096  6月 18  2011 bin/
    drwxr-xr-x  2 jason jason    4096  6月 18  2011 etc/
    drwxr-xr-x  2 jason jason    4096  6月 18  2011 examples/
    drwxr-xr-x  2 jason jason    4096  6月 18  2011 handouts/
    drwxr-xr-x 11 jason jason    4096  6月 18  2011 include/
    drwxr-xr-x  4 jason jason    4096  6月 18  2011 lib/
    -rw-rw-r--  1 jason jason 5773538  3月 28  2020 soe.tar.gz
    drwxr-xr-x 11 jason jason    4096  6月 18  2011 src/
    

当您看到文件名包含诸如:和 之类的字符时@,最好尽可能重命名它们。

相关内容