Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common problems under linux?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail what are the common problems under linux, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

1.user ss is currently user by process 3234

Cause of problem: root-- > ss-- > root stack recursion is the same

Solution: exit exits the current to ss and then exits to root and then executes the command.

two。 List directories under a directory instead of files

Reference: ls-- https://jingyan.baidu.com/article/e8cdb32b100dd537052badc5.html

3. Login user and current user

Whoami current user

Who am i login user

Only with root permission can you default write permission to some non-self-created directories. For example, if you log in to root and switch to an ordinary hu user, you cannot write to the folder under / opt, nor can you write anything under / home/huhu. In fact, you can't get in, and you don't have read permission.

To sum up, the average user can only write under the / home/ current user folder.

The meaning of the following parameters of 4.ll

How to calculate the number of links:

For a file, it's 1.

For directories, empty directories are 2, other folders are added by 1, and other files are not added, which is simply the number of directories inside.

5.ps-aux what each column field represents

Ps-aux (function description: view all processes in the system)

USER: which user generated the process

PID: the ID number of the process

% CPU: the percentage of CPU resources occupied by the process. The higher the consumption, the more resources the process consumes.

% MEM: the percentage of physical memory occupied by the process. The higher the footprint, the more resources the process consumes.

VSZ: the amount of virtual memory occupied by the process (in KB)

RSS: the amount of physical memory occupied by the process (in KB)

TTY: the terminal in which the process is running. Tty1-tty7 represents the local console terminal, tty1-tty6 is the local character interface terminal, and tty7 is the graphics terminal. Pts/0-255represents a virtual terminal.

STAT: process status. The common states are: r: run, S: sleep, T: stop state, s: contains child processes, +: in the background

START: the start time of the process

TIME: this process takes up CPU computing time. Note that it is not system time.

COMMAND: the name of the command that generated this process

6.top command

Ps command: you can view the instantaneous information of the process.

Top command: information about the process can be monitored continuously.

Parameters:

-d seconds: specifies that the top command is updated every few seconds. The default is the command that can be executed in the interactive mode of the top command in 3 seconds:

-I: make top not show any idle or dead processes.

-p: monitor only the status of a process by specifying the monitoring process ID.

-s: make the top command run in safe mode. This removes the potential danger of interactive commands.

Operation options:

P: sort by CPU usage. This is the default.

M: sort by memory usage

N: sort by PID

Q: exit top

7.mount command

If there is a prompt on the second line that it is not mounted, reset it.

Reference: https://www.cnblogs.com/zwgblog/p/5840611.html

8. The home and end buttons on the keyboard can move commands on the Linux side back and forth.

9.rsync-rvlrsync source directory destination directory

Synchronization belongs to incremental synchronization

Switch between 10.centos graphical interface and command line (centos7 is slightly different)

Edit / etc/inittab with administrator privileges

Id:5:initdefault:

Change to

Id:3:initdefault:

Centos7:

1. View the current default startup default

Command: systemctl get-default

Multi-user.target command line mode graphical.target is graphical interface mode

2. Modify as needed

Set to graphical interface mode

Systemctl set-default graphical.target

Set to command line mode

Systemctl set-default multi-user.target

Restart verification

11.linux background running process, and recovery

Please refer to: https://www.cnblogs.com/kex1n/p/7211008.html

Simple version: https://blog.csdn.net/u012317833/article/details/39249395

(1) CTRL+Z suspends the process and puts it into the background

(2) jobs shows the currently paused process

(3) bg% N makes the Nth task run in the background (with a space before%)

(4) fg% N makes the Nth task run in the foreground

The second kind

Screen is convenient to use, and there are several common options:

Use screen-dmS session_name to establish a session in disconnected mode (and specify its session name).

Use screen-list ($screen-ls) to list all sessions.

Use screen-r session_name to reconnect the specified session.

Delete a session with screen-d session_name

Create a session with screen-S session_name

Use the shortcut CTRL+a d to temporarily disconnect the current session.

Question: if the process is being executed, how to get it into the background ctrl + z plus bg

12. [centos7] ifconfig only shows lo loopback. There is no network card, that is, eth-xxx. You need to restart the network card.

Systemctl stop NetworkManager

Systemctl disable NetworkManager

Systemctl restart network

Failure to restart may result in an error:

Job for network.service failed

Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl-xe" for details.

So execution:

Journalctl-xe

Reference: https://blog.csdn.net/weiyongle1996/article/details/75128239

Why can't you call a user program with environment variables like java-version in the script after 13.ssh?

In this case, there is no shell, so the last layer. Bashrc is called in configuration file order. So you can write the data in profile to .bashrc and remember source .bashrc.

14. Resolution of network problems caused by copying centos7

Conflict between NetworkManager and network

Https://www.cnblogs.com/leokale-zz/p/7832576.html

14.linus-centos opens the port outward

1. Turn on the firewall

Systemctl start firewalld

2. Open designated ports

Firewall-cmd-zone=public-add-port=1935/tcp-permanent

Meaning of the command:

-- zone # scope

-- add-port=1935/tcp # add port in the format: Port / communication protocol

-- permanent # is in effect forever. Without this parameter, it will expire after restart.

3. Restart the firewall

Firewall-cmd-reload

4. Check the port number

Netstat-ntlp / / View all current tcp ports

Netstat-ntulp | grep 1935 / / View the usage of all 1935 ports

15. Check the file name where a string exists in the directory

Find. | | xargs grep-ri "tez-0.9.2" |

Big data developer, pay more attention to viewing personal data.

What are the common questions about linux to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report