Home  >  Article  >  Computer Tutorials  >  30 commonly used Linux commands summarized at work. If you really can’t remember them, don’t memorize them. Just read this article.

30 commonly used Linux commands summarized at work. If you really can’t remember them, don’t memorize them. Just read this article.

PHPz
PHPzforward
2024-03-26 17:00:25428browse

30 commonly used Linux commands summarized at work. If you really can’t remember them, don’t memorize them. Just read this article.

Write at the beginning

I recently found that my memory has seriously declined. I can’t remember many SQL commands and Linux commands. Especially Linux commands. Many commands have many parameters. If they are not used for a period of time, they need to check them again online. It is very annoying. Why? I spent some time sorting out the Linux commands in my previous notes and summarized 30 commonly used ones to share. Next time I can’t remember them, just read this article.

1. Linux command -ls

ls is the abbreviation of list command, which plays a key role in Linux systems. Through the ls command, users can view the file list in the folder and obtain detailed information about file permissions, directory information, etc. The power of the ls command is that it not only provides a list of file names, but also displays important attributes such as file permissions, owner, size, etc. Therefore, the ls command is one of the important tools for Linux users when browsing file systems. With a simple ls command, users can quickly understand the file system

ls -a 列出目录下所有文件,包含以.开始的隐藏文件
ls -A 列出除.及..的其他文件
ls -r 文件以反序排列
ls -t 文件以修改时间排序
ls -S 文件以大小排序
ls -h 以易读大小显示
ls -l 除了文件名外,还将文件的权限、所有者、文件大小等详细信息显示出来
ls -lhrt 按照易读方式按时间反序排序,并显示文件详细信息
ls -lrS 按大小反序显示文件详细信息
ls -l t* 列出当前目录中所有以“t”开头的目录的详细内容

2. Linux command-cd

Switch directory is the abbreviation of changedirectory

cd / 进入指定的目录
cd ~ 进入home目录
cd - 进入上一次工作路径
cd .. 切换到上一级目录

3. Linux command-pwd

This command is used to view the path of the current working directory, print the abbreviation of work directory

pwd 查看当前目录路径
pwd -P 查看软连接的实际路径

4. Linux command-mkdir

This command is used to create a directory, which is the abbreviation of make directory

mkdir t 当前工作目录下创建名为t的文件夹
mkdir -m 对新建的目录设置权限,当然也可以用chmod命令赋权
mkdir -p 若路径中的某些目录尚不存在,系统会自动创建
mkdir -p /tmp/test/t 在tmp目录下创建路径为test的目录,
在test目录下创建t目录

5. Linux command-rm

rm is the abbreviation of remove, which refers to deleting one or more files or directories in a directory. If the -r option is not used, rm does not delete the directory. If you use rm to delete a file, you can usually still restore the file to its original state.

命令语法:rm [选项] 文件..
rm -f 强制删除,忽略不存在的文件,不给出提示
rm -i 交互式删除,删除前给提示
rm -r 递归删除目录下文件,以及子目录下的文件
rm -i *.log 删除任何.log文件,删除前逐一询问确认
rm -rf test 强制删除test目录或文件,无需确认

6. Linux command-rmdir

rmdir is the abbreviation of remove directory, which refers to deleting an empty directory

rmdir -v 删除时有提示
rmdir -p 如果一个目录和子目录皆为空,则在删除子目录时,父目录一并删除
rmdir -p a/b/c 等同于rmdir a/b/c a/b a

7. Linux command-mv

mv is the abbreviation of move, which refers to moving files and directories. The file or directory name can be modified when moving

命令语法:mv [选项] 源文件或目录 目标文件或目录
mv test.txt test2.txt 将文件test.txt重命名为test2.txt
mv log.txt log2.txt /log 将log.txt、log2.txt文件移动到/log目录中
mv -i log.txt log2.txt 将文件log.txt更名为log2.txt,如果log2.txt已经存在,则询问是否覆盖。
mv -f log.txt log2.txt 将文件log.txt更名为log2.txt,如果log2.txt已经存在,直接覆盖。
mv * ../ 移动当前文件夹下的所有文件到上一级目录

8. Linux command-cp

Copy, copy multiple files or directories to the target directory (without the -i parameter in the shell script, it will be overwritten directly without prompting)

