小编给大家分享一下Linux中常用指令有哪些,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
目录相关指令
[root@Lettiy ~]# cd /usr/local[root@Lettiy local]# lsaegis bin etc games include lib lib64 libexec sbin share src[root@Lettiy ~]# mkdir mytest[root@Lettiy ~]# lsmytest[root@Lettiy mytest]# mkdir text.txt[root@Lettiy mytest]# lstext.txt
文件处理指令(移动,删除,复制<cp 基本操作类似于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[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'
文件下载与解压
[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][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)进行安装
[root@Lettiy newdir]# yum install postgresql[root@Lettiy newdir]# yum list[root@Lettiy newdir]# yum list|grep 'java'[root@Lettiy newdir]# rpm -ivh software.rpm
文件更改/查看
[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
如果要修改,进入按 I ,即可进入insert模式,进行更改;
保存:先ESC,然后输入:
wq:保存退出
q!:不保存退出
主要用于修改配置文件 ,例如:etc/proflie
端口和进程监控常用
[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
本地文件上传
需利用lrzsz
yum install lrzsz
然后使用rz sz即可上传下载。
以上是“Linux中常用指令有哪些”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注编程网行业资讯频道!