最近搞了一个阿里ECS,CentOS7,涉及到一些基本的Linux指令,在这里总结一下,在搭环境中常用的一些指令,熟悉这些指令就基本能够使用CentOS进行日常操作了。
更多的可以参考系统自带的 “Cammand --help” ,很实用。
目录相关指令
/*cd指令 *跳至到XX目录下,从Xshell远程登陆进去的目录是/root *cd .. 返回上一层目录 */ [root@Lettiy ~]# cd /usr/local /*ls 显示当前目录下的所有文件 */ [root@Lettiy local]# ls aegis bin etc games include lib lib64 libexec sbin share src /*mkdir 新建,可以是目录,可以是文件 */ [root@Lettiy ~]# mkdir mytest [root@Lettiy ~]# ls mytest [root@Lettiy mytest]# mkdir text.txt [root@Lettiy mytest]# ls text.txt
文件处理指令(移动,删除,复制<cp 基本操作类似于mv>)
/*mv 可用于改名、也可用于移动 */ [root@Lettiy mytest]# mv text.txt newname.txt [root@Lettiy mytest]# ls newname.txt [root@Lettiy mytest]# mv newname.txt newdir [root@Lettiy mytest]# ls newdir [root@Lettiy mytest]# cd newdir [root@Lettiy newdir]# ls newname.txt /*rm 用于删除文件 普通删除文件用rm -f xx 普通目录删除 rm -rf xx 批量删除同一名字 rm -v xx* (此处*类似于通配符) */ [root@Lettiy newdir]# ls new1 new2 new3 new4 newname.txt [root@Lettiy newdir]# rm -f newname.txt [root@Lettiy newdir]# ls new1 new2 new3 new4 [root@Lettiy newdir]# rm -rf new4.txt [root@Lettiy newdir]# ls new1 new2. new3 [root@Lettiy newdir]# rm -rf -v new* removed directory: ‘new1' removed directory: ‘new2' removed directory: ‘new3'
文件下载与解压
/*wget 文件下载 wget url即可 */ [root@Lettiy newdir]# wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.79/bin/apache-tomcat-7.0.79.tar.gz --2017-08-13 23:35:56-- http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.79/bin/apache-tomcat-7.0.79.tar.gz Resolving mirrors.hust.edu.cn (mirrors.hust.edu.cn)... 202.114.18.160 Connecting to mirrors.hust.edu.cn (mirrors.hust.edu.cn)|202.114.18.160|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 8975395 (8.6M) [application/octet-stream] Saving to: ‘apache-tomcat-7.0.79.tar.gz 100%[================================================================================>] 8,975,395 19.3KB/s in 4m 36s 2017-08-13 23:40:33 (31.8 KB/s) - ‘apache-tomcat-7.0.79.tar.gz' saved [8975395/8975395] /*tar 对于tar.gz文件进行解压,解压为rpm文件再安装 tar -zxvf */ [root@Lettiy newdir]# ls apache-tomcat-7.0.79.tar.gz [root@Lettiy newdir]# tar -zxvf apache-tomcat-7.0.79.tar.gz apache-tomcat-7.0.79/bin/catalina.sh apache-tomcat-7.0.79/bin/configtest.sh apache-tomcat-7.0.79/bin/daemon.sh apache-tomcat-7.0.79/bin/digest.sh …… [root@Lettiy newdir]# ls apache-tomcat-7.0.79 apache-tomcat-7.0.79.tar.gz
文件安装与卸载
CentOS集成了yum,可配置源(repository)进行安装










