1. 程式人生 > >【小技巧】Win10主機和Ubuntu虛擬機器/伺服器的檔案傳輸

【小技巧】Win10主機和Ubuntu虛擬機器/伺服器的檔案傳輸

       每次我們在伺服器或者虛擬機器編譯完程式碼,需要傳輸映象檔案回主機,最開始一直採用資料夾介面虛擬機器拖拽,或者FilZilla,

       

或者WinScap

i

這些都只需要圖形化介面拖拽,後來,好奇查了下,linux shell 介面的ftp

ile Transfer Protocol (FTP) is a network protocol used to copy a file from one computer to another over the Internet or LAN. FTP follows a client-server architecture which utilizes separate control and data connections between the ftp client and server. The default port for ftp is 21.

Use the following syntax to connect to transfer files to and from a remote network ftp site:

ftp ftp.example.com
ftp 1.2.3.4
ftp [email protected]

You must know ftp username and password for user-based password authentication or with anonymous user access use ftp as both username and password. In this example, you are connecting to ftp.freebsd.org with anonymous user access (open the terminal and type the following command):

$ ftp ftp.freebsd.org

Sample session:

複製程式碼
Trying 87.51.34.132...
Connected to ftp.freebsd.org.
220 ftp.beastie.tdk.net FTP server (Version 6.00LS) ready.
Name (ftp.freebsd.org:vivek): ftp
331 Guest login ok, send your email address as password.
Password:
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp
>
複製程式碼

When you enter your own loginname and password for the ftp.example.com server, it returns the prompt  ftp>

You need to type all commands in front of the ftp> prompt.

Task: Download / Copy file

To copy one file at a time from the remote ftp server to the local system use get command:

get fileName
get fileName newFileName

In this example, download file resume.pdf in the current remote directory to (or on top of) a file with the same name, resume.pdf, in your current local directory:

ftp> get resume.pdf 

Sample outputs:

local: resume.pdf remote: resume.pdf
229 Entering Extended Passive Mode (|||55093|)
150 Opening BINARY mode data connection for 'resume.pdf' (53077 bytes).
100% |*********************************************************************| 53077       12.58 KiB/s    00:00 ETA
226 Transfer complete.
53077 bytes received in 00:04 (12.57 KiB/s)

In this example, copies file data.tar.gz in the current remote directory to (or on top of) a file named backup.tar.gz in your current local directory:

ftp> get data.tar.gz backup.tar.gz

Change Local Directory

To change directory on your local system, enter:

ftp> lcd /path/to/new/dir
ftp> lcd /tmp

Sample outputs:

Local directory now: /tmp

Print local directory:

ftp> lpwd
列印本地(Local)的路徑

Sample outputs:

/tmp

The lpwd command prints current download directory for local systems. However, to find out the pathname of the current directory on the remote ftp server, enter:

ftp> lpwd
列印FTP端的路徑地址

Sample outputs:

Remote directory: /pub/FreeBSD

Task: Download Multiple Files

You need to use mget command as follows to copy multiple files from the remote ftp server to the local system. You may be prompted for a yes/no (Y/N) answer before transferring each file (you can disable prompt by passing the -i option to ftp client). To download all files, enter:

ftp> mget *

To download all perl files (ending with .pl extension), enter:

ftp> mget *.pl

Task: Turn On / Off Interactive Prompting

The ftp command prompt sets interactive prompting; "on" which enables prompting so that you can verify of each step of the multiple commands, "off" allows the commands to act unimpeded:

ftp> prompt on
ftp> mput *.php
ftp> prompt off
ftp> mget *.py

Task: Delete File

To delete a file in the current remote directory use delete command:

ftp> delete fileName
ftp> delete output.jpg 

Task: Upload One File

To copy one file at a time from the local systems to the remote ftp server, enter:

ftp> put fileName

In this example, upload logo.jpg, enter:

ftp> put logo.jpg

Task: Upload Multiple Files

To copy multiple files from the local system to the remote ftp server use mput command. Again, you may be prompted for a yes/no (y/n) answer before transferring each file. In this example, upload all files from the current system:

ftp> mput *
ftp> mput *.pl

Task: Set The Mode Of File Transfer

To set the mode of file transfer to ASCII, enter:

ftp> ascii

Please note that ascii is the default and good for text files. To set the mode of file transfer to binary, enter:

ftp> binary

