国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Linux Shell > 正文

Linux 日常常用指令及應用小結

2020-07-27 18:52:21
字體:
來源:轉載
供稿:網友

最近搞了一個阿里ECS,CentOS7,涉及到一些基本的Linux指令,在這里總結一下,在搭環境中常用的一些指令,熟悉這些指令就基本能夠使用CentOS進行日常操作了。

   更多的可以參考系統自帶的  “Cammand --help” ,很實用。

  目錄相關指令

 /*cd指令  *跳至到XX目錄下,從Xshell遠程登陸進去的目錄是/root *cd .. 返回上一層目錄 */[root@Lettiy ~]# cd /usr/local/*ls 顯示當前目錄下的所有文件*/[root@Lettiy local]# lsaegis bin etc games include lib lib64 libexec sbin share src/*mkdir  新建,可以是目錄,可以是文件*/[root@Lettiy ~]# mkdir mytest[root@Lettiy ~]# lsmytest[root@Lettiy mytest]# mkdir text.txt[root@Lettiy mytest]# lstext.txt

  文件處理指令(移動,刪除,復制<cp 基本操作類似于mv>)

/*mv 可用于改名、也可用于移動*/[root@Lettiy mytest]# mv text.txt newname.txt[root@Lettiy mytest]# lsnewname.txt[root@Lettiy mytest]# mv newname.txt newdir[root@Lettiy mytest]# lsnewdir[root@Lettiy mytest]# cd newdir[root@Lettiy newdir]# lsnewname.txt/*rm 用于刪除文件 普通刪除文件用rm -f xx 普通目錄刪除 rm -rf xx 批量刪除同一名字 rm -v xx* (此處*類似于通配符)*/[root@Lettiy newdir]# lsnew1 new2 new3 new4 newname.txt[root@Lettiy newdir]# rm -f newname.txt[root@Lettiy newdir]# lsnew1 new2 new3 new4[root@Lettiy newdir]# rm -rf new4.txt[root@Lettiy newdir]# lsnew1 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.gzResolving mirrors.hust.edu.cn (mirrors.hust.edu.cn)... 202.114.18.160Connecting to mirrors.hust.edu.cn (mirrors.hust.edu.cn)|202.114.18.160|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 8975395 (8.6M) [application/octet-stream]Saving to: ‘apache-tomcat-7.0.79.tar.gz100%[================================================================================>] 8,975,395 19.3KB/s in 4m 36s2017-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]# lsapache-tomcat-7.0.79.tar.gz[root@Lettiy newdir]# tar -zxvf apache-tomcat-7.0.79.tar.gzapache-tomcat-7.0.79/bin/catalina.shapache-tomcat-7.0.79/bin/configtest.shapache-tomcat-7.0.79/bin/daemon.shapache-tomcat-7.0.79/bin/digest.sh……[root@Lettiy newdir]# lsapache-tomcat-7.0.79 apache-tomcat-7.0.79.tar.gz

文件安裝與卸載

CentOS集成了yum,可配置源(repository)進行安裝

/*yum 安裝/卸載 yum install software yum remove software*/[root@Lettiy newdir]# yum install postgresql/*查看yum可安裝的軟件包,可配合grep進行關鍵字查詢,例如‘java'*/[root@Lettiy newdir]# yum list[root@Lettiy newdir]# yum list|grep 'java'/*rpm 剛剛解壓tar得到的rpm文件則需要使用rpm 安裝rpm -ivh 刪除rpm -e 查看已經安裝rpm -qa*/[root@Lettiy newdir]# rpm -ivh software.rpm

  文件更改/查看

