Take a few common requirements in work to test your Linux level

A former Tencent engineer, he has experience in big factories and entrepreneurship!
I'm four years old, but I'm still learning and growing!
I am very happy to share my experience and thoughts with you!
I am A Ming, follow me, and grow up to be a master of technology with me!

↓↓↓↓↓

The latest "Operation and Maintenance Architect" training camp started on the 13th of last month, exactly one month has passed, and every few days I will give you a few small requirements to test the learning effect. Below, I will send out the demand from this month for your reference.

1. Examine files, directories, users, and permissions

1) Create directory /data/test/linux;

2) Copy the /etc/fstab file to /data/test, and rename it to aming.txt;

3) Copy the /etc/ssh directory to /data/test;

4) Move the /data/test/ssh directory to /data/test/linux;

5) Create an empty file linux.txt in the /data/test/ssh directory;

6) Create a common user user1;

7) Change the /data/test directory and all the files and directories below so that the owner is user1, and the group it belongs to remains unchanged (should be root);

8) Find all the files in the /data/test directory, and modify the permissions to read and write by the owner but not execute, and the group and other users cannot read, write and execute;

9) Set a sudo rule for user1, which has root user privileges for the following commands: ls, mv, cp, mkdir, sh;

2. Investigate users and disks

Requirement 1: For user user1, the default shell is /bin/bash, change it to /sbin/nologin, and test whether it is possible to execute a command (touch /tmp/user1.txt) as user1 under the root user.

Requirement 2: Assume that the current system/partition occupies 90% of the disk, then please analyze which directory occupies the most.

Requirement 3: Add a new hard disk, and then directly format the disk as an xfs file system. Note that no partition is required.

3. Investigate disk expansion

Requirement: The server disk space is not enough, and a disk /dev/sdd is added, and then the disk space needs to be added to the existing LVM.

The expansion target vg and lv are as follows: vg: centos, lv: root

4. Investigate compression and packaging

Requirements: There is a directory /data/wwwroot/www.test.com on the server, which needs to be packaged and compressed. Requirements, the packaged compressed package file name is www_test_com.tar.gz, and put it in the /data/wwwroot directory.

As a reminder, if you encounter such a demand in the future, you must ensure that the remaining space in the directory where the compressed package is stored is large enough. How do you estimate it? In fact, just look at the size of all the files in the directory before compression.

5. Check rpm and yum

Requirement 1: I want to check which rpm package installed a command. For example, if you want to use the netstat command, please find a way to find the rpm package corresponding to this command and install it.

Requirement 2: Use yum to download a certain rpm package and its dependent packages. The purpose is to make an offline package and combine it with shell scripts for automatic deployment. As for how to make offline packages and how to write scripts, you don’t need to worry about it at this stage, you just need to download the rpm package.

The name of the specific package: java-11-openjdk.x86_64

Requirement 3: Make a yum warehouse on the intranet. This requirement is also very common, so let me demonstrate it to you this Thursday. Of course, you'd better do it yourself in advance. Refer to http://blog.yuankeedu.com/?p=500

6. Investigate the basics of shell

Requirement 1: We installed the software under /usr/local/, for example, installed mysql to /usr/local/mysql, so how can we directly type the mysql command? (environment variable PATH)

Requirement 2: There is a very large log file that I forgot to archive. When we found it, it was already more than 10G. Now we need to analyze the log of the last day. How to cut this large log file? Assume that the daily log volume is about 100M. (use split)

7. Investigate the three regular musketeers

1) Find out if there is a package called zsh in the yum warehouse under the current system?

2) Give you a configuration file /etc/aming/aming.conf, there are too many commented out by # in this configuration file, and there are many empty lines, now I only want to see the contents of the uncommented and non-empty lines How to do?

3) Encountered a requirement, I want to find whether the keyword 'aming' has appeared in a directory /usr/local/.

4) Before closing selinux, we manually modified the configuration file /etc/selinux/config, so how to use the sed command to modify it automatically?

5) The slow.log (/data/mysql/slow.log) of a MySQL server has not been cut, and currently has 2G. It is a bit slow to view the log, so I want to quickly delete the first 10 million lines of the log. How to use sed implementation?

6) Assuming that the first paragraph of the log /data/logs/nginx/access.log is the client IP address, please analyze the top 10 most visited IPs in the log.

Guess you like

Origin blog.csdn.net/am_Linux/article/details/129633804