The binary mode is recommended for almost all sort of files including images, zip files and much more. The binary mode provides less chance of a transmission error.

Task: Connect To Another FTP Server

To open a connection with another ftp server, enter:

ftp> open ftp.nixcraft.net.in

The above command opens a new FTP connection with ftp.nixcraft.net.in. You must provide a username and password for a ftp.nixcraft.net.in account. However, a username and password can be skipped for an anonymous FTP connection.

Task: Exit the FTP Session

Type quit or bye, enter:

ftp> quit
OR
ftp> bye

How Do I Find Out More Information About The FTP Commands?

Type ? or help to get more information about the FTP commands:

ftp> ?
ftp> help

To get a short description about each command, enter:

ftp> help commandName
ftp> help chmod

用了一段時間的shell 下ftp 命令,然後又想到可不可以試著寫一個指令碼去直接傳輸kerne.img 和resource.img,只要修改第一行的使用者名稱密碼,就好了。我的主機FTP伺服器設定了任何人都可以讀寫,所以使用者名稱得是anonymous


編譯完kernel,只要./f1就可以實現兩個映象檔案的傳輸了。

相關推薦

技巧Win10主機Ubuntu虛擬機器/伺服器檔案傳輸

       每次我們在伺服器或者虛擬機器編譯完程式碼,需要傳輸映象檔案回主機,最開始一直採用資料夾介面虛擬機器拖拽,或者FilZilla,         或者WinScap i 這些都只需要圖形化

技巧無法連線到安全檢查代理伺服器,套接字建立失敗

        前幾天上網的時候,電腦出現了一些問題,連不上網,之前電腦還好好的,怎麼突然就上不去網了? 問題:         用的是學校的INODE客戶端,以為是配置出現了問題,進行了各種檢查

技巧電腦開機自動關閉數字鍵盤方法

