如何在DOS的ftp模式下查看unix中的文件内容? [已关闭]

问题描述 投票:0回答:4

当我通过Windows命令提示符以FTP方式登录Unix时,如何查看文件的内容(在Unix服务器上)?我尝试了 vi、cat 和 ed,但都不起作用。我可以使用

ls -l
查看文件,但无法查看内容。如果有什么特殊命令请告诉我。

windows unix ftp
4个回答
99
投票

如果您传递“-”作为输出文件名,则 GET 命令会将文件内容打印到控制台。例如。 ..

$ ftp some_site.com
...
ftp> get some_file.txt -
remote: some_file.txt
229 Extended Passive Mode Entered (|||36565|)
150 Opening BINARY mode data connection for php_errors.log (438 bytes)
...
... contents of some_file.txt will be printed here
...
226 Transfer complete
438 bytes received in 00:00 (116.51 KiB/s)
ftp>

3
投票

您可以通过此查看

$ ftp 10.10.101.129

Connected to 10.10.101.129.

...

230 Login successful.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> passive

Passive mode on.

ftp> ls

227 Entering Passive Mode (10,10,101,129,89,219).

150 Here comes the directory listing.

-rw-rw-r--    1 1001     1001          141 Feb 23  2019 note

226 Directory send OK.

ftp> get note -     #This displays the content in that file.

remote: note

227 Entering Passive Mode (10,10,101,129,89,219).

150 Opening BINARY mode data connection for note (141 bytes).

Jerry, I finally got a chance to update our internal social media platform (bookface.com).

Can you signup and like my doggo photos?

Thanks

226 Transfer complete.

141 bytes received in 0.00 secs (273.7481 kB/s)

2
投票

您无法通过 FTP 客户端运行 VI 和 cat。您想使用 SSH 登录 unix 盒子,然后使用 VI 和/或 cat。

FTP 仅用于文件传输。

SSH 允许使用命令行功能。编辑和查看服务器上的文件。


0
投票

我不认为 ftp 只允许查看文件传输,我认为某些应用程序通过使用简历和偏移量传输文件的一部分来模拟某种“视图”,以“查看”文件的可查看部分。如果您的客户端不支持查看和服务器恢复,那么下载和查看将是最好的,如果支持,它无论如何都会这样做。

注意:您应该能够输入命令“?” (无引号)并获取服务器支持的命令的完整列表。 (参见:http://www.cs.colostate.edu/helpdocs/ftp.html

如果您想访问完整的终端,您应该在 Windows 上使用 SSH 和 putty。 http://www.chiark.greenend.org.uk/~sgtatham/putty/

© www.soinside.com 2019 - 2024. All rights reserved.