Linux commands
The following are common commands:
View ip command ifconfig
End the current command ctrl + c
Clear screen ctrl + l
List ll ls
cd enter a directory cd …/ return to the parent directory
pwd displays the current directory
mkdir creates a folder
touch creates a file
cat view
cat a.txt | grep abc View files and filter by keywords
echo> input content to the file (overwrite)
echo >> Input content to the file (append)
tail -200f file name dynamic data file last 200 lines
cp copy cannot copy folders, only files
mv move to rename the file if the folder is empty, then the folder will be lost
rm delete rm -rf (force recursive delete)
rm -f can delete files, but not folders
rm -rf Recursive deletion, brute force deletion, can delete any file and folder
When the rm command deletes a folder, there can be no data in it
saw / came
vi file name (open the file and enter the command line mode)
i (click i on the keyboard once) to enter the editing mode for editing
esc After editing, exit the editing mode and enter the command line mode
Execute the command: shift+: start typing the command q! Force exit
Delete a line in command line mode: dd command (tap d on the keyboard twice)
shift+zz save and exit
:wq save and exit
vi search keywords
After vi opens the file, shift+: enter "/keyword" on the command line
tail -200f folder name (dynamic input tomcat log)
tail -300f logs/catalina.out |grep logController (dynamic input tomcat log filtering)
Enter tomcat/bin/
Start./start.sh
Stop./shutdown.sh
ps -ef|grep tomcat(java) View tomcat process pid
ps aux view all process numbers
| Pipeline command
Kill the process kill -9 pid
unzip
tar -xzvf compressed package name
tar -czvf test.tar.gz test //Compress the test file as test.tar.gz
tar -zxvf compressed package name
The following are commonly used authorization commands
scp remote replication
Command format:
scp [parameter] [original path] [target path]
Command function:
scp is the abbreviation of secure copy, scp is a secure remote file copy command based on ssh login under linux system. The scp command of linux can copy files and directories between linux servers.
parameter
-r copy the entire directory recursively
Copy from remote server to local server:
Example 1: Copy files from a remote place to a local directory
command:
scp [email protected]:/opt/soft/nginx-0.5.38.tar.gz /opt/soft/
Description:
Download the nginx-0.5.38.tar.gz file from the /opt/soft/ directory on the 192.168.120.204 machine to the local /opt/soft/ directory
Example 2: Copy a folder from a remote place to the local
command:
scp -r [email protected]:/opt/soft/tomcat /opt/soft/
Description:
Download the tomcat directory from /opt/soft/ on the 192.168.120.204 machine to the local /opt/soft/ directory.
Example 3: Upload local files to the specified directory of the remote machine
command:
scp /opt/soft/nginx-0.5.38.tar.gz [email protected]:/opt/soft/scptest
Description:
Copy the file nginx-0.5.38.tar.gz in the local opt/soft/ directory to the opt/soft/scptest directory of the remote machine 192.168.120.204
Example 4: Upload the local directory to the specified directory on the remote machine
command:
scp -r /opt/soft/ [email protected]:/opt/soft/scptest
tomcat :
Default log file: /soft/apache-tomcat-7.0.90/logs/catalina.out
Project deployment directory: /soft/apache-tomcat-7.0.90/webapps
Configuration file (modify port)/soft/apache-tomcat-7.0.90/conf/server.xml
…
r read 4
w write 写 2
x execute 1
If the permission of the file starts with d, then it proves to be a folder
The group is the user other users
rw- r-- r–
6 4 4
rwx r-x r-x
7 5 5
chomd assigns the highest authority to the file 777
chmod 755 a.txt
rw-r–r--
6 44
r 4 w 2 x 1
rwx r-x r-x
7 5 5
rw- r-- r–
6 4 4
The group is the user other users
rwx rwx rwx
421 421 421
755
rwx
7 5 5
rw
6
Modify the file (a.text) permission to 755
[root@localhost temp1]# ll
total 4
-rwxr-xr-x 1 root root 2 Nov 25 17:42 a.text
[root@localhost temp1]# chmod 755 a.text
chmod file name 777
netstat -lnp View which ports are open in the system
netstat -lnp|grep port number to view which process the port is occupied
top View server CPU memory usage
free
Find file find path-name file name
adb command
adbdevices is used to view linked devices
adbstart-server#Start (generally there is no need to manually execute this command, if you find that adbserver is not
It will be automatically adjusted if it is activated. )
adbkill-server#Stop
adbversion#View adb version number
adbreboot#Restart the phone
Adbpull is used to copy files from mobile devices to PC
Abdpush uses the files on the PC side to copy to the mobile side
The path name of adbinstallapk eg: adbinstalle:\baidu.apk
Reinstall the path name of Install-rapk and keep the original cache
The package name of Adbuninstallapk eg: adbuninstallcom.baidu.searchbox
How to get the package name:
adbshellpmlistpackages get package name
adbshellpmlistpackages-3 Get third-party package name
adbshellpmlistpackages-s system package name
adbshelldumpsysactivityactivitiesadb command to get the current interface Activity
The execution result is: com.baidu.searchbox/.MainActivityt3
adbshelldumpsyscpuinfo to view the CPU usage on the mobile phone
adbshellgetprop|findstrdalvik view the memory usage of the machine (all apps)
adbshelldumpsysmeminfo+package name to view the memory usage of specific apk
adblocat comes and goes to get logs
adblogcat-c clear log
Adblogcat*: W corresponds to printing logs containing W and above
adb-s device name logcat-vtimeprocess>C:/log/aa.txt
Specify one device among multiple devices and print the v-level log and time, and put the log results under the c drive
Android logs are divided into the following levels:
V-Verbose (lowest, most output)
D——Debug
I —— Info
W——Warning
And —— Error
F——Fatal
S-Silent (the highest, nothing is output)
Monkey commonly used commands
Level 0: adb shell monkey -p com.example.login -v 100 // The default value, only provides a small amount of information such as startup prompt, test completion and final result
Level 1: adb shell monkey -p com.example.login -v -v 100 // Provide a more detailed log, including every event information sent to Activity
Level 2: adb shell monkey -p com.example.login -v -v -v 100 // The most detailed log, including selected/unselected activity information in the test
Used to specify the seed value of the pseudo-random number generator. If the seed is the same, the sequence of events generated by the two Monkey tests is also the same. Example:
monkey测试1:adb shell monkey -p com.shjt.map –s 10 100
monkey测试2:adb shell monkey -p com.shjt.map –s 10 100
adb shell monkey -p com.example.login --ignore-crashes --ignore-timeouts --throttle 100 --pct-touch 50 --pct-motion 50 -v -v 1000 >c:\login\c.txt
If the article is helpful to you, please reach out to make a fortune and give me a like. Thank you for your support. Your likes are my motivation for continuous updating.
Finally: benefits
In the technology industry, you must improve your technical skills and enrich your practical experience in automation projects. This will be very helpful for your career planning in the next few years and the depth of your testing technology.
In the interview season of the Golden 9th and the Silver 10th, the job-hopping season, organizing interview questions has become my habit for many years! The following is my collection and sorting in recent years, the whole is organized around [software testing], the main content includes: python automation test exclusive video, Python automation details, a full set of interview questions and other knowledge content.
For software testing friends, it should be the most comprehensive and complete interview preparation warehouse. In order to better organize each module, I also refer to many high-quality blog posts and projects on the Internet, and strive not to miss every knowledge point. Friends relied on these contents to review and got offers from big factories such as BATJ. This warehouse has also helped many learners of software testing, and I hope it can help you too!
May you and I meet and you will find something! Welcome to follow the WeChat public account: [Sad Spicy Article] Receive a 216-page software test engineer interview book for free. And the corresponding video learning tutorials are free to share!
Good article recommendation:
Ali is on the second side, it turns out that my understanding of automated testing is too shallow
Appium automation environment construction
After reading Daniel’s article, I won’t be afraid of slow server response.