The 150 most commonly used commands for Linux operation and maintenance

Online query and help commands (2)

Order

Function Description

man

View the command help, command dictionary, and more complex info , but it is not commonly used.

help

Check the help for built-in Linux commands, such as the cd command.

File and directory operation commands (18)

Order

Function Description

ls

Full spelling list , the function is to list the contents of the directory and its content attribute information.

cd

Full spelling change directory , the function is to switch from the current working directory to the specified working directory.

cp

Full spelling copy , its function is to copy files or directories.

find

Search means, used to search directories and files under directories.

mkdir

Full spelling make directories , its function is to create directories.

mv

Quanpin move , its function is to move or rename files.

pwd

Quanpin print working directory , its function is to display the absolute path of the current working directory.

rename

Used to rename files.

rm

Full spelling remove , its function is to delete one or more files or directories.

is rm

Quanpin remove empty directories , the function is to delete empty directories.

touch

Create a new empty file and change the timestamp attribute of an existing file.

tree

The function is to display the contents of the directory in a tree structure.

basename

Display the file name or directory name.

dirname

Display file or directory path.

chattr

Change the extended attributes of a file.

lsattr

View file extension attributes.

file

Shows the type of file.

I am md5

Calculate and verify the MD5 value of the file.

View file and content processing commands (21)

Order

Function Description

cat

The full spelling of concatenate is to connect multiple files and print to the screen or redirect to a specified file.

tac

tac is the reverse spelling of cat, so the function of the command is to display the file contents in reverse.

more

Display file contents in pages.

less

Display file contents in pages, the opposite usage of the more command.

head

Display the header of the file contents.

tail

Display the end of the file content.

cut

Split each line of the file according to the specified delimiter and output.

split

Split the file into different small fragments.

paste

Merge file contents line by line.

sort

Sort the text content of the file.

unique

Remove duplicate rows. oldboy

wc

Count the number of lines, words, or bytes in a file.

iconv

Convert the encoding format of the file.

dos2unix

Convert DOS format files to UNIX format.

diff

The full spelling is "difference", which is used to compare the differences between files. It is often used for text files.

vimdiff

Command line visual file comparison tool, commonly used for text files.

rev

Reverse output file contents.

grip/egrip

Filter strings, the third of the Three Musketeers.

join

Merge by the same fields of both files.

tr

Replace or delete characters.

vi/vim

Command line text editor.

File compression and decompression commands (4)

Order

Function Description

tar

Packed and compressed. oldboy

unzip

unzip files.

gzip

gzip compression tool.

zip

Compression tool.

Information display commands (11)

Order

Function Description

uname

Command to display operating system related information.

hostname

Display or set the host name of the current system.

dmesg

Displays boot information for diagnosing system faults.

uptime

Display system running time and load.

stat

Displays the status of a file or file system.

of

Calculate disk space usage.

df

Reports file system disk space usage.

top

Real-time display of system resource usage.

free

View system memory.

date

Display and set system time.

cal

View calendar and other time information.

Search file commands (4)

Order

Function Description

which

To search for binary commands, search according to the path of the environment variable PATH.

find

Traverse the disk to find a file or directory.

whereis

To search for binary commands, search according to the path of the environment variable PATH.

locate

从数据库 (/var/lib/mlocate/mlocate.db) 查找命令,使用updatedb更新库。

用户管理命令(10个)

命令

功能说明

useradd

添加用户。

usermod

修改系统已经存在的用户属性。

userdel

删除用户。

groupadd

添加用户组。

passwd

修改用户密码。

chage

修改用户密码有效期限。

id

查看用户的uid,gid及归属的用户组。

su

切换用户身份。

visudo

编辑/etc/sudoers文件的专属命令。

sudo

以另外一个用户身份(默认root用户)执行事先在sudoers文件允许的命令。

基础网络操作命令(11个)

命令

功能说明

telnet

使用TELNET协议远程登录。

ssh

使用SSH加密协议远程登录。

scp

全拼secure copy,用于不同主机之间复制文件。

wget

命令行下载文件。

ping

测试主机之间网络的连通性。

route

显示和设置linux系统的路由表。

ifconfig

查看、配置、启用或禁用网络接口的命令。

ifup

启动网卡。

ifdown

关闭网卡。

netstat

查看网络状态。

ss

查看网络状态。

深入网络操作命令(9个)

命令

功能说明

nmap

网络扫描命令。

lsof

全名list open files,也就是列举系统中已经被打开的文件。

mail

发送和接收邮件。

mutt

邮件管理命令。

nslookup

