开发者

how to view the content of a file in unix in ftp mode of DOS? [closed]

开发者 https://www.devze.com 2023-03-27 17:31 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

Closed 2 years ago.

Improve this question

How can I view the content of a file (on a Unix server) when开发者_StackOverflow 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.


The GET command will print file contents to the console if you pass '-' as the output filename. E.g. ..

$ 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>


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 is for file transfers only.

SSH allows for command line functions. Editing and viewing of files on the server.


You can view via this `root@kali:~$ 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) `


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.

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)

You should use SSH & putty on windows if you want access to a full terminal. http://www.chiark.greenend.org.uk/~sgtatham/putty/

0

精彩评论

暂无评论...
验证码 换一张
取 消