In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
As Linux is widely used in the server field, there are many open source and mature software. at present, most applications are deployed on linux. Familiar with the Linux operating system and related commands can deepen our understanding of the software architecture and operating mechanism, but also increase our core competitiveness, broaden our skill stack, and get a higher salary.
There are different linux requirements for different job levels. If you are a junior test engineer, you may only need to command to check the log and analyze the reasons for bug. If you are an intermediate engineer, you need to build a variety of test environments in the linux environment, including various applications, application-dependent middleware, and test tools. If you are a senior engineer, you need to optimize the system architecture, write shell scripts, and improve testing efficiency.
Software test engineer linux ten scenarios command to use
1. Log view
View tomcat log files in real time:
Cd / home/tomcat/logs # can also use the relative directory ``tail-f catalina.out # to print log files in real time ``ctrl+c # to exit viewing
View Log command:
Tail-f log.txt: cycle through tai-500f log.txt: view the last 500 lines cat file: view short files less file: view long files head example.txt: display the first ten lines of the file example.txt head-n 20 example.txt: display the first 20 lines of the file example.txt 2. Modify the contents of the configuration file
The most common thing is to modify environment variables.
Vim / etc/profile enter the letter I, enter the content in edit mode, press esc, and enter command mode. Execute: wq, keep the changes. Enter soucre / etc/profile to make the environment variable effective. You can check whether the file has been modified successfully through cat / etc/profile. 3.vi/vim Editor
Vi/vim editor: a text editing tool provided by the linux system for editing text files.
Vim is an enhanced version of vi with some commands added.
How do I get in?
New: enter vi directly
Three modes:
Insert mode: there is a "--INSERT--" tag at the bottom to complete the text editing function.
I: insert text before the current cursor
A: add text after the current cursor
O: insert text on the next line of the current cursor
Command mode: just entered the state, you can achieve the movement of the cursor and characters to delete, copy, paste and so on.
X: delete characters dw/dd: delete words / delete lines yw/yy: copy words, copy lines P: paste kjhl: up and down left and right ctrl+f/b: turn the page
Bottom line mode: enter colon in command mode, you can set line number, find, replace characters, save exit and so on.
Set nu/nonu: set line number w filename: save file wq: save exit Q! Force exit and do not save Edit: open another file in vi.
Vim mode switching
4. View the tomcat process, kill the process, and restart the process.
Check the tomcat process ps-ef/grep tomcat ps-aux/grep tomcat kill process kill-9 process ID ps-ef/grep tomcat# to see if the process has closed the bin directory cd / usr/local/tomcat/bin of tomcat to start tomcat. / startup.sh
5. Compress and decompress the file
Tar cvf a.tar 1.txt 2.txt 3.txt# puts three files into the package a.tar. Tar cvf / tmp/a1.tar * .txt # specifies the location where the package is stored. Tar xvf a.tar# unzips files to the current directory. Tar-zcvf a.tar.gz * .txt # is packaged and compressed into a.tar.gz. Tar-zxvf a.tar.gz# unzips and unpacks.
Parameter description
-c: create a compressed file-x: extract-t: view content-r: add files to the end of the compressed archive-u: update files in the original package-z: with gzip attribute-j: with bz2 attribute-Z: with compress attribute-v: show all procedures-O: unlock files to standard output
6. Upload / download
In x shell, you can upload and download with the following command:
Installation is generally required, you can use yum install lrzsz
Rz: choose to upload files
Sz file name: select the download path
Of course, you can also upload and download visually through the xftp tool.
7. File lookup
Find: real-time search, by traversing the file system hierarchy under the specified starting path, and searching according to the attributes of the file, such as file name, file size, owner, group, whether it is empty, access time, modification time.
Format:
Find...
Examples of combining wildcards and pipe commands are as follows:
Find / etc-name\ * .txt**: in the / etc directory, find the files that end with .txt and give the paths to all files. * find / etc-name'\ * abc\ *': look for files whose names contain the string 'abc'' in the / etc directory. * find /-amin-5: find the files accessed in the last 5 minutes of the system. * find /-mmin-5: find files that have been modified in the last 5 minutes of the system. * find /-size-1000k: find files smaller than 1000KB. * find / etc / grep local look for all files or directories containing the letters local in the / etc directory
8. Move, copy command
Mobile mv
Move the current directory folder AA to / home/aa/
Mv AA/ / home/aa/
Move the current directory file a.txt to the / home/aa/ directory and rename it to b.txt
Mv a.txt / home/aa/b.txt
Copy cp
Copy the current directory file a.txt to the / home/B directory
Cp a.txt / home/B
Copy the folder AA to the / home/B directory
Cp-r AA/ / home/B
Cross-server replication: scp
Command format: scp
Copy files from a distance to the local directory scp root@192.168.1.204:/home/soft/tomcat.tar.gz / home/test/ upload local files to the remote machine specified directory scp / home/test/nginx-0.5.38.tar.gz root@192.168.1.204:/opt/soft/
9. Permission modification
Through the ls-l command, you can view the relevant properties of the file.
Ls-l
First character:-dl
The second to ninth places are the permissions of the file.
There are four kinds of permissions for Linux files:
Read write execute none
The nine bits are divided into three groups:
The first group represents the permissions of owner, the owner of this file.
The second group represents the permissions of all groups group of this file.
The third group represents what permissions others has for other people.
Modify file access permissions:
Chmod who + /-r/w/x file
Chmod Ubunx file only adds executable permissions to itself
Chmod ug+x file owner and group plus executable permissions
Chmod Umurx file user cancels executable permission
Permissions are expressed internally in Linux and are represented by three binary numbers
For example, 000: 0111purl 7
So ringing 4 ~ 4 ~ 2 ~ 2 ~ ~ 1
7 means all permissions are complete. 5 means there is no permission to write.
Suppose owner:rwx,group:r-x,other:r-x
Then the permission is set to: chmod 755 file
10. Server performance monitoring
Monitor CPU, memory
Top: a task manager similar to windows, which can monitor the running status of the system in real time, mainly showing the resource usage of each process in the system, such as cpu, memory, load and so on.
Free: view server memory usage, including idle and remaining statistics for physical memory, swap memory, and kernel buffer memory.
Reprint source: https://www.linuxprobe.com/linuxcommands-for-software.html
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.