Linux系统常用基本工作命令

             《Linux就该这么学》笔记

第二章 新手必须掌握的Linux命令
2.1 强大好用的Shell

2.2 执行查看帮助命令

   1) [root@localhost]#man man  //帮助命令

在这里插入图片描述
2)查看ps帮助命令

 [root@localhost]# man ps | more

2.3常用系统工作命令
1)echo命令 在终端输出字符串货变量提取后的值 格式“echo[字符串|$变量]”

例题1:把字符串“x.com”输出到终端 命令为

 【root@xx】# echo x.com

在这里插入图片描述

例题2:使用$变量方式提取SHELL的值并输出

【root@xx】#  echo $SHELL 

在这里插入图片描述
2)data命令 显示及设置系统的日期和时间,格式“date[选项][+指定的格式]”

实例1:【root@xx】# date   //默认格式显示当前系统时间

在这里插入图片描述

实例2:【root@xx】# date “+%Y-%m-%d %H:%M;%S” //按“年-月日 小时:分钟:秒”查看系统时间

在这里插入图片描述

   实例3:【root@xx】#date -s “20190423 10:53:00”  //设置时间
            【root@xx】#date              //再次查看

在这里插入图片描述

  实例4:【root@xx】#date “+%j”//查看今天是当年第几天

在这里插入图片描述
3)reboot命令 重启系统

【root@xx】# reboot

4)poweroff命令 关闭系统

 【root@xx】#poweroff

5)wget命令 在终端下载网络文件 格式“wget[参数]现在地址”

6)ps命令 查看系统的进程状态 格式“ps[参数]”

【root@xx】#ps -a    //查看所有进程

在这里插入图片描述

  【root@xx】# ps -u     //用户及其它详细信息

在这里插入图片描述

 【root@xx】#ps -x     //显示没有控制终端的进程

在这里插入图片描述

【root@xx】#ps -au  //显示所有进程用户的详细信息

在这里插入图片描述

【root@xx】#ps -aux    

在这里插入图片描述
7)top命令 动态监视进程活动与系统负载信息

【root@xx】# top  

在这里插入图片描述
top后加& 转入后台执行 jobs命令查看后进程的个数ctrl+z 挂起 fg 1 回去

8)pidof 命令 查询某个指定服务进程的PID值

例如:【root@xx】# pidof sshd

在这里插入图片描述
9)kill命令 终止 某个指定PID的服务进程

 【root@xx】#pidof top
【root@xx】#kill 1578
 【root@xx】# pidof sshd   //发现进程以终止

在这里插入图片描述
10)killall命令 终止某个指定名称的服务所对应的全部进程,格式“killall[参数][进程名称]”

 【root@xx】#pidof  httpd
      x   x  x   xx   x
  【root@xx】#killall httpd
  【root@xx】#pidof httpd

猜你喜欢

转载自blog.csdn.net/qq_43615815/article/details/89469535