常用指令:
-i 提示
-r 复制目录以及目录内所有的文件
-a 复制的文件与原文件时间一样
cp -ai a.txt test 复制a.txt文件到test目录下,保持原文件时间,如果test目录中已经存在a.txt文件,提示是否覆盖。
cp -s a.txt a_link.txt 为a.txt文件创建一个链接

9. Linux command-cat

Text output command

cat filename 一次显示整个文件
cat > filename 从键盘创建一个文件
cat file1 file2 > file 将几个文件合并为一个文件
-b 对非空输出行号
-n 输出所有行号
cat -n log1.log log2.log 把log1.log的文件内容加上行号后输入到log2.log文件里
cat -b log1.log log2.log log.log 把log1.log和log2.log的文件内容加上行号(空白行不加)附加到log.log里。

10. Linux command-more

Reading command, similar to cat, more will display page by page to facilitate reading page by page. Press the space bar (space) to display the next page, and press the b key to display the page back. .

命令参数:
+n 从第n行开始显示
-n 定义屏幕大小为n行
+/pattern 在每个档案显示前搜寻该(pattern)字符串,然后从该字串前两行之后开始显示
-c 从顶部清屏,然后显示
-s 把连续的多个空行显示为一行
-u 把文件中的下划线去掉

常用的操作命令:
Enter 向下n行,需要定义。默认为1行
Ctrl+F 向下滚动一屏
空格键 向下滚动一屏
Ctrl+B 返回上一屏
= 输出当前行的行号
:f 输出文件名和当前行的行号
!命令 调用shell,并执行命令
q 退出more
more +3 text.txt 显示文件中从第三行起的内容
ls -l | more -5 以每次显示5行数据的量,列出当前目录下的所有文件详细信息

11. Linux command-less

Browse file command, less can browse files at will, less will not load the entire file before viewing it

常用参数:
-i 忽略搜索时的大小写
-N 显示每行行号
-o将less输出的内容在指定的文件中保存起来
-s 显示连续空行为一行
/字符串 向下搜索“字符串”的功能
?字符串 向上搜索“字符串”的功能
-x将tab键显示为规定的数字空格
空格键 滚动一行
回车键 滚动一页
[pagedown] 向下发动一页
[pageup] 向上翻动一页

ps -aux | less -Nps查看进程信息并通过less分页显示,显示行号
less a.log b.log 查看多个文件,可以使用n查看下一个,使用怕p查看前一个

12. Linux command-tail

is used to display the content at the end of the specified file. When no file is specified, it is processed as input information. It is often used to view log files

常用参数:
-f 循环读取(常用于查看程序执行后递增的日志文件)
-n 显示行数(从后向前)
tail -n 100 显示后100行日志文件
tail -f log.log 循环读取日志文件逐渐增加的内容
tail -200f log.log 循环读取日志文件后200行的内容

13. Linux command-head

Display the beginning or end command head is used to display the beginning of the file to the standard output. The default head command prints the first 10 lines of the file

常用参数:
-n显示的行数(行数为复数表示从后向前数)

head a.log -n 20 显示a.log文件中前20行数据
head -c 20 a.log 显示a.log文件前20字节
head -n -10 a.log 显示a.log最后10行数据

14. Linux command-which

This command is rarely used. Its main function is to search for the location of a certain system command in PATH and return the first search result. With the which command, you can see whether a certain system command exists and the location where the command is executed.

which ls查看 ls 命令的执行文件位置

15. Linux command-locate

Search document database command locate to quickly find files by searching the system's built-in document database. The database is updated by the updatedb program. updatedb is periodically called by the cron daemon. The locate command is faster in searching, but it was recently created or renamed. The locate command may not be found. Similar to the find command, you can use regular matching to find

常用参数:
-l num 要显示的行数
-f 将特定的档案系统排除在外
-r 使用正则运算符作为寻找条件

locate pwd 查找文件名中包换pwd的所有文件
locate /etc/sh 搜索etc目录下的所有以sh开头的文件
locate -r '^/var.*txt$' 查找/var目录下,以txt结尾的文件

16. Linux command-find

The search file tree command is used to find files in the file tree and process them accordingly.

命令格式:find pathname -options [-print -exex -ok ...]
命令参数:
pathname:查找的目录路径
 ~表示home目录
 .表示当前目录
 /表示根目录
-print:匹配的文件输出到标准输出
-exec:对匹配的文件执行该参数所给出的shell命令
-ok:和-exec作用相同,不过是以一种更安全的模式来执行该参数所给出的shell命令,在执行每一个命令前,都会给出提示,让用户来确定是都执行。

