First, Software Installation related
QA often needs to install test software (jmeter, Mock, Python environment build, Java Environment build), or configure test environment (Nginx, CI, etc.), need to know how to install software under Linux.
Common Linux software installations at work include: tar, zip, GZ, administrative tool installation, bin, source installation, etc.
(1) tar, zip, GZ type software
STEP1: Get installation address from official website
STEP2: wget + address on the machine, download the package.
STEP3: If it cannot be downloaded due to network and other reasons, it can be downloaded locally and then uploaded to the Linux machine via Xshell
STEP4: Unpack the Package tar extract command TAR-ZXVF packages; Zip extract command unzip
STEP5 directly running the. sh file is ok.
(2) Management tool class
Common example: Debian's apt tool
Apt-get Update//updates source
Apt-get Search Package//1113.www.qixoo.qixoo.com searching for available installation packages
Apt-get Install package/installation software
Apt-get Remove Package//Remove Packages
(3) Source code installation
STEP1: Open shell, get software source code package
STEP2: Yes there is a CD command to enter all directories of source code
STEP3: Unpacking the Package
. tar.gz with Command TAR-ZXVF
. TAR.BZ (or bz2) takes command TAR-JXVF
STEP4:CD into the extracted directory
STEP5: Compile file command./configure
Step6:make compile command: Make
STEP7: Install command: Make install
(4) Bin file installation
STEP1: Add executable permissions to the file. chmod +x
STEP2: Performing a command installation
Second, service process status Related
Sometimes you need to see if the service process is working properly and you need to work on the process to aid the exception test
View basic information for a specified process
Ps-ef | grep Process Name keyword
View the status of all processes
Ps-aux
Pausing a process
Kill-s PID
will continue to perform the paused task
Kill-s PID
Force a process to kill
Kill-s 9 pid
Kill the process
Kill-s PID
Interrupt
Kill-s 2
Exit
Kill-s 3
Third, Text editor vim
Write test scripts, view logs, view configuration files, and deal with vim
Vim is a text editor under the Unix/linux, which generally has two modes: Command mode and edit mode, switch to command mode via ESC, and its commonly used commands are:
(1) Opening and exiting
VI File: Open files
: Q: Exit VI Editor
: Wq: Saving changes to the buffer and exiting the editor
: q!: Do not save direct exit
: W saves buffer contents to the default file
: W file saves buffer contents to file
(2) inserting text
A: Insert text to the right of the current cursor
A: Insert text at the end of the current cursor line
I: Insert text to the left of the current cursor
I: Insert text at the beginning of the line where the cursor is currently located
O: Create a new row below the current line
O: Create a new row above the current line
R: Replaces the current cursor position and several subsequent text
J: Connect the cursor to the row and the next line
(3) Delete text
X: Delete one character
DD: Delete a row
NDD: deleting n rows
U: Undo Last Action
U: Undo all operations on the current line
(4) Search
/word search forward to the first occurrence of word
/Continue searching forward for word
? Word searches backwards for the first occurrence of word
? Continue searching backwards for word
(5) Set line number
: Set NU Displays line numbers on the screen
: Set Nonu Cancel line number
Fourth,linux file system
(1) File system directory configuration for Linux
To follow the FHS specification, the specification defines a level two directory specification as follows:
/home Each account has a folder in the directory for data management
/usr is a directory of Windows program files and Winnt, which mainly includes the main programs of the system, the additional software installed on the local side, the documentation required for the graphics interface, the additional library of functions, the shared directories and files, etc.
/bin/usr/bin/usr/local/bin to store execution commands such as executable instructions
/boot files used to store Linux boot
/dev Store any device and interface device documentation for Linux
/etc Storage System settings documents such as account password files, various services, such as the starting file
Directories placed by libraries used by the/lib/usr/lib/usr/local/lib system
/mnt/media is a floppy disk and a CD-ROM preset mount point place
/OPT Host additional installation software is placed in the directory
/proc This directory is a virtual file system, he placed the data are in memory, so that they do not occupy any hard disk space
/root system Administrator's home directory
/sbin/usr/sbin/usr/local/sbin put some execution instructions that only the system administrator can use
/srv After some services are started, the data directories that these services need to access
/tmp a place where a general user or an executing program temporarily places a file
/var mainly for the system implementation process, the normal changes in the file placement directory
The path to the document is: absolute path (absolute) and relative path (relative).
The absolute path is: The file name or directory name that is written by the root directory (/)
The relative path is a file name that is relative to the current path. /indicates the path relative to the previous level directory, ~ represents the home directory, ~account represents the home directory of the current account)
(2) file system commands
Linux file system in an asynchronous way, the changes to the file will not be written to the disk immediately, you can generally manually use the Sync command for manual data synchronization to disk
(1) Linux can mount many file systems, view commands
Cat/proc/filesystems
(2) View directory usage commands
Df-h//view in G
Df-m//In M view
(3) View file or directory size
Du-sh
(4) Switch commands for directories
Cd..
CD ~
Cd/home
CD./home
(5) Print the current path
Pwd
(6) Create a directory
mkdir (-m parameter can be preset permission-p parameter can be recursively created directory)
(7) Delete directory
RmDir (only empty directories can be deleted)
If the RM-RF command is removed along with the content
(8) Query of documents
Ls-al
(9) Copying of documents
CP src des if you copy the folder, plus the-r parameter
(10) Deletion of files
RM-RF file
(11) Movement of documents
MV File Desdir
(12) Document renaming
MV Desdir Desdir2
(13) Take file name
BaseName
(14) Get path name
DirName
(15) Review of the contents of the document
Cat-n: Display all contents of file,-n means print line number
(16) Retrieval of file contents
Head tail
Head [-N number] File//Display the first number line of file
tail [-N number] File//display ifle after number line
(17) File time
Linux documentation has three time mtime (modification time), Atime (Access Time), CTime (State modification time)
The touch command can be used to create a new document or to modify the time of a Linux document
Search for Linux Documents
Whereis locate (both are direct search database, fast) find (search hard disk, slow, but the most complete data) which (used to search the directory of the execution block $path settings)
which LS
Whereis File//Find the location of file
Locate file//find files in all directories
Find file//View all files in the current directory
(19) Show the difference of two files at a time
Diff-c file1 file2
Displaying differences in two files in a side-by-side way
Diff-y file1 file2
(20) Documentation Links
Soft Connect: The source file disappears and the destination file disappears
Hard connect: One of the modifications, the other is also modified, but the destination file is not deleted when the source file is deleted
In file1 file2//Build File1 link, named File2
In-s file1 file2//Creating a soft connection for file1
Fifth, Other useful commands
(1) View the input history command
History number or Ctrl+r
(2) Get the host's extranet IP command
Curl Ifconfig.me or Curl curlmyip.com
(3) View IP address
Ifconfig
(4) View network connectivity
Ping
(5) View service port connectivity
Telnet IP Port
(6) View service network port
Netstat-ntlp
(7) View the currently used user
W.H.O.
(8) View current host name
Hostname
(9) Regular Expression search
Grep
(10) Switch to root
Sudo-i
(11) Switch to normal user
SU user
(12) exit the current user
Exit
(13) Termination procedure
CTRL + C
(14) Remote Login
SSH hostip-i user-p Port
(15) Sending an HTTP GET request
Curl-v URL
(16) Sending an HTTP POST request
curl-d "param1=value1¶m2=value2" url
(17) Send HTTP PUT request
Curl-v-X PUT url-h
The Linux command to be understood by QA