Linux common interview questions Day8

Table of contents

1. How to mount the partition?

2. How to kill all processes with the "nginx" field in the Linux system? Please give the detailed command?

3. What is the nature of partitioning? How to view the system partition?

4. What do you think of swap?

5. How to quickly locate the cause of high CPU?

6. How to view the log files of running programs and filter out problematic logs in Linux?

7. What are the common file system formats in Linux?

8. What is SELinux in Linux?


1. How to mount the partition?

The first one: lsblk lists block device information, fdisk disk partitions, mkfs formats partitions, and mounts.

The second type: use graphical interface tools to perform operations such as disk partitioning and mounting, which will be more intuitive and easy to operate.

2. How to kill all processes with the "nginx" field in the Linux system? Please give the detailed command?

The first one: ps -e | grep nginx, kill PID/kill -9 PID

The second type: pkill nginx, pkill -9 Nginx

3. What is the nature of partitioning? How to view the system partition?

Divide the hard drive space into one or more independent parts, which makes data management more flexible and efficient.

lsblk lists block device information, fdisk disk partitions, and df -Th file system space usage.

4. What do you think of swap?

When your desk (memory) cannot hold more things, some rarely used things are moved to the drawer (Swap space).

Swap is like the spare memory of your computer, used to temporarily store some infrequently used data when the physical memory is insufficient.

Swap is a technology used as virtual memory, not a file system format.

5. How to quickly locate the cause of high CPU?

top: Displays the resource usage of each process in the system in real time, including CPU usage, memory usage, etc.

htop: is similar to top, but provides more interactive functions and a more intuitive display, and can be interacted with through keyboard operations.

6. How to view the log files of running programs and filter out problematic logs in Linux?

View the log file using cat: cat /var/log/messages, this will simply display the contents of the entire log file. If the log file is very long, you may need to scroll through it.

Use less for paginated viewing: less /var/log/messages. less allows you to view log files page by page, using arrow keys and other commands to navigate and search the file contents. Press the q key to exit less, press the spacebar to turn pages, and press the b key to turn up the page.

Use tail to view log files: tail /var/log/messages, which is more suitable for viewing and monitoring the latest information of log files, especially when troubleshooting, monitoring application or system status.

7. What are the common file system formats in Linux?

ext4: This is the file system used by most current Linux distributions by default. It provides support for large-capacity files and file systems while having good performance and stability.

ext3: is the predecessor of ext4. It has good backward compatibility and is used by some old systems or scenarios that require stability.

XFS: Suitable for large file systems and high-performance requirements, with high performance, reliability and scalability, suitable for processing large files and high-throughput data.

8. What is SELinux in Linux?

SELinux helps protect the Linux kernel and the entire system from malware, attacks, or unauthorized access. It provides an additional layer of security focused on protecting the kernel and core system components.

Guess you like

Origin blog.csdn.net/m0_67906358/article/details/134934017