-options:表示查找方式,如下是其具体选项
-name 按照文件名查找文件
-perm 按照文件权限查找文件
-user 按照文件属主查找文件
-group 按照文件所属的组来查找文件
-type 查找某一类型的文件
b 块设备文件
d 目录
c 字符设备文件
l 符号链接文件
p 管道文件
f 普通文件
-size n :[c] 查找文件长度为n块文件,带有c时表示文件字节大小
-amin n 查找系统中最后n分钟访问的文件
-atime n 查找系统中最后n*24小时访问的文件
-cmin n 查找系统中最后n分钟被改变文件状态的文件
-ctime n 查找系统中最后n*24小时被改变文件状态的文件
-mmin n 查找系统中最后n分钟被改变文件数据的文件
-mtime n 查找系统中最后n*24小时被改变文件数据的文件
-maxdepth n 最大查找目录深度
-prune 选项来指出需要忽略的目录
-newer 查找更改时间比某个文件新,但比另外一个文件旧的所有文件
find . -name '[A-Z]*.txt' -print 在当前目录及子目录中,查找大写字母开头的txt文件 
find . -mtime -2 -type f -print查找两天内被更该过的文件
find . -name 'del.txt' -ok rm {} \; 查找名为del.txt的文件并删除,删除前提示确认
find logs -type f -mtime +5 -exec -ok rm {} \;在 /logs目录中查找更改时间在5日以前的文件并删除它们

17. Linux command-chmod

Used to change the access permissions of Linux system files or directories. This command has two uses: one is a text setting method containing letters and operator expressions; the other is a numeric setting method containing numbers. There are three groups of access permissions for files or directories, each group is represented by a three-digit code:

文件属主的读、写和执行权限
与属主同组的用户的读、写和执行权限
系统中其他用户的读、写和执行权限
常用参数:
-c 当发生改变时,报告处理信息
-R 处理指定目录以及其子目录下的所有文件
权限范围:
u:目录或者文件的当前的用户
g:目录或者文件的当前的群组
o:除了目录或者文件的当前用户或者群组之外的用户
a:所有的用户及群组

权限代号:
r :读权限,用数字4表示
w :写权限,用数字2表示
x :执行权限,用数字1表示
- :删除权限,用数字0表示
s :特殊权限
chmod -R 755 目录名称

18. Linux command-tar

Compressing and decompressing files tar itself does not have a compression function, only a packaging function. Compression and decompression are completed by calling other functions

命令参数:
-c 建立新的压缩文件
-f 指定压缩文件
-r 添加文件到已经压缩文件包中
-u 添加改了和现有的文件到压缩包中
-x 从压缩包中抽取文件
-t 显示压缩文件中的内容
-z 支持gzip压缩
-j 支持bzip2压缩
-Z 支持compress解压文件
-v 显示操作过程

示列:
tar -cvf log.tar 1.log,2.log 将1.log和2.log文件全部打成tar包
tar -zcvf /temp/log.tar.gz /log 将/log下所有文件及目录打包到指定的目录,并使用gz压缩
tar -ztvf /temp/log.tar.gz 查看刚打包的文件内容
tar -zxvf log.tar.gz 解压这个log.tar.gz文件
tar --exclude /log/mylog/ -zcvf /tmp/loglog.tar.gz /log 压缩打包/log,排除/log/mylog

19. Linux command-chown

Change the owner of the specified file to the specified user or group, and the operation permission is the root user

用户可以是用户名或者用户 ID
组可以是组名或者组 ID
文件是以空格分开的要改变权限的文件列表,支持通配符
常用参数:
-c 显示更改部分的信息
-R 处理指定的目录及子目录

chown -c log:log a.txt 改变文件a.txt的拥有者和群组都为log,并显示改变信息
chown -c :log a.txt 改变文件a.txt的群组为log,并显示改变信息
chown -c log a.txt改变文件a.txt的拥有者为log,并显示改变信息
chown -cR log: log/ 改变文件夹log及子文件、目录属主为log

20, Linux command-df

Display disk space usage

获取硬盘被占用空间,剩余空间等信息。默认所有当前被挂载的文件系统的可用空间都会显示
默认情况下,磁盘空间以 1KB 为单位进行显示
常用参数:
-a 全部文件系统列表
-h 以方便阅读的方式显示信息
-i 显示inode信息
-k 区块为1024字节
-l 只显示本地磁盘
-T 列出文件系统类型

