Linux檔案傳輸

2021-07-23 12:17:13 字數 2310 閱讀 6220

#########不同系統間的檔案傳輸##############

tar 打包

tar -c ##新建打包檔案

tar -t ##檢視打包的內容,重點在檢視檔名

tar -x ##解打包,解壓縮

tar -j ##bzip2壓縮解壓縮

tar -z ##gzip壓縮解壓縮

tar -v ##在壓縮、解壓縮的過程中,將正在處理的檔案名列出來()

tar -r ##新增檔案到包中

tar -f ##指定生成包的名字

tar -c ##解壓縮時候指定特定目錄

tar -p ##保留備份

tar -p ##保留絕對路徑

tar --delete filename ##刪除包中指定檔案

tar --get filename     ##取出包中指定檔案

注:-c -t -x 不能出現在一串命令列中

[liu@localhost desktop]$ touch file

[liu@localhost desktop]$ tar -cf file.tar file

[liu@localhost desktop]$ tar -xf file.tar

#############壓縮###################

gzip

gzip x.tar *****>x.tar.gz ##壓縮

gunzip x.tar.gz *****> x.tar ##解壓

tar zcvf x.tar.gz 目標檔案 ##打包壓縮檔案

tar zxvf x.tar.gz  ##x.tar.gz===>x

bz2bzip2 x.tar *****>x.tar.bz2 ##壓縮

bunzip2 x.tar.bz2 *****> x.tar ##解壓

tar jcvf x.tar.bz2 目標檔案  ##打包壓縮檔案

tar jxvf x.tar.bz2 ##x.tar.bz2===>x xz

xz x.tar *****> x.tar.xz    ##壓縮

unxz x.tar.xz *****> x.tar   ##解壓

tar jcvf x.tar.xz  目標檔案 ##打包壓縮檔案

tar jxvf x.tar.xz         ##x.tar.xz===>x

zipzip -r x.tar.zip x.tar    ###壓縮

unzip x.tar.zip         ###解壓

[liu@localhost desktop]$ touch file

[liu@localhost desktop]$ tar zcvf file.tar.gz file

[liu@localhost desktop]$ rm -fr file

[liu@localhost desktop]$ tar zxvf file.tar.gz

##########scp###############

scp ##遠端複製

scp  檔名 使用者名稱@ip:/路徑    ##上傳檔案

scp -r  路徑 使用者名稱@ip:/路徑   ##長傳目錄

[liu@localhost desktop]$ scp file5 [email protected]:/home/liu

##########rsync################

rsync ##遠端同步

rsync file|目錄路徑 user@ip:/路徑

rsync user@ip:/目錄路徑 /路徑

rsync -r##同步目錄

rsync -l##不忽略鏈結

rsync -o##保持檔案屬主資訊

rsync -t##不忽略時間戳

rsync -p##不忽略許可權

rsync -o##不忽略使用者資訊

rsync -d##不忽略裝置檔案

rsync -g##不忽略組資訊

[liu@localhost desktop]$ rsync file5 [email protected]:/home/liu

#########sftp###############

sftp ##安全檔案傳輸命令

sftp user@ip

pwd ##看遠端伺服器的目錄

lpwd##本地目錄

help##檢視都sftp支援哪些命令

ls   ##看遠端伺服器的目下的東西

lls  ##本地目錄的東西

exit quit##退出

#########end###############

Linux檔案傳輸

從 遠端 複製到 本地,只要將 從 本地 複製到 遠端 的命令 的 後2個引數 調換順序 即可 例如 scp root www.cumt.edu.cn home root others music home space music 1.scp r www.cumt.edu.cn home root ...

linux 檔案傳輸

tar,cpio 歸檔命令 tar cvf 歸檔.tar file1 file2 tar cvf tar file remove files 壓縮並且刪除原檔案 gzip file 壓縮檔案成file.gz gzip d file.gz 解壓 bzip2 file 用gzip壓縮 bzip2 d f...

Linux檔案傳輸

在win上可以通過ssh與遠端linux主機進行檔案傳輸,主要使用scp指令 將遠端檔案firsy.py傳輸到本地 scp chen home python file first.py d backoutsql test file將本地檔案test.py傳輸到遠端伺服器 scp d backouts...