交互式查询互联网DNS服务器的命令。

dig

查找DNS解析过程。

host

查询DNS的命令。

traceroute

追踪数据传输路由状况。

tcpdump

命令行的抓包工具。

有关磁盘与文件系统的命令(16个)

命令

功能说明

mount

挂载文件系统。

umount

卸载文件系统。

fsck

检查并修复Linux文件系统。

dd

转换或复制文件。

dumpe2fs

导出ext2/ext3/ext4文件系统信息。

dump

ext2/3/4文件系统备份工具。

fdisk

磁盘分区命令,适用于2TB以下磁盘分区。

parted

磁盘分区命令,没有磁盘大小限制,常用于2TB以下磁盘分区。

mkfs

格式化创建Linux文件系统。

partprobe

更新内核的硬盘分区表信息。

e2fsck

检查ext2/ext3/ext4类型文件系统。

mkswap

创建Linux交换分区。

swapon

启用交换分区。

swapoff

关闭交换分区。

sync

将内存缓冲区内的数据写入磁盘。

resize2fs

调整ext2/ext3/ext4文件系统大小。

系统权限及用户授权相关命令(4个)

命令

功能说明

chmod

改变文件或目录权限。

chown

改变文件或目录的属主和属组。

chgrp

更改文件用户组。

umask

显示或设置权限掩码。

查看系统用户登陆信息的命令(7个)

命令

功能说明

whoami

显示当前有效的用户名称,相当于执行id -un命令。

who

显示目前登录系统的用户信息。

w

显示已经登陆系统的用户列表,并显示用户正在执行的指令。

last

显示登入系统的用户。

lastlog

显示系统中所有用户最近一次登录信息。

users

显示当前登录系统的所有用户的用户列表。

finger

查找并显示用户信息。

内置命令及其它(19个)

命令

功能说明

echo

打印变量,或直接输出指定的字符串

printf

将结果格式化输出到标准输出。

rpm

管理rpm包的命令。

yum

自动化简单化地管理rpm包的命令。

watch

周期性的执行给定的命令,并将命令的输出以全屏方式显示。

alias

设置系统别名。

unalias

取消系统别名。

date

查看或设置系统时间。

clear

清除屏幕,简称清屏。

history

查看命令执行的历史纪录。

eject

弹出光驱。

time

计算命令执行时间。

nc

功能强大的网络工具。

xargs

将标准输入转换成命令行参数。

exec

调用并执行指令的命令。

export

设置或者显示环境变量。

unset

删除变量或函数。

type

用于判断另外一个命令是否是内置命令。

bc

命令行科学计算器

系统管理与性能监视命令(9个)

命令

功能说明

chkconfig

管理Linux系统开机启动项。

vmstat

虚拟内存统计。

mpstat

显示各个可用CPU的状态统计。

iostat

统计系统IO。

sar

全面地获取系统的CPU、运行队列、磁盘 I/O、分页(交换区)、内存、 CPU中断和网络等性能数据。

ipcs

用于报告Linux中进程间通信设施的状态,显示的信息包括消息列表、共享内存和信号量的信息。

ipcrm

用来删除一个或更多的消息队列、信号量集或者共享内存标识。

strace

用于诊断、调试Linux用户空间跟踪器。我们用它来监控用户空间进程和内核的交互,比如系统调用、信号传递、进程状态变更等。

ltrace

命令会跟踪进程的库函数调用,它会显现出哪个库函数被调用。

关机/重启/注销和查看系统信息的命令(6个)

命令

功能说明

shutdown

关机。

halt

关机。

poweroff

关闭电源。

logout

退出当前登录的Shell。

exit

退出当前登录的Shell。

Ctrl+d

退出当前登录的Shell的快捷键。

进程管理相关命令(15个)

命令

功能说明

bg

将一个在后台暂停的命令,变成继续执行 (在后台执行)。

fg

将后台中的命令调至前台继续运行。

jobs

查看当前有多少在后台运行的命令。

kill

终止进程。

killall

通过进程名终止进程。

pkill

通过进程名终止进程。

crontab

定时任务命令。

ps

显示进程的快照。

pstree

树形显示进程。

nice/renice

调整程序运行的优先级。

nohup

忽略挂起信号运行指定的命令。

pgrep

查找匹配条件的进程。

runlevel

查看系统当前运行级别。

init

切换运行级别。

service

启动、停止、重新启动和关闭系统服务,还可以显示所有系统服务的当前状态。

Guess you like

Origin blog.csdn.net/2301_77285187/article/details/130946745
Recommended