21. Linux command-du

is to check the space usage of the directory. Different from the df command, the du command is to check the space used by the files and directory disks

命令格式:du [选项] [文件]
常用参数:
-a 显示目录中所有文件大小
-k 以kb为单位显示文件大小
-m 以MB为单位显示文件大小
-g 以GB为单位显示文件大小
-h 以易读方式显示文件大小
-s 仅显示总计
-c 或 --total 除了显示个别目录或文件大小,同时也显示所有的目录或文件的大小总和

du -ah --max-depth=1显示各个文件夹大小

22. Linux command -ln

Create a synchronized link to the file in another location

The link is divided into:

1.Soft link

软链接,以路径的形式存在。类似于 Windows 操作系统中的快捷方式
软链接可以跨文件系统 ,硬链接不可以
软链接可以对一个不存在的文件名进行链接
软链接可以对目录进行链接

2. Hard link

硬链接,以文件副本的形式存在。但不占用实际空间。
不允许给目录创建硬链接
硬链接只有在同一个文件系统中才能创建

requires attention:

ln 命令会保持每一处链接文件的同步性,也就是说,不论你改动了哪一处,其它的文件都会发生相同的变化
ln 的链接又分软链接和硬链接两种,软链接就是ln –s 源文件 目标文件,它只会在你选定的位置上生成一个文件的镜像,不会占用磁盘空间;硬链接 ln 源文件 目标文件,没有参数 -s, 在指定的位置上生成一个和源文件大小相同的文件,无论是软链接还是硬链接,文件都保持同步变化
ln 指令用在链接文件或目录,如同时指定两个以上的文件或目录,且目标目录已经,则会把前面指定的所有文件或目录复制到该目录中。若同时指定多个文件或目录,且目标目录不存在,则会出现错误信息
常用参数:
-b 删除,覆盖之前建立的链接
-s 软连接
-v 显示详细处理过程
ln -s /usr/local/mysql/bin/mysql /usr/bin 建立一个软链接

23. Linux command-date

Display or set the system date and time

命令参数:
-d显示字符串所指的日期与时间,字符串前后必须加上双引号
-s根据字符串来设置日期与时间,字符串前后必须加上双引号
-u显示GMT
%H 小时(00-23)
%I 小时(00-12)
%M 分钟(以00-59来表示)
%s 总秒数起算时间为1970-01-01 00:00:00 UTC
%S 秒(以本地的惯用法来表示)
%a 星期的缩写
%A 星期的完整名称
%d 日期(以01-31来表示)
%D 日期(含年月日)
%m 月份(以01-12来表示)
%y 年份(以00-99来表示)
%Y 年份(以四位数来表示)

实例:
date +回车 查看系统当前时间
date -s "2018-05-24 16:36:00" 修改当天系统时间为所设置时间
date +%Y%m%d --date="+1 day"//显示下一天的日期
date -d "nov 22" 显示今年的 11 月 22 日
date -d "2 weeks"显示2周后的日期
date -d "next monday"显示下周一的日期
date -d next-day +%Y%m%d 或 date -d tomorrow +%Y%m%d显示明天的日期
date -d last-day +%Y%m%d 或 date -d yesterday +%Y%m%d显示昨天的日期
date -d last-month +%Y%m显示上个月的月份
date -d next-month +%Y%m显示下个月的月份

24, Linux command-cal

Display the Gregorian calendar. There is only one parameter after the command, indicating the year, 1-9999. There are two parameters after the command, indicating the month and year

常用参数:
-3 显示前一个月,当前月,后一个月三个月的日历
-m 显示星期一为第一列
-j 显示当前年第几天
-y [year]显示[year]年份的日历

cal 11 2021 显示2021年11月的日历

25. Linux command-grep

Text search command, grep is the abbreviation of Global Regular Expression Print, global regular expression search grep searches for string templates in one or more files. If the template includes spaces, quotation marks must be used. All strings after the template are regarded as file names, and the search results are sent to the standard output without affecting the original file content.

命令格式:grep [option] pattern file|dir
常用参数:
-A n --after-context显示匹配字符后n行
-B n --before-context显示匹配字符前n行
-C n --context 显示匹配字符前后n行
-c --count 计算符合样式的列数
-i 忽略大小写
-l 只列出文件内容符合指定的样式的文件名称
-f 从文件中读取关键词
-n 显示匹配内容的所在文件中行数
-R 递归查找文件夹