開機自動關閉數字小鍵盤方法開機自動關閉數字小鍵盤方法:在〔開始〕點擊{運行〕輸入〔Regedit〕選擇{HKEY_USERS〕→選擇〔.Default〕 →選擇〔Control Panel〕→選擇〔Keyboard〕→將數值名稱〔InitialKeyboardIndicators〕資料值更改為〔0〕順道來腦補

技巧Eclipse 中創建Maven項目後沒有WEB-INF文件夾以及web.xml文件

出現 可能 pan 3.0 開始 自動創建 TP 應該 xml文件 懶得截圖了,一張圖配下面步驟搞定。 1、右鍵項目,選擇propertities後選擇圖中①(被遮住了); 2、先不②勾選去掉,點擊Apply;然後在把②處勾選上。此時④位置會出現東東,點擊藍色超鏈接。填入

程序多選單選組件的封裝

代碼 下單 單選框 .text border event methods set ole 真正開發過小程序的開發者會發現,小程序裏面的單選框和多選框封封裝的實在不夠友好,一般與UI都會有比較大的出入,所以下面來探討一下單選框和多選框的封裝。 效果 比如我們要做一個這種

PS技巧常用概念功能操作

常用概念 1.畫布大小與影象大小 畫布大小是影象背景的大小,即畫紙。影象大小是當前編輯的圖層的所有物件大小,即畫紙上的畫。   常用功能操作 1.開啟和新建功能 開啟圖片:雙擊工作區  圖片垂直平鋪:Alt+W,A,V 新建影象檔案:Ctrl+N 設定畫布大小:Ctrl+

技巧之 python批量修改指定檔案型別的檔名

在工作學習當中,常常遇到要批量修改我檔名情況,要是一個一個的去重新命名,不是程式猿所為,今天分享一個批量修改檔名的方法,供大家參考: 例如下圖,在我的某一個資料夾下,又n個亂七八糟的“.txt”檔案,將這些檔案批量修改名稱。 直接上程式碼: import os files = os

win10 Hyper_v中Ubuntu虛擬機器主機共享檔案

具體步驟如下: 計算機管理 磁碟管理 建立VHD(右鍵) 選擇VHD檔案儲存位置(瀏覽) 設定虛擬硬碟引數 選擇虛擬硬碟格式(VHD和VHDX都行) 虛擬硬碟型別(固定大小和動態

技巧某個網頁打不開怎麼辦?

最近電腦也不知道是怎麼了,突然就開始“挑剔”起來,有的網頁能開啟,有的網頁死活打不開!不知道小夥伴們有沒有遇到這種情況啊?一開始還以為是網路有問題,要麼是網斷了,要麼是網速太慢,於是各種檢查自己的網路

技巧如何修改 Lua 5.1 的引擎,讓Lua支援中文變數名、混合變數名

最近在倒騰 Lua 指令碼引擎。Lua 現在廣泛用於各種遊戲、PSP中,速度極快,與 C++ 宿主程式碼“相處”能力強,還有第三方增強工程如 LuaPlus, LuaBind 等的支援,筆者正是在使用 LuaPlus 這個不錯的 Lua C++ 封裝,內建 Lua 5.1 引

技巧限制windows server 2008的最大使用者登入數

把雲伺服器單純當作自己一個雲端主機的人大有人在。本人就是其中一位。 由於windows server 2008的會話保持機制,導致你關閉掉當前遠端桌面連線,並從另外一臺電腦上開啟遠端連線之後,另外一臺電腦預設並不會進入你之前的桌面,反而會重新再開一個賬戶 反正Windows server是多使用者作業系統

技巧文字編輯器Notepad++(v6.9)中Tab設定成4個空格

    Notepad++ 作為很順手的文字編輯器被程式猿廣泛運用。     養成良好的程式碼習慣,先從縮排標準4空格開始。     版本為6.9.2     流程:     設定—首選項—製表符

技巧當對服務器做大負荷操作,如何禁止普通用戶登錄

etc tro 我們 ron 希望 普通用戶 就是 png 看到了 日常運維中當我們在對服務器(root用戶)做大負荷操作時(占用系統資源較大),不希望普通用戶來登錄服務器進行其他操作,該怎麽做呢? 接下來就是見證奇跡的時刻(圖片中左側為root用戶,右側為普通用戶登錄測試

實踐總結給CentosUbuntu設定靜態網路IP以及配置ssh功能

作為一名以Windows平臺為主的開發者,在接觸和使用Linux系統的過程中總會遇到一系列的問題。每當這時候,我相信大部分人是和我一樣的處理辦法,就是網上各種搜尋嘗試直到問題解決為止,而有些問題,前後不止會遇到一次 ,每次遇到每次搜尋。因為在Linux上基本都是使用命令列操作,各種命令、工具、配置、路徑等等不

Docker容器本機之間的檔案傳輸

主機和容器之間傳輸檔案的話需要用到容器的ID全稱。 獲取方法如下: 1.先拿到容器的短ID或者指定的name。 2.然後根據這兩項的任意一項拿到ID全稱。 有了這個長長的ID的話,本機和容器之間的檔案傳輸就簡單了。 docker cp 本地檔案路徑 ID全稱:容器路徑 進入容器之後

ubuntu虛擬機器檔案到當前主機

Ubuntu14.04虛擬機器和宿主機(win7)之間的檔案傳輸 (FTP)篇 首先當然是在虛擬機器上按FTP伺服器 sudo apt-get install vsftpd  新建"/home/uftp"目錄作為使用者主目錄 開啟"終端視窗",輸入"sudo mkdir

VMware上實現win7系統Ubuntu虛擬機器互相複製貼上

文章目錄 系統環境 在VMware上安裝VMware tools 系統環境 主機系統為win7 64位,虛擬機器系統為ubuntu14.04(在VMware中),其他版本的系統操作也類似。 在VMware上安裝VMware tools

日常生活技巧 -- vmware workstation 無法連線到虛擬機器

虛擬機器無端出現,VMware Workstation 無法連線到虛擬機器。請確保您有許可權執行該程式、訪問改程式使用的所有目錄以及訪問所有臨時檔案目錄。 解決方法: 右擊我的電腦->>

如何利用PuTTY連線Windows主機Linux虛擬機器

    PuTTY是可用來連線本機Windows系統與虛擬機器中的Linux系統,畢竟虛擬機器中有時候不太流暢,連線後我們就可以在window系統去做同樣的事了,話不多說,直接上步驟:1.在Windows中下載PuTTy,exe檔案,可直接執行,無需安裝:連線https://

Xshell用於windows主機linux虛擬機器之間互傳檔案

此方法也是可以連線阿里雲伺服器的,通過xshell使用阿里雲伺服器並進行檔案的上傳下載真的好方便。 注:本文轉自 https://www.linuxidc.com/Linux/2015-05/117975.htm  這個東西比“共享資料夾”好用多了!(當然需要先配置xshe