/*文件查看 cat指令、more指令、vi指令三者都可以實現查看*/[root@Lettiy newdir]# cat /etc/profile# /etc/profile# System wide environment and startup programs, for login setup# Functions and aliases go in /etc/bashrc# It's NOT a good idea to change this file unless you know what you# are doing. It's much better to create a custom.sh shell script in# /etc/profile.d/ to make custom changes to your environment, as this# will prevent the need for merging in future updates.pathmunge () { case ":${PATH}:" in  *:"$1":*)   ;;  *)   if [ "$2" = "after" ] ; then    PATH=$PATH:$1   else    PATH=$1:$PATH   fi esac}if [ -x /usr/bin/id ]; then if [ -z "$EUID" ]; then  # ksh workaround  EUID=`/usr/bin/id -u`  UID=`/usr/bin/id -ru` fi USER="`/usr/bin/id -un`" LOGNAME=$USER MAIL="/var/spool/mail/$USER"fi# Path manipulationif [ "$EUID" = "0" ]; then pathmunge /usr/sbin pathmunge /usr/local/sbinelse pathmunge /usr/local/sbin after pathmunge /usr/sbin afterfiHOSTNAME=`/usr/bin/hostname 2>/dev/null`HISTSIZE=1000if [ "$HISTCONTROL" = "ignorespace" ] ; then export HISTCONTROL=ignorebothelse export HISTCONTROL=ignoredupsfiexport PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL# By default, we want umask to get set. This sets it for login shell# Current threshold for system reserved uid/gids is 200# You could check uidgid reservation validity in# /usr/share/doc/setup-*/uidgid fileif [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then umask 002else umask 022fifor i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then  if [ "${-#*i}" != "$-" ]; then    . "$i"  else   . "$i" >/dev/null  fi fidoneunset iunset -f pathmungeexport JAVA_HOME=/usr/develop/java/jdk1.8.0_144export PATH=$JAVA_HOME/bin/:$PATHexport CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jarexport CATALINA_HOME=/usr/develop/tomcat/apache-tomcat-8.5.20/*vi vi directory 如果目錄下存在則打開 如果不存在則新建一個空文件 */

如果要修改,進入按 I  ,即可進入insert模式,進行更改;

保存:先ESC,然后輸入:

wq:保存退出

q!:不保存退出

主要用于修改配置文件 ,例如:etc/proflie

 端口和進程監控常用

/*ps  檢測軟件是否運行  或查看正在運行的進程  ps -ef|grep 'name'   例如:檢測tomcat的運行狀況*/[root@Lettiy newdir]# ps -ef|grep 'tomcat'root   19785   1 0 Aug12 ?    00:01:05 /usr/develop/java/jdk1.8.0_144/bin/java -Djava.util.logging.config.file=/usr/develop/tomcat/apache-tomcat-8.5.20/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -classpath /usr/develop/tomcat/apache-tomcat-8.5.20/bin/bootstrap.jar:/usr/develop/tomcat/apache-tomcat-8.5.20/bin/tomcat-juli.jar -Dcatalina.base=/usr/develop/tomcat/apache-tomcat-8.5.20 -Dcatalina.home=/usr/develop/tomcat/apache-tomcat-8.5.20 -Djava.io.tmpdir=/usr/develop/tomcat/apache-tomcat-8.5.20/temp org.apache.catalina.startup.Bootstrap startroot   22647 22470 0 23:58 pts/0  00:00:00 grep --color=auto tomcat/*netstat  netstat -tl 查看當前tcp監聽端口  netstat -tlp 查看當前tcp監聽端口, 需要顯示監聽的程序名,當不清楚mysql的監聽端口時比較好用  netstat -tl | grep 34006  只查看mysql的監聽端口,當前啟動的mysql端口為34006,明確知道mysql監聽端口時使用*/

本地文件上傳 

   需利用lrzsz

  yum install lrzsz

   然后使用rz sz即可上傳下載。

總結

以上所述是小編給大家介紹的Linux 日常常用指令及應用小結,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 北川| 黄大仙区| 泊头市| 洛宁县| 荃湾区| 白城市| 吉林市| 宣汉县| 台山市| 报价| 漳平市| 阿巴嘎旗| 靖西县| 渑池县| 得荣县| 曲阜市| 称多县| 昌宁县| 田林县| 安新县| 棋牌| 九龙坡区| 沙坪坝区| 通河县| 阿图什市| 隆德县| 古田县| 双江| 托克逊县| 台江县| 梁平县| 宜兰市| 通化市| 科技| 色达县| 常熟市| 金昌市| 丰城市| 左云县| 开平市| 株洲县|