Linux命令
Linux命令
题目:
-
hostnamectl set-hostname xxx
-
mkdir /project cd /project touch file1.txt file2.txt file3.txt echo "这是第一个测试文件" | sudo tee file1.txt
-
mv /project /home/my_project ll /home/my_project
-
useradd user1 groupadd group1
-
chown user1:group1 /home/my_project/file2.txt chmod 740 /home/my_project/file2.txt
-
df -h /
-
top -b -n 1 | head -12 # 或 ps aux --sort=-%cpu | head -6
-
tar -zcvf /tmp/my_project_files.tar.gz /home/my_project/* tar -zxvf /tmp/my_project_files.tar.gz -C /home/
-
vim /etc/sysconfig/network-scripts/ifcfg-ens33BOOTPROTO=static IPADDR=192.168.100.100 NETMASK=255.255.255.0 GATEWAY=192.168.100.1 DNS1=8.8.8.8systemctl restart network
-
cat > test.sh <<'EOF' #!/bin/bash read -p "请输入数字: " num if [ $num -le 5 ]; thenecho "the number<=5" elif [ $num -gt 5 ] && [ $num -lt 10 ]; thenecho "the number is between 5 and 10" elseecho "the number>=10" fi EOFchmod +x test.sh./test.sh