云计算第1阶段_Linxu基础知识_day4

 1 查看文件内容

#1 查看文件所有内容
cat $path/$file.txt
-n	#显示行号
-A	#显示控制字符(空格、制表符),用于查看文件内容最后是否多出一些看不到的信息

#2 head
head $path/$file.txt	#查看文件内容前10行
head -n 100 $path/$file.txt	#显示文件前100行内容

#3 tail
tail $path/$file.txt
tail -n 100 $path/$file.txt	#显示文件最后100行内容

#4 查看第100行
head -100 $path/$file.txt | tail -1
#5 管道符| 用于将管道符前面的内容,通过管道符后面的条件筛选出来。

#6 排查错误,一般在/var/log/messages下使用
tail -f $path/$file.txt	#实时监控文件新产生的内容

2 配置yum源

# 将系统自带的yum源进行备份
[root@xxx ~]# cd /etc/yum.repos.d/
[root@xxx yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo          epel.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo  CentOS-x86_64-kernel.repo  epel-testing.repo
[root@xxx yum.repos.d]# mkdir backup
[root@xxx yum.repos.d]# mv *.repo backup/

# 配置阿里云的yum源
# 网站:https://developer.aliyun.com/mirror/

# 下载基础yum源
[root@xxx ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

# 下载扩展yum源
[root@xxx ~]# curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

# 清理yum源缓存
[root@xxx ~]# yum clean all

# 重新加载新的yum源缓存
[root@xxx ~]# yum makecache

# 显示当前系统中所有的yum源仓库
[root@xxx yum.repos.d]# yum repolist

3、安装web服务:nginx

# 安装nginx
[root@xxx ~]# yum install -y nginx 

# 启动nginx
[root@xxx ~]# nginx

# 验证nginx服务是否启动成功, 看到 LISTEN …… *:80,即可,或者是通过浏览器访问服务器ip地址
[root@xxx ~]# ss -tlnp

[root@xxx ~]# ps -ef  |grep nginx
root      19033      1  0 14:44 ?        00:00:00 nginx: master process nginx
nginx     19034  19033  0 14:44 ?        00:00:00 nginx: worker process
nginx     19035  19033  0 14:44 ?        00:00:00 nginx: worker process


# /usr/share/nginx/html/ 改目录是nginx服务的默认网站发布目录

# 清空该目录下的文件,新写入一个初始化页面
[root@xxx ~]# rm -rf /usr/share/nginx/html/*
[root@xxx ~]# cd /usr/share/nginx/html/

4、本地文件上传至服务器

# 安装lrzsz上传下载工具
[root@xxx ~]# yum install -y lrzsz		
# rz 将本地文件上传至服务器,在弹出的窗口选择要上传的文件即可
[root@xxx ~]# rz

# sz 将服务器中的文件下载至本地,sz 后面跟需要下载的文件,然后在弹出的窗口中选择要保存到的位置
[root@xxx ~]# sz /etc/passwd

5、上传前端项目至服务器

# 解压zip的压缩包,需要解压工具unzip
[root@xxx opt]# yum install -y unzip
[root@xxx opt]# ls
love-master  love-master.zip
[root@xxx opt]# rm -rf /usr/share/nginx/html/*
[root@xxx opt]# cp -r /opt/love-master/* /usr/share/nginx/html/

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>