grep 的规则表达式:
^锚定行的开始 如:'^log'匹配所有以 log 开头的行。 
$锚定行的结束 如:'log$'匹配所有以 log 结尾的行。 
.匹配一个非换行符的字符,'l.g' 匹配 l+非换行字符+g,如:log
*匹配零个或多个先前字符 如:'*log' 匹配所有一个或多个空格后紧跟 log 的行
.* 一起用代表任意字符
[] 匹配一个指定范围内的字符,如:'[Ll]og' 匹配 Log 和 log 
[^]匹配一个不在指定范围内的字符,如:'[^A-FH-Z]og' 匹配不包含 A-F 和 H-Z 的一个字母开头,紧跟 log 的行
\(..\) 标记匹配字符,如:'\(log\)',log 被标记为 1
\<锚定单词的开始,如:&#039;\&#039; 匹配包含以 log 结尾的单词的行
x\{m\} 重复字符 x,m 次,如:&#039;a\{5\}&#039; 匹配包含 5 个 a 的行
x\{m,\}重复字符 x,至少 m 次,如:&#039;a\{5,\}&#039; 匹配至少有 5 个 a 的行
x\{m,n\} 重复字符 x,至少 m 次,不多于 n 次,如:&#039;a\{5,10\}&#039; 匹配 5 到 10 个 a 的行
\w 匹配文字和数字字符,也就是[A-Za-z0-9],如:&#039;l\w*g&#039;匹配 l 后跟零个或多个字母或数字字符加上字符 p
\W \w 的取反,匹配一个或多个非单词字符,如 , . &#039; "
\b 单词锁定符,如: &#039;\blog\b&#039; 只匹配 log

grep "text" . -R 在当前目录下递归查找含有“text”内容的文件

26, Linux command-wc

wc(word count), counts the number of bytes, words, and lines in the specified file, and outputs the statistical results

命令参数:
-c 统计字节数
-l 统计行数
-m 统计字符数
-w 统计词数,一个字被定义为由空白、跳格或换行字符分隔的字符串

27, Linux command-ps

ps(process status), used to check the status of the currently running process, one-time viewing, if you need dynamic continuous results, use the top command

There are 5 states of processes in the Linux system:

运行(正在运行或在运行队列中等待)
中断(休眠中, 受阻, 在等待某个条件的形成或接受到信号)
不可中断(收到信号不唤醒和不可运行, 进程必须等待直到有中断发生)
僵死(进程已终止, 但进程描述符存在, 直到父进程调用 wait4() 系统调用后释放)
停止(进程收到 SIGSTOP, SIGSTP, SIGTIN, SIGTOU 信号后停止运行)

ps tool identifies the 5 status codes of the process:

R 运行 runnable
S 中断 sleeping
D 不可中断 uninterruptible sleep
Z 僵死 a defunct process
T 停止 traced or stopped
常用参数:
-A 显示所有进程
-a 显示同一终端下所有进程
-f: full 展示进程详细信息
-e: every 展示所有进程信息
-ax: all 与 -e 同,展示所有进程信息
-o: 设置输出格式, 可以指定需要输出的进程信息列
-L: 展示线程信息
-C: 获取指定命令名的进程信息
-t: tty 展示关联指定 tty 的进程
--forest: 展示进程数
--sort: 按照某个或者某些进程信息列排序展示
a 显示所有进程
c 显示进程真实名称
e 显示环境变量
f 显示进程间的关系
r 显示当前终端运行的进程

-aux 显示所有包含其它使用的进程
-ef显示所有当前进程信息
ps -C bash显示指定名称的进程信息
ps -eLf显示当前系统中的线程信息
ps -ef --forest显示进程树

28, Linux command-top

Display the ID, memory usage, CPU usage and other related information of the process currently being executed by the system

常用参数:
-c 显示完整的进程命令
-s 保密模式
-p指定进程显示
-n循环显示次数

实例:
top - 00:05:02 up 204 days,9:56,2 users,load average: 0.00, 0.01, 0.05
Tasks:68 total, 1 running,67 sleeping, 0 stopped, 0 zombie
%Cpu(s):0.7 us,0.7 sy,0.0 ni, 98.3 id,0.3 wa,0.0 hi,0.0 si,0.0 st
KiB Mem :1016168 total,65948 free, 335736 used, 614484 buff/cache
KiB Swap:0 total,0 free,0 used. 517700 avail Mem 

