windows 如何在 DOS 的 ftp 模式下查看 unix 中的文件内容?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7051140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to view the content of a file in unix in ftp mode of DOS?
提问by user893096
How can I view the content of a file (on a Unix server) when I log into Unix from the Windows command prompt in FTP mode? I tried vi,cat and ed but none of them works.I can view the files using ls -l
, but can't view the content. If there is any special command please let me know.
当我以 FTP 模式从 Windows 命令提示符登录到 Unix 时,如何查看文件的内容(在 Unix 服务器上)?我尝试了 vi、cat 和 ed,但它们都不起作用。我可以使用 来查看文件ls -l
,但无法查看内容。如果有任何特殊命令,请告诉我。
采纳答案by dhempler
You can not run VI and cat over a FTP client. You want to log into the unix box with SSH and then use VI and/or cat.
您不能通过 FTP 客户端运行 VI 和 cat。您想使用 SSH 登录到 unix 框,然后使用 VI 和/或 cat。
FTP is for file transfers only.
FTP 仅用于文件传输。
SSH allows for command line functions. Editing and viewing of files on the server.
SSH 允许使用命令行功能。编辑和查看服务器上的文件。
回答by broofa
The GET command will print file contents to the console if you pass '-' as the output filename. E.g. ..
如果您传递“-”作为输出文件名,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>
回答by ransom bot
I don't think ftp allows for viewing files only file transfers, I think that some applications emulate a "view" of sorts by transfering part of a file using resumes and offsets to "view" the view able portion of a file. Downloading and viewing would be best if your client doesn't support viewing and your server resuming, it will be doing that anyways if it does.
我不认为 ftp 只允许查看文件传输文件,我认为某些应用程序通过使用简历和偏移量传输文件的一部分来“查看”文件的可查看部分来模拟各种“视图”。如果您的客户端不支持查看并且您的服务器恢复,下载和查看将是最好的,如果它支持,它无论如何都会这样做。
Note: you should be able to enter the command "?" (no quotes) and get a full list of server supported commands. (see: http://www.cs.colostate.edu/helpdocs/ftp.html)
注意:您应该能够输入命令“?” (无引号)并获取服务器支持的命令的完整列表。(见:http: //www.cs.colostate.edu/helpdocs/ftp.html)
You should use SSH & putty on windows if you want access to a full terminal. http://www.chiark.greenend.org.uk/~sgtatham/putty/
如果你想访问一个完整的终端,你应该在 Windows 上使用 SSH & putty。http://www.chiark.greenend.org.uk/~sgtatham/putty/