Software testing of linux (2)-detailed explanation of advanced commands

Linux advanced commands

File compression/decompression

    zip -r test.zip test: Compress the test folder of the current directory to test.zip

    unzip test.zip: unzip test.zip to the current directory

    tar cvf test.tar.gz test: Compress the test folder to test.tar.gz

    tar xvf test.tar.gz; extract the test.tar.gz package to the current directory

    unzip test.war: Unzip test.war to the current directory

Access control

    chmod +x ./a.txt: Add executable permission x to a.txt in the current directory (used)

    chmod +x ./*: Add executable permissions x to all files in the current directory

    chmod 777 ./a.txt: set the a.txt file to everyone has read/write/execute permissions (commonly used)

    chown root:root ./*; change the owner of all current directory files to the root user of the root group

    chown -R root:root ./*: Change the owner of all current directories and subdirectories to the root user of the root group

File search

    find / -name a.txt: Search a.txt file globally from the root directory and return the full path of the file (commonly used)

    find / -name *test.log: Search for files with the suffix test.log from the /home directory (commonly used)

    find / -amin -10: Find files accessed in the last 10 minutes in the system (access time)

    find / -atime -2: Find files accessed in the last 48 hours in the system

    find / -mmin -5: Find files modified in the last 5 minutes in the system (modify time)

    find / -mtime -1: Find files modified in the last 24 hours in the system

    find / -user fred: Find files belonging to the user fred in the system

    find / -size + 10000c: find files larger than 10000000 bytes (c: bytes, k: KB, M: MB, G; GB)

    find / -size -1000k: Find files smaller than 1000KB

System command

   ip addr: view system ip information

   systemctl restart /start/stop network: network card restart/start/stop

   systemctl stop/start/status firewalld.service: firewall off/on/view status

   ps -ef | grep main.py: view the processes related to main.py in the system (ef: show all processes, grep: filter function, |: pipe, pass the result of the previous command to the next command)

   kill -9 <pid>: Forcibly kill a process through the process number

   history | grep xxx: View the history of linux command execution and filter out the commands containing xxx

   nohup ./config.sh: execute config,sh script in the background

   netstat -anp|grep 8080: View the connections and processes established on port 8080 in the system

Guess you like

Origin blog.csdn.net/qq_37405087/article/details/112993461