grep -A 5 can display the matching content and the following 5 lines
grep -B 5 can display the matching content and the previous 5 lines
grep -C 5 can display the matching content and the previous 5 lines
rsync -av --exclude "*.log" ./ [email protected]:/test
Filter out all .log files in the /test directory. very good
The jar package of the startup directory
nohup java -Xmx128m -Xss512k -jar `ls ./ | grep *.jar` --spring.profiles.active=test > java.out 2>&1
Batch modify the content of the same file name in different directories
find ./ -name "application-test.yml" |xargs sed -i "s/address: zookeeper:\/\/172.16.2.231:2181/address: zookeeper:\/\/172.16.2.231:2182/g"
Query the file and copy the file to the file directory
find ./ -name *test.yml | xargs -I {} cp {} {}.cp
Query files and copy files to the current directory
find ./ -name *test.yml | xargs -I {} cp {} ./
and change the name
find ./ -name *test.yml | xargs -I {} cp {} ./{}.cp
Open ports in batches
firewall-cmd --permanent --add-port=5666-8000/tcp
service startup
systemctl
script startup
startup script
/etc/rc.local
rc.local is the soft link of rc/rc.local
Different boot levels for rc1 - cr6.
# Total number of cores = number of physical CPUs X number of cores per physical CPU # Total number of logical CPUs = number of physical CPUs X number of cores per physical CPU X number of hyperthreads # View the number of physical CPUs cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l # View the number of cores in each physical CPU (ie, the number of cores) cat /proc/cpuinfo| grep "cpu cores"| uniq # View the number of logical CPUs cat /proc/cpuinfo| grep "processor"| wc -l View installed software on yum yum info installed
The Linux system to check whether the currently installed system is 32-bit or 64-bit is as follows:
[root@localhost mysql-5.1.57]
# getconf LONG_BIT
64
|
Through the above command, it is easy to see that it is 64-bit. If the result is 32, it is a 32-bit system.
The command to view the Linux version information is as follows:
[root@localhost mysql-5.1.57]
# lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-
4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-
4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.8 (Final)
Release: 5.8
Codename: Final