重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
1、首先,连接相应linux主机,进入到linux命令行状态下,等待输入shell指令。
10年积累的网站建设、成都网站设计经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有克州免费网站建设让你可以放心的选择与我们合作。
2、其次,在linux命令行中输入:ftp 10.18.34.115。
3、最后,按下回车键执行shell指令,此时会看到已成功连接上ftp服务,可输入ftp命令了。
1.Linux下启动ftp
2.连接FTP
3.进入FTP目录
4.查看目录文件数
ls -l 普通文件就是以 - 开头,文件夹以 d 开头,grep 后面接正则表达式:^- 以 - 开头的匹配。
扩展资料:
1.查看当前目录下的文件数量(不包含子目录中的文件):
ls -l|grep "^-"| wc -l
2. 查看当前目录下的文件数量(包含子目录中的文件):
ls -lR|grep "^-"| wc -l
3.查看当前目录下的文件夹目录个数,(不包含子目录中的目录):
ls -l|grep "^d"| wc -l
4.查询当前路径下的指定前缀名的目录下的所有文件数量 例如:统计所有以“20161124”开头的目录下的全部文件数量:
ls -lR 20161124*/|grep "^-"| wc -l
Linux之ftp命令使用方法及案例
Example 1:登陆
[root@iZ25ja2kaemZ ~]# ftp 121.199.5.52
Connected to 121.199.5.52 (121.199.5.52).
220 Microsoft FTP Service
Name (121.199.5.52:root): baitongsj
331 User name okay, need password.
Password:
230 User logged in, proceed.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp ll
?Invalid command
ftp
Example2:dir,cd ,quit 命令用法
ftp dir ./app
227 Entering Passive Mode (121,199,5,52,128,234)
150 Opening ASCII mode data connection for /bin/ls.
total 0
drw-rw-rw- 1 user group 0 Nov 9 18:26 .
drw-rw-rw- 1 user group 0 Nov 9 18:26 ..
drw-rw-rw- 1 user group 0 Nov 9 18:24 Common
drw-rw-rw- 1 user group 0 Nov 9 18:24 Conf
drw-rw-rw- 1 user group 0 Nov 9 18:19 Lang
drw-rw-rw- 1 user group 0 Nov 9 18:23 Lib
drw-rw-rw- 1 user group 0 Nov 9 18:26 Runtime
drw-rw-rw- 1 user group 0 Nov 9 18:35 Tpl
226 Transfer complete.
ftp cd base
250 Directory changed to /crms/Base
ftp dir
227 Entering Passive Mode (121,199,5,52,128,235)
150 Opening ASCII mode data connection for /bin/ls.
drw-rw-rw- 1 user group 0 Nov 9 18:18 .
drw-rw-rw- 1 user group 0 Nov 9 18:18 ..
drw-rw-rw- 1 user group 0 Nov 9 18:12 Common
drw-rw-rw- 1 user group 0 Nov 9 18:13 Conf
drw-rw-rw- 1 user group 0 Nov 9 18:17 Extend
-rw-rw-rw- 1 user group 1854 Jan 18 2016 LICENSE.txt
drw-rw-rw- 1 user group 0 Nov 9 18:17 Lang
drw-rw-rw- 1 user group 0 Nov 9 18:17 Lib
-rw-rw-rw- 1 user group 5600 Jan 18 2016 README.txt
-rw-rw-rw- 1 user group 1568 Jan 18 2016 ThinkPHP.php
drw-rw-rw- 1 user group 0 Nov 9 18:18 Tpl
-rw-rw-rw- 1 user group 7396 Jan 18 2016 logo.png
226 Transfer complete.
ftp quie
?Invalid command
ftp quit
221 Goodbye!
[root@iZ25ja2kaemZ ~]#
example3:帮助文件
ftp help
Commands may be abbreviated. Commands are:
! debug mdir sendport site
$ dir mget put size
account disconnect mkdir pwd status
append exit mls quit struct
ascii form mode quote system
bell get modtime recv sunique
binary glob mput reget tenex
bye hash newer rstatus tick
case help nmap rhelp trace
cd idle nlist rename type
cdup image ntrans reset user
chmod lcd open restart umask
close ls prompt rmdir verbose
cr macdef passive runique ?
delete mdelete proxy send
ftp help dir
dir list contents of remote directory
ftp help mdir
mdir list contents of multiple remote directories
ftp
example4:重命名文件
ftp dir
227 Entering Passive Mode (121,199,5,52,128,234)
150 Opening ASCII mode data connection for /bin/ls.
drw-rw-rw- 1 user group 0 Nov 9 18:46 .
drw-rw-rw- 1 user group 0 Nov 9 18:46 ..
drw-rw-rw- 1 user group 0 Nov 9 18:39 Install
drw-rw-rw- 1 user group 0 Nov 9 18:36 appImg
drw-rw-rw- 1 user group 0 Nov 11 11:08 css
drw-rw-rw- 1 user group 0 Nov 9 18:37 excelmodel
drw-rw-rw- 1 user group 0 Nov 9 18:46 file
drw-rw-rw- 1 user group 0 Nov 9 18:37 ico
drw-rw-rw- 1 user group 0 Nov 9 18:38 img
drw-rw-rw- 1 user group 0 Nov 11 11:11 js
-rw-rw-rw- 1 user group 3 Oct 25 15:56 ni.txt
drw-rw-rw- 1 user group 0 Nov 9 18:46 sound
drw-rw-rw- 1 user group 0 Nov 9 18:46 sql
226 Transfer complete.
ftp rename ni.txt ss
350 File or directory exists, ready for destination name
250 RNTO command successful.
ftp dir
227 Entering Passive Mode (121,199,5,52,128,235)
150 Opening ASCII mode data connection for /bin/ls.
drw-rw-rw- 1 user group 0 Nov 16 16:57 .
drw-rw-rw- 1 user group 0 Nov 16 16:57 ..
drw-rw-rw- 1 user group 0 Nov 9 18:39 Install
drw-rw-rw- 1 user group 0 Nov 9 18:36 appImg
drw-rw-rw- 1 user group 0 Nov 11 11:08 css
drw-rw-rw- 1 user group 0 Nov 9 18:37 excelmodel
drw-rw-rw- 1 user group 0 Nov 9 18:46 file
drw-rw-rw- 1 user group 0 Nov 9 18:37 ico
drw-rw-rw- 1 user group 0 Nov 9 18:38 img
drw-rw-rw- 1 user group 0 Nov 11 11:11 js
drw-rw-rw- 1 user group 0 Nov 9 18:46 sound
drw-rw-rw- 1 user group 0 Nov 9 18:46 sql
-rw-rw-rw- 1 user group 3 Oct 25 15:56 ss
226 Transfer complete.
example5 :格式 get [remote-file] [local-file],将文件从远端主机中传送至本地主机中,如要获取服务器上\rose\1.bmp,则 ftp get /rose/1.bmp /tmp/1.bmp (回车),必须给出第二个参数,否则会复制失败,登录后执行:
ftp get robots.txt /tmp/
local: /tmp/ remote: robots.txt
227 Entering Passive Mode (121,199,5,52,128,233)
150 Opening BINARY mode data connection for robots.txt (26 Bytes).
local: /tmp/: Is a directory
226 Transfer complete.
226 ABOR command successful.
ftp
example 6:lcd 命令
ftp lcd ..
Local directory now /
ftp lcd /tmp/flower
Local directory now /tmp/flower
example 7: put命令
格式:put local-file [remote-file]
将本地一个文件传送至远端主机中.
如要把本地的1.bmp传送到远端主机e:\rose,并改名为333.bmp
ftp put 1.bmp /rose/333.bmp (回车)
ftp put /tmp/tt.txt ./nihaol.txt
local: /tmp/tt.txt remote: ./nihaol.txt
227 Entering Passive Mode (121,199,5,52,128,232)
150 Opening BINARY mode data connection for nihaol.txt.
226 Transfer complete.
5 bytes sent in 2.6e-05 secs (192.31 Kbytes/sec)
example 8: mput命令
格式:mput local-files
将本地主机中一批文件传送至远端主机.
如要把本地当前目录下所有bmp文件上传到服务器e:\rose 下
ftp cd /rose (回车)
ftp mput *.bmp (回车)
注意:上传文件都来自于主机的当前目录下。比如,在 /root/test下运行的ftp命令,则只有在/root/test下的文件linux才会 上传到服务器e:\rose 下
检查Linux系统上FTP服务是否开启:
1.通过查询提供FTP服务的进程是否存在
[root@localhost root]#ps -ef | grep ftp
#并未找到任何包含ftp关键字的进程信息,可判断服务未开启。
2.通过查询是vsftpd服务是否存在
[root@localhost root]#service vsftpd status
#vsftpd是最常见的FTP服务器,发现stopped状态即为关闭。
3.开启Linux上的FTP服务
[root@localhost root]# service vsftpd start
Starting vsftpd for vsftpd: [ OK ]
#再次查看发现已经处于启动状态:
[root@localhost root]# service vsftpd status
vsftpd (pid 4510) is running...