Here are some of the common commands used in testing. For Linux and Mac operating systems, it is not specially marked.

View the processes that occupy ports

Linux

aaron@ubuntu:~$ lsof -i :8085 | grep LISTEN
___server 69080 aaron   11u  IPv6 0x5624b7cdebdb6b7b      0t0  TCP *:8085 (LISTEN)
Copy the code

Windows

C: > netstat aon | findstr searches: 80 | findstr searches LISTENING TCP 0.0.0.0:80 0.0.0.0:0 2588 TCP LISTENING [: :] : 80 [: :] : 0 LISTENING 2588Copy the code

Kill the process

Linux

aaron@ubuntu:~$ kill -9 69080
Copy the code

Windows

PS C:\WINDOWS\system32> taskkill /F /PID 8152
SUCCESS: The process with PID 8152 has been terminated.
Copy the code

If you don’t have enough permissions under Windows, you can right click the Start button and start PowerShell in administrator mode.

View processes by name

aaron@ubuntu:~$ ps -ef | grep nginx | grep -v grep
root     21471     1  0  2020 ?        00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 21472 21471  0  2020 ?        00:07:55 nginx: worker process
Copy the code

Run the grep -v grep command to filter out the process.

Command line pipeline

aaron@ubuntu:~$ ps -ef | grep nginx | grep -v grep | awk '{print $2}' | xargs kill -9
Copy the code

Kill the process named nginx using a pipe.

  • Using | pipe, transfer the standard output of the command for the next command’s standard input;
  • Print the second column of the captured line using AWk. The columns are divided by Spaces or Tab symbols.
  • Using xargs, you convert the standard output of the previous command to the arguments of the next command.

Background running service

aaron@ubuntu:~$ nohup appium -p %d --default-capabilities '{"udid":"sn"}' > appium.log 2>&1 &
Copy the code

The appium service runs in the background for the phone with the specified serial number sn.

Modify the file

In the zd.conf file, replace the line starting with Version with Version = 2.0. Linux

Sed -i "s/Version.*/Version = 2.0/" zd.confCopy the code

Mac

Gsed -i "s/Version.*/Version = 2.0/" zd.confCopy the code

Copy directories to remote

SCP -r bin/utl - server / 0.8 / Linux/utl - server 139.224.8.129: ~Copy the code

View file content in real time

Aaron @ ubuntu: ~ $tail -f jmeter. Log the 15:11:51 2021-04-25, 723 INFO O.A.J.P.H.S.H TTPSamplerBase: Parser for text/XML is org, apache jmeter. Protocol. HTTP. Parser. LagartoBasedHtmlParser 15:11:51 2021-04-25, 723 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/VND. Wap. WML is org.. Apache jmeter. Protocol. HTTP. Parser. RegexpHTMLParser 15:11:51 2021-04-25, 723 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/CSS is org, apache jmeter. Protocol. HTTP. Parser. CssParser 15:11:51 2021-04-25, 789 INFO O.a.j.s.ampleresult: Note: Sample TimeStamps are START times 2021-04-25 15:11:51,789 INFO O.A.J.S.Ampleresult: Sampleresult. Default. Encoding is set to ISO - 8859-1 2021-04-25 15:11:51, 789 INFO O.A.J.S.S ampleResult: sampleresult.useNanoTime=trueCopy the code

View the running services

aaron@ngtesting-lab:~$ systemctl | grep apparmor
  apparmor.service.     loaded active exited    LSB: AppArmor initialization
Copy the code

Viewing service Status

aaron@ubuntu:~$service apparatur status ● apparatur. Service-lsb: Apparatur or initialization Loaded: loaded (/etc/init.d/apparmor; bad; vendor preset: enabled) Active: active (exited) since Fri 2021-05-28 09:42:26 CST; 18s ago Docs: man:systemd-sysv-generator(8) Process: 19969 ExecStop=/etc/init.d/apparmor stop (code=exited, status=0/SUCCESS) Process: 20185 ExecStart=/etc/init.d/apparmor start (code=exited, status=0/SUCCESS)Copy the code

Restart the service

aaron@ubuntu:~$ sudo service apparmor restart
Copy the code

Viewing memory Status

aaron@ubuntu:~$free -h total used free shared buff/cache available Mem: 7.8g 2.3g 931M 40M 4.6g 5.2g Swap: 0B 0B 0BCopy the code

Viewing disk Status

aaron@ubuntu:~/ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           799M  3.4M  795M   1% /run
/dev/vda1        40G   33G  4.8G  88% /
tmpfs           3.9G  8.0K  3.9G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           799M     0  799M   0% /run/user/1000
Copy the code

Monitoring system status

aaron@ubuntu:~$top top-09:29:37 up 378 days, 16:35, 1 user, load average: 0.00, 0.00, 0.00 Tasks: 146 total, 1 running, 145 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.2us, 0.1sy, 0.0Ni, 99.8ID, 0.0WA, 0.0Hi, 0.0si, 0.0st KiB Mem: 8174708 total, 953320 free, 2365784 used, 4855604 buff/cache KiB Swap: 0 total, 0 free, 0 used. 5426472 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 14459 root 10 -10 135204 17124 14024 S AliYunDun 956 root 20 0 2428132 92556 16208 S 0.3 1.1 2690:07 Java 3217 999 20 0 90232 7264 3296 S 0.3 0.1 308:04.26 redis serverCopy the code

In Windows, right-click the taskbar and choose Task Manager.