Linux days often use instructions

Source: Internet
Author: User
Tags gz file

Recently engaged in a Ali Ecs,centos7, involving some basic Linux instructions, here to summarize, in the context of some of the commonly used instructions, familiar with these instructions can basically use CentOS for daily operation.

More can refer to the system comes with "Cammand--help", very practical.

Directory-related Directives
 /*CD instruction * Jump to the XX directory, from the Xshell remote login directory is/root *CD: Return to the previous level directory */ [root  @Lettiy ~]#   cd/usr/local  Span style= "color: #0000ff;" >/*LS displays all files in the current directory */ [root  @Lettiy Local] #   ls  aegis bin etc games include Lib Lib64 libexec sbin share src  

/*mkdir
New, can be a directory, can be a file
*/
[[email protected] ~]# mkdir mytest
[[email protected] ~]# ls
mytest
[[ Email protected] mytest]# mkdir text.txt
[[email protected] mytest]# ls
text.txt
File processing instructions (move, delete, copy <CP basic operations similar to mv>)
/*MV    can be used for renaming or for mobile */[root@Lettiy mytest]#  mv text.txt newname.txt[email Protected] mytest]#  lsnewname.txt[root@Lettiy mytest]#  mv Newname.txt newdir [[email protected] mytest]#  lsnewdir[root@Lettiy mytest]#  cd newdir[[email protected] newdir]#  lsnewname.txt
/*rm used to delete files ordinary delete files with rm-f xx normal directory delete rm-rf xx bulk Delete the same name Rm-v xx* (here * similar to wildcards) */[Root@Lettiy Newdir]#ls new1 new2 new3 new4 newname.txt[root@Lettiy Newdir]#rm-f newname.txt[[email protected] newdir]#ls new1 new2 new3 new4[Root@Lettiy Newdir]#RM-RF new4.txt[[email protected] newdir]#ls New1 new2. NEW3[Root@Lettiy Newdir]#rm-rf-v new*removed directory: ' new1 ' removed directory: ' new2 ' removed directory: ' NEW3 '
File Download and decompression
/*wget    file download    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 ... 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    Unzip the tar.gz file, unzip the rpm file and install    TAR-ZXVF  */

[[email protected] newdir]# ls
Apache-tomcat-7.0.79.tar.gz
[Email protected] 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
......
[[email protected] newdir]# ls
apache-tomcat-7.0.79 apache-tomcat-7.0.79.tar.gz
File installation and uninstallation

CentOS integrated with Yum, configurable source (repository) for installation

/*yum Installing/uninstalling   yum install software
Yum Remove software*/[root@Lettiy newdir]# yum Install PostgreSQL

/* View Yum installable packages that can be used with grep for keyword queries, such as ' Java ' */
[[email protected] newdir] # Yum List
[email protected] newdir]# yum list|grep ' java '
/*rpm   The rpm files just extracted from tar need to be installed using RPM   RPM-IVH
Delete Rpm-e
View already installed rpm-qa*/
[[email protected] newdir] # RPM-IVH software.rpm
File Change/view
/ * File View cat instructions, more instructions, vi instructions can be implemented view * /[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 the change this file unless you know#is 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#Would prevent the need for merging on future updates.Pathmunge () { case": ${path}:" inch*:" $":*)            ;; *)            if[" $"=" After" ] ; Then PATH=$PATH: $            ElsePATH= $:$PATHfi Esac}if[-x/usr/bin/ID]; Thenif[-Z"$EUID" ]; Then#Ksh WorkaroundEuid= '/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 aft Erfihostname= '/usr/bin/hostname 2>/dev/null ' histsize=1000if ["$HISTCONTROL" = "Ignorespace" ] ; Then export histcontrol=ignorebothelse export histcontrol=ignoredupsfiexport PATH USER LOGNAME MAIL HOSTNAME histsiz E histcontrol# By default, we want Umask to get set. This sets it for login shell# current threshold for system reserved Uid/gids are 200# you could check uidgid reservation VA Lidity 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- FPathmungeexport 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   If it is present,   create a new empty file if it does not exist * * If you want to modify, enter press I  , you can enter the insert mode, to change; Save: ESC First, Then enter: Wq: Save exit Q! : Do not save exit is mainly used to modify the configuration file, for example: etc/proflie
Port and Process monitoring common
/*ps Detecting whether the software is running or viewing a running process Ps-ef|grep ' name ' For example: detecting Tomcat health */[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 startroot22647 22470 0 23:58 pts/0 00:00:00 grep--color=auto Tomcat
/*netstat   netstat-tl  View the current TCP listening port   NETSTAT-TLP View the current TCP listening port, need to display the program name of the listener, when it is not clear the MySQL listening port is more useful   netstat -tl | grep 34006    only looks at the listening port of MySQL, the current startup MySQL port is 34006, explicitly know the MySQL listening port when using */
Local File Upload

Need to use Lrzsz
Yum Install Lrzsz
Then use RZ sz to upload the download.

  

Linux days often use instructions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.