Common CentOS commands
Common commands
- Pwd: view all current paths
- Cd ../go to the root directory
- Restart linux with reboot
- Make compilation command
- PREFIX path specifies the path to which the installation is located
- Ls displays all files or directories in the current directory
- Parameters
- -A: displays all files, including hidden files.
- Ls/directory or file name/view directory or file
- -L displays detailed information about a file or directory.
- -Lh humanized display
- Ip addr
- Vi file name editing specify file I switch to input mode esc switch to command mode: wq save
- Vim file name editing specify file (beautiful format) G cursor move to the bottom g cursor move to the top o next line
- Rename
- Source Path reload the specified path
- Tar-zxvf file name-C decompress to that directory (can be added or not added)
- ./Execution File
Ps-ef | grep tomcat | previous output | subsequent input, and | based on previous output, all output with tomcat keywords
Netstat-antp | grep 58050 queries the process bound to the specified port
- Kill-9 process cancels a specified process
- Pkill-9 java cancels the java Process
CentOs7 graphical interface Installation
- Yum groupinstall "X Window System" (note that there are quotation marks)
- Yum grouplist
- Yum groupinstall "GNOME desktop"
- Startx entry graphical interface
Linux shutdown and restart command (shutdown
- Command Format: shutdown [Option] Time
- Parameters
- C. Cancel the previous shutdown command.
- H Shutdown
- R restart
Mysql
- /Usr/local/mysql/bin/mysqld_safe & MySQL Service Startup
Tomcat Startup Process
- First, go to the bin directory under the tomcat directory.
- ./Startup. sh start tomcat
- ./Startup. sh & tail-f ../logs/catalina. out start tomcat and print logs
Installation Process
- Copy the compressed tomcat file to the specified path.
- Decompress the ZIP file of tomcat to the specified path.
- Go to the conf file in the decompressed path to modify service. xml (configuration file)-can be changed or not-
- The content to be modified includes the port number, defaultHost, and docBase in context (the path to be executed)
- Decompress the war package to the path pointed to by docBase in the context.
- Go to the bin directory under the tomcat directory and run the command to start
Install jdk on CentOS
- First, copy it to the Linux directory.
- Decompress the package using the tar command
- Go to the jdk.7.0 _ 75 directory in the decompressed directory.
- Configure environment traversal by using vim/etc/profile
Install redis on CentOS
1.
Modify file permissions
- Chmod permission file name
- R = 4 w = 2 x = 1
Directory Introduction
/Boot startup directory, which stores startup-Related Files
/Dev device file storage directory
/Etc configuration file storage directory
/Home: home Directory of common users
/Lib system mount directory
/Medla Mount directory
/Root super user's home directory
/Tmp temporary directory
/Proc directly writes data to the memory, Virtual File System
/Sys directly writes data to the memory, Virtual File System
/Var System Documentation
File Format
- | Dr-xr-x. | 4 | root | 4096 | September 20 21:07 | boot |
- | Permission |? | Owner | group | file size | last modification date | directory or file name |
Meaning of drwxr-x-
- 10 in total
- D indicates a directory. If yes, it is a file. If yes, it is a link.
- From 2nd to 10th, No 3 digits are grouped into one group.
- The first group represents the owner's permissions.
- The second group represents the permissions in the group.
- The third group represents the permissions of others.
- The 1st bits in each group indicate the read permission.
- The 2nd bits in each group indicate the write permission.
- The 3rd bits in each group represent the execution permissions.
Directory creation directory: mkdir
- -P recursive creation: create multi-level Directories
Delete a directory or file: rm
- -R: delete a directory.
- -F: Force Delete. No prompt is displayed.
- -Rf forcibly deletes directories and all files
Create File: touch Copy command cp [select] [source file or directory] [target directory]
- -R copy directory
- -P joint file property Replication
- -D if the source file is a linked file, copy the link property.
- -R recursive Replication
- -?
- -Rp copy directory with file attributes
Cut or RENAME command: mv
- Mv [original file or directory] [target directory]
Link command: ln (link)
- Ln-s [source file] [target file] Create soft link
- Ln [source file] [target file] create hard link
- -S: Create a soft link
Hard Link
- With the same I node and storage block, you can think of it as the same file
- Can be identified by I nodes
- Cannot be cross-partition
- Cannot be used for directories
- -Rw-r-| the permission for the hard link is rw-r-
Soft link
- Similar to windows shortcuts
- The soft link has its own I node and block, but the data only saves the file name and I node number of the original file, and there is no actual file data
- Lrwxrwxrwx | all soft link files have permissions for rwxrwxrwx.
- Modify any file and change the other file.
- Delete the original file. The soft link cannot be used.
The important difference between a soft link and a hard link is that if the original file is deleted, the soft link cannot be used. If it is a hard link, the use of the hard link is not affected.
Search for the locate command
- Format: locate file name
- Search by file name in the background database, which is faster
- Only search by file name
- Updatedb updates the database
- Configuration file address:/etc/updatedb. conf
- Install yum-y install mlocate
Find command
Grep command
- String Matching the symbol condition in the file
- Grep [Option] string file name
- Parameter-I ignore case-v exclude specified string
Whereis and whichwhereis
- Command SEARCH Command
- Whereis command name
- SEARCH command path and help document location
Parameters
- -B: only find the executable file location
- -M: Only search for help files
Which
- Which file name search command path and alias
Compression and decompression commands
- Common Format: zip. gz. bz2 .tar.gz .tar.bz2
. Zip compression zip
- To use the zip command, run the [yum-y install zip] command first.
- Compressed file name after zip compression in Command Format
- Parameters
- -R compression directory
- Source directory of File Name After zip-r Compression
Decompress unzip
- To use the unzip command, run the [yum-y install unzip] command first.
- Command Format unzip compressed file
. Gz format compressed gzip _ gunzip
- Command Format gzip Source File compression file name
- If the file is compressed in the format of .gz, the source file disappears.
- Parameters
- -The c file is in the. GZ format and the source file is retained.
- Format: gzip-c source File> compressed file
- -R: It compresses the sub-files in the directory, but cannot compress the directory.
- Format: gzip-r source File> compressed file
Decompress gzip _ gunzip
- Command Format gzip-d compressed file
. Bz2 format compression bzip2
- Command Format bzip2 files to be compressed
- Compressed file in the format of .bz2, the source file will disappear
- Parameters
- -K compression to retain the source file
Decompress bzip2-d
- Command Format: bzip2-d compressed file
- -K: Decompress the package and keep the compressed file.
. Tar format package tar-cvf
- Command Format: tar-cvf package file name source file
- Parameters
- -C Packaging
- -V display process
- -F: Specifies the name of the packaged file.
Decompile tar-xvf
- Command Format: tar-xvf package file name
- Parameters
- -X unpacks
- -V display process
- -F specifies the name of the decompressed File
. Tar.gz format compressed tar-zcvf
- Parameters
- -The z compression format is .tar.gz.
- -C compression to the specified path
- First, compress the file into. tar.gz.
- Command Format: Name source file after tar-zcvf Compression
Decompress tar-zxvf
- Command Format: tar-zxvf decompressed file name
.Tar.bz2 compression tar-jcvf
- First, compress the file into. tar.bz2.
- Command Format: tar-jcvf Compressed Name source file
Decompress tar jxcf
- Command Format: tar-jxcf decompressed File