A brief introduction to ftp connection command linux

Linux uses sftp to connect to B from A
Linux The command to use sftp to connect to B from A is: sftp -oPort=60001 [email protected]. Use the -o option to specify the port number. -oPort=remote port number sftp get /var/www/fuyatao/index.php /home/fuyatao/. This statement will copy index.php from the /var/www/fuyatao/ directory on the remote host.

Then download it to the local /home/fuyatao/ directory.

sftp put /home/fuyatao/downloads/Linuxgl.pdf /var/www/fuyatao/

This statement will upload the linuxgl.pdf file in the local /home/fuyatao/downloads/ directory to the remote host /var/www/fuyatao/ directory.

The linux ftp remote connection command is:

  1. Connect to the ftp server: Format: ftp [hostname| ip-address] Enter at the linux command line: ftp 192.168.26.66

The server asks you for your username and password. Enter your username and corresponding password respectively, and wait until the authentication is passed.

2. Download files: To download files, you usually use the two commands get and mget. a) get format: get [remote-file] [local-file]

Transfer files from the remote host to the local host.

3. Upload files: a) put format: put local-file [remote-file], transfer a local file to the remote host.

4. Disconnect: bye: interrupt the connection with the server. ftp bye (Enter).

How to check the number of directory files on the server using the ftp command to connect to the ftp server under Linux
1. Start ftp under Linux

2. Connect to FTP

3. Enter the FTP directory

4. View the number of directory files

ls -l ordinary files start with -, folders start with d, grep is followed by regular expression: ^- matches that start with -.

Extended information:

1. Check the number of files in the current directory (excluding files in subdirectories):

ls -l|grep “^-”| wc -l

  1. View the number of files in the current directory (including files in subdirectories):

ls -lR|grep “^-”| wc -l

3. Check the number of folders and directories in the current directory (excluding directories in subdirectories):

ls -l|grep “^d”| wc -l

4. Query the number of all files in the directory with the specified prefix name under the current path. For example: count the number of all files in all directories starting with "20161124":

ls -lR 20161124*/|grep “^-”| wc -l

How to enable ftp service on Linux host
1. Connect to the corresponding Linux host and enter the Linux command line state waiting for shell instructions to be entered.

2. Enter the shell command on the Linux command line: ps -ef | grep ftp.

3. Finally, press the Enter key to execute the shell command. At this time, you will see that the ftp process has been successfully queried, indicating that the ftp function is enabled.

Guess you like

Origin blog.csdn.net/weixin_43214644/article/details/133910620