Tuxdrive-适用于Linux的命令行Google Drive客户端

时间:2020-03-21 11:48:29  来源:igfitidea点击:

Tuxdrive是一个免费的基于控制台的Google驱动器客户端,适用于类似Unix的操作系统。
使用Tuxdrive,我们可以从终端访问Google驱动器,也可以下载/上传,管理Google驱动器中的所有内容。
它是完全免费和开源的。

Tuxdrive-适用于Linux的命令行Google Drive客户端

在Ubuntu上安装Tuxdrive

首先,我们需要安装必需的准备工作pip3,然后安装用于与Google驱动器进行身份验证的google-api-python-client。

首先,让我们安装pip3.

在Ubuntu和Linux Mint等衍生产品上,运行以下命令以安装pip3.

$sudo apt-get install python3-pip

安装pip3后,请使用以下命令安装google-api-python-client:

$sudo pip3 install google-api-python-client

最后,从此处下载最新的Tuxdrive .deb软件包并如下所示进行安装。

在撰写本教程时,最新版本为1.0.10.

$wget https://github.com/prahladyeri/tuxdrive/releases/download/v1.0.10/tuxdrive.deb
$sudo apt-get install gdebi
$sudo gdebi tuxdrive.deb

配置

安装完成后,通过运行以下命令打开Tuxdrive:

$tuxdrive

如果浏览器在其他计算机上,则退出并使用命令行参数--noauth_local_webserver重新运行该应用程序。

$tuxdrive --noauth_local_webserver

首次运行tuxdrive时,它将打开浏览器窗口,并要求我们代表我们访问Google驱动器的权限。
单击允许。

复制验证码:

然后,将其粘贴到终端中,然后按Enter。

身份验证过程成功后,我们将进入tuxdirve提示符。

现在,我们可以开始从终端使用Tuxdrive客户端访问Google云端硬盘。

用法

要列出Google驱动器中的所有文件和目录,请运行:

$ls

或者,

$dir

输出示例:

tux_drive> ls
Credentials fetched successfully.
DIRECTORY Technology
DIRECTORY Books
DIRECTORY Information Security 2
DIRECTORY theitroad
DIRECTORY Linux
DIRECTORY Ultimate IQ Tests - Philip Carter & Ken Russell
DIRECTORY Malware
DIRECTORY Kodaikanal Trip
DIRECTORY Office
DIRECTORY ESSN Training Session
DIRECTORY ..
FILE tuxlogo
FILE END
FILE END.docx
FILE END.docx
FILE Technical notes
FILE Create USB bootable disk
FILE Install Kali Linux Tools
FILE How can one become part of the 1%?
FILE Cloud Authentication1.docx
FILE Cloud Authentication1.docx
20 items found.

要列出Google驱动器当前本地工作目录中的所有文件和文件夹,请运行!dir或者!ls。

tux_drive> !dir
FILE .bash_logout
FILE .wget-hsts
DIRECTORY Public
DIRECTORY .shutter
DIRECTORY .config
DIRECTORY .local
DIRECTORY .gconf
DIRECTORY .gnome2
FILE .bashrc
FILE .sudo_as_admin_successful
FILE 208_374679378.pdf
DIRECTORY Downloads
FILE .profile
DIRECTORY Videos
DIRECTORY Documents
DIRECTORY .mozilla
DIRECTORY .thumbnails
FILE .xsession-errors.old
FILE .Xauthority
DIRECTORY .cache
DIRECTORY .gnupg
DIRECTORY Pictures
FILE .dmrc
FILE examples.desktop
FILE .ICEauthority
FILE tuxdrive.deb
FILE .xsession-errors
DIRECTORY Music
FILE .bash_history
DIRECTORY Desktop
DIRECTORY .dbus
DIRECTORY Templates
DIRECTORY .gnome2_private
33 items found.
Local Working Directory is /home/theitroad
tux_drive>

更改当前本地工作目录:

tux_drive> lcd Downloads/
Directory changed to Downloads/

要在驱动器中打印当前工作目录,请运行:

tux_drive> pwd
Remote Working Directory is /(root)
tux_drive>

同样,要打印本地工作目录,请使用“ lpwd”命令:。

tux_drive> lpwd
Local Working Directory is /home/theitroad/Downloads

要从Google驱动器下载文件,请使用如下所示的“拉”命令。

tux_drive> pull 208_374679378.pdf
File found: /208_374679378.pdf
Credentials fetched successfully.
Downloading: 0B88FP2CC57vMc2sxR01aVGEwUDZtX0xpMW9nazBLM0VDdS0w(208_374679378.pdf)
Downloaded successfully to /home/theitroad/208_374679378.pdf

所有文件都将下载到当前工作目录中,例如:$HOME目录。

要将文件上传到Google驱动器,请使用“ push”命令,如下所示。

tux_drive> push tuxdrive.deb
Uploading tuxdrive.deb
Credentials fetched successfully.
Upload successful
Credentials fetched successfully.
tux_drive>

要在驱动器中创建新目录,请在tuxdrive控制台中运行以下命令。

tux_drive> mkdir senthilkumar
Uploading senthilkumar
Credentials fetched successfully.
Upload successful
Credentials fetched successfully.
tux_drive>

上面的命令将在Google驱动器中创建一个名为“ senthilkumar”的目录。

要更改为新创建的目录,请运行:

tux_drive> cd senthilkumar
Credentials fetched successfully.
Remote directory changed to /senthilkumar (0B88FP2CC57vMbWp6YXlCNnQ3aWM)
tux_drive>

要检查我们现在的位置,请使用“ pwd”命令:

tux_drive> pwd
Remote Working Directory is /senthilkumar(0B88FP2CC57vMbWp6YXlCNnQ3aWM)

要返回到Google驱动器的根目录,请运行:

tux_drive> cd /
Credentials fetched successfully.
Remote directory changed to/(root)

要删除驱动器中的文件或者目录,请运行:

tux_drive> rm senthilkumar
senthilkumar is a directory. Are you sure you want to delete it? (Y/n)y
Credentials fetched successfully.
Item 0B88FP2CC57vMbWp6YXlCNnQ3aWM deleted.

要查看帮助部分,请运行“帮助”。

tux_drive> help
Commands:
help (or ?): Shows this help facility.
dir (or ls): Lists all files and folders on drive.
!dir (or !ls): Lists all files and folders in current directory.
pull <item>: Pulls the named file/folder from drive to current working directory.
push <item>: Pushes the named file/folder from current working directory to drive.
rm <item>: Delete the named file/folder on remote path.
pwd: Print working directory (remote/drive)
cd: Change working directory (remote/drive)
lpwd: Print working directory (local)
lcd: Change working directory (local)
rdcache: Show remote directory mapping of id and folder paths.
rfcache: Show remote files mapping of id and folder paths.
mkdir: Create a directory on remote path.
exit: Exits this program.
tux_drive>