PID USERPRNIVIRTRESSHR S %CPU %MEM TIME+ COMMAND 
 7110 root10 -10130476 9416 6116 S1.30.9 141:26.59 AliYunDun 
15845 root20 0 47064 4320 2180 S0.30.4 2:51.16 nginx 

前五行是当前系统情况整体的统计信息区

第一行,任务队列信息,同 uptime 命令的执行结果:
00:05:02 — 当前系统时间
up 204 days,9:56 — 系统已经连续运行了 204 天 9 小时 56 分钟未重启
2 users — 当前有 2 个用户登录系统
load average: 0.00, 0.01, 0.05 — load average 后面的三个数分别是 0 分钟、1 分钟、5分钟的负载情况,load average 数据是每隔 5 秒钟检查一次活跃的进程数,然后按特定算法计算出的数值。如果这个数除以逻辑CPU的数量,结果高于5的时候就表明系统在超负荷运转了

第二行,Tasks — 任务(进程):
系统现在共有 68 个进程,其中处于运行中的有 1 个,休眠中 67 个,停止 0 个,僵死 0个

第三行,cpu状态信息:
0.7 us — 用户空间占用 CPU 的百分比
0.7 sy — 内核空间占用 CPU 的百分比
0.0 ni — 改变过优先级的进程占用 CPU 的百分比
98.3 id — 空闲CPU百分比
0.3 wa — IO 等待占用 CPU 的百分比
0.0 hi — 硬中断(Hardware IRQ)占用 CPU 的百分比
0.0 si — 软中断(Software Interrupts)占用 CPU 的百分比
0.0 st - 虚拟机占用百分比


第四行,内存状态:
1016168 total — 物理内存总量
65948 free — 空闲内存总量
335736 used — 使用中的内存总量
614484 buff/cache — 缓存的内存量

第五行,swap交换分区信息,具体信息说明如下:
0 total — 交换区总量
0 free — 空闲交换区总量
0 used — 使用的交换区总量
517700 avail Mem - 可用内存

第七行以下:各进程(任务)的状态监控,项目列信息说明如下:
PID — 进程id
USER — 进程所有者
PR — 进程优先级
NI — nice值。负值表示高优先级,正值表示低优先级
VIRT — 进程使用的虚拟内存总量,单位kb。VIRT=SWAP+RES
RES — 进程使用的、未被换出的物理内存大小,单位kb。RES=CODE+DATA
SHR — 共享内存大小,单位kb
S — 进程状态。D=不可中断的睡眠状态 R=运行 S=睡眠 T=跟踪/停止 Z=僵尸进程
%CPU — 上次更新到现在的CPU时间占用百分比
%MEM — 进程使用的物理内存百分比
TIME+ — 进程使用的CPU时间总计,单位1/100秒
COMMAND — 进程名称(命令名/命令行)

top 交互命令
h 显示top交互命令帮助信息
c 切换显示命令名称和完整命令行
m 以内存使用率排序
P 根据CPU使用百分比大小进行排序
T 根据时间/累计时间进行排序
W 将当前设置写入~/.toprc文件中
o或者O 改变显示项目的顺序

29. Linux command-kill

Delete the executing program or job and send the specified signal to the corresponding process. If no signal is specified, sigterm(15) will be sent to terminate the specified process. Use the '-KILL' parameter to send the signal SIGKILL(9) to force end process

常用参数:
-l 信号,若不加信号的编号参数,会全部列出信号的名称。
-a 当处理当前进程时,不限制命令名和进程号的对应关系
-p 指定kill命令只打印相关进程的进程号,而不发送任何信号
-s 指定发送信号
-u 指定用户

示例:
kill -l 显示信号
kill -KILL 8878 强制杀死进程 8878
kill -9 8878 彻底杀死进程8878
kill -u tomcat 杀死tomcat用户的进程

30, Linux command-free

Display system memory usage, including physical memory, swap memory and kernel cache memory

命令参数:
-b 以Byte显示内存使用情况
-k 以kb为单位显示内存使用情况
-m 以mb为单位显示内存使用情况
-g 以gb 为单位显示内存使用情况
-s持续显示内存
-t 显示内存使用总合

Summarize

The above is the detailed content of 30 commonly used Linux commands summarized at work. If you really can’t remember them, don’t memorize them. Just read this article.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete