您可以使用scp
命令來遠程拷貝文件,并使用ssh
命令來遠程執(zhí)行解壓操作。以下是步驟:
scp
命令從遠程主機拷貝文件到本地主機:scp username@remote_host:/path/to/remote/file /path/to/local/directory
其中,username
是遠程主機的用戶名,remote_host
是遠程主機的主機名或IP地址,/path/to/remote/file
是遠程文件的路徑,/path/to/local/directory
是本地目錄的路徑。
ssh
命令連接到遠程主機,并在遠程主機上執(zhí)行解壓操作:ssh username@remote_host "cd /path/to/directory && tar -zxvf file.tar.gz"
其中,username
是遠程主機的用戶名,remote_host
是遠程主機的主機名或IP地址,/path/to/directory
是文件解壓目錄的路徑,file.tar.gz
是要解壓的文件名。
通過以上兩個步驟,您可以遠程拷貝文件并解壓到指定目錄。