Table of Contents
Part One: Linux Tools" >Part One: Linux Tools
Home System Tutorial LINUX The most important Linux command no one teaches you

The most important Linux command no one teaches you

Feb 11, 2024 pm 03:48 PM
linux linux tutorial linux system linux command shell script Internet problem embeddedlinux Getting started with linux linux learning

Whether you are a sysadmin, developer, DevOps, security professional or operations staff... using Linux and its tools effectively is the most essential skill you can learn. Linux is the backbone of most of the world's servers and applications.

According to Statista: "47% of professional developers use Linux-based operating systems."

In most of the previous articles, you must have read many articles similar to "9 Linux commands you must know" or "Linux Commands Beginner's Guide". I found that almost all of these articles were aimed at beginners, teaching people how to use ls or echo. I believe that most of my readers are familiar with at least the basic commands provided by the Linux command line. This article will no longer be that article.

I will document and present a cheat sheet of commands that I use every day at work. This curated list goes beyond beginner level and focuses on commands that will help you advance further and more efficiently manage your Linux system and its key tools.

This article will be divided into two parts:

  • Linux Tools – Essential Linux tools and how to best utilize them.
  • AdHoc Commands – AdHoc commands can be very useful in emergency situations.

Part One: Linux Tools

(1) Practical tools

1、rsync

Usage examples

$ rsync -vap --ignore-existing  #  Key flags:

v = verbrose, r = recursive, p = preserve permissions, g = group, o = owner, a = archive, -

-progress = progresss bar
Copy after login
没有人教你的最重要的 Linux 命令

Used to copy files and directories to a target location, similar to the cp command. However, it also allows copying to remote locations and can provide a progress bar, often used for backups.

2、mkpasswd

An example is as shown below:

没有人教你的最重要的 Linux 命令

mkpasswd is a simple but very useful command that can generate complex random passwords of a specified length.

3、screen

Usage example:

screen
Copy after login
没有人教你的最重要的 Linux 命令
$ screen # 启动screen 会话

$ screen -ls # 列出正在运行的服务

$ screen -r # 附加到会话
Copy after login
没有人教你的最重要的 Linux 命令

Screen is a full-screen window manager; it creates a single window with a running shell and allows multiple screen windows to be run in a single session. It's most beneficial when you're running a long task remotely and worry about your SSH session disconnecting and breaking everything. Even if the window is not visible to you, Screen will survive the disconnect and continue running your commands.

Related links: Tips on using the terminal multiplexer screen command under Linux https://www.linuxmi.com/linux-screen.html

4、Ldapsearch

Usage example:

$ ldapsearch -x -W -D # Key Flags

-x = simple authentication, -W = prompt for password, -

D = Use distinguished binddn name to bind to LDAP directory
Copy after login

If you frequently use LDAP databases, you must use the Ldapsearch tool. This tool opens a connection to an LDAP server and allows you to search, find, and debug entries in the database.

(2) Monitoring tools

1、Uptime

Uptime Returns metrics about server uptime, current time, number of users, and average memory usage. If there is a problem with the server, this is usually the first information to look at.

没有人教你的最重要的 Linux 命令

‘w’ – yes, only one letter. This is a great combination of running uptime and who commands back to back. $ w

没有人教你的最重要的 Linux 命令

2、Wall

Wall is a handy command for any system administrator; it allows you to send messages to all user terminals currently logged into the system. This is useful for system-wide announcements.

Send message "hi" to every user

linuxmi@linuxmi /home/linuxmi/www.linuxmi.com                              
⚡ wall hi 
Copy after login
没有人教你的最重要的 Linux 命令

3、Top

As shown below:

没有人教你的最重要的 Linux 命令

The Top command can automatically refresh the process list showing CPU and critical memory usage and CPU usage metrics.

4、Ncdu

As shown below:

没有人教你的最重要的 Linux 命令

ncdu 命令可以快速方便地查看磁盘使用情况,让你可以快速轻松地查看哪些目录占用了最多的磁盘空间。

5、lsof

lsof 命令的一个基本目的是列出打开的文件,当出现文件被占用的挂载问题时,这个命令非常有用。它可以快速识别哪些进程正在使用哪些文件。

(三)网络工具

1、Netcat

没有人教你的最重要的 Linux 命令

Netcat 或 nc 主要用于端口扫描,但实际上它是一种很好的网络工具,系统管理员可以在任何任务中使用。Netcat 可以支持端口扫描、文件复制、端口转发、代理服务器和主机服务器等多种功能,可以说它非常多才多艺。

Netcat 非常可定制化,如果您想了解更多,请查看这个链接:https://www.linuxmi.com/linux-netcat.html

2、NetStat

使用示例:

$ netstat -a #列出所有网络端口
$ netstat -tlpn # 列出所有侦听端口# Key Flags
-s = Show statistics, -v = verbrose, -r = show routing tables, -i display interface table, -g = show group memeberships
Copy after login
没有人教你的最重要的 Linux 命令

NetStat 返回各种网络详细信息,如路由表、网络连接、成员、统计数据、标志等。

相关:Linux 下 12 个监视网络连接的 ss 命令示例 https://www.linuxmi.com/linux-ss-command.html

3、Nslookup

使用示例:

$ nslookup www.93139.com/tags/devops# Key Flags
-port = Change port number for connection, -type = Change type of query. -domain = Sets search list to name
Copy after login
没有人教你的最重要的 Linux 命令

Nslookup 是用于获取 Internet 或本地网络上的服务器信息的命令。它查询 DNS 以查找名称服务器信息,并可用于网络调试。

4、TCPDump

没有人教你的最重要的 Linux 命令

TCPDump 用于捕获和分析进出您系统的流量。它是一种强大而多才多艺的工具,专门用于调试和解决网络问题,但也可以用作安全工具。

相关:

  • 如何使用 tcpdump 在 Linux 中捕获网络流量 https://www.linuxmi.com/tcpdump-linux.html
  • Linux 上使用 tcpdump 的 6 个示例 https://www.linuxmi.com/linux-tcpdump-shili.html

OK,这就是本文的内容。如果还有什么疑问,请在下面的评论区告诉我们。

The above is the detailed content of The most important Linux command no one teaches you. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

See all articles