Linux常用指令(一)

从<Linux就该这么学>中,整理了一些常见指令

一.执行查看帮助指令

 man -help   / man -h

qiyang@qiyang-Inspiron-5420:~$ man -help
用法: man [选项...] [章节] 手册页...

  -C, --config-file=文件   使用该用户设置文件
  -d, --debug                输出调试信息
  -D, --default              将所有选项都重置为默认值
      --warnings[=警告]    开启 groff 的警告

 主要运行模式:
  -f, --whatis               等同于 whatis
  -k, --apropos              等同于 apropos
  -K, --global-apropos       search for text in all pages
  -l, --local-file
                             把“手册页”参数当成本地文件名来解读
  -w, --where, --path, --location
                             输出手册页的物理位置
  -W, --where-cat, --location-cat
                             输出 cat 文件的物理位置

  -c, --catman               由 catman 使用,用来对过时的 cat
                             页重新排版
  -R, --recode=编码        output source page encoded in ENCODING

 寻找手册页:
  -L, --locale=区域
                             定义本次手册页搜索所采用的区域设置
  -m, --systems=系统       use manual pages from other systems
  -M, --manpath=路径       设置搜索手册页的路径为“路径”

  -S, -s, --sections=列表  使用以半角冒号分隔的章节列表

  -e, --extension=扩展
                             将搜索限制在扩展类型为“扩展”的手册页之内

  -i, --ignore-case          查找手册页时不区分大小写字母
                             (默认)
  -I, --match-case           查找手册页时区分大小写字母。

      --regex                show all pages matching regex
      --wildcard             show all pages matching wildcard

      --names-only           make --regex and --wildcard match page names only,
                             not descriptions

  -a, --all                  寻找所有匹配的手册页
  -u, --update               强制进行缓存一致性的检查

      --no-subpages          don't try subpages, e.g. 'man foo bar' => 'man
                             foo-bar'

 控制格式化的输出:
  -P, --pager=PAGER          使用 PAGER 程序显示输出文本
  -r, --prompt=字符串     给 less pager 提供一个提示行

  -7, --ascii                显示某些 latin1 字符的 ASCII 翻译形式
  -E, --encoding=编码      use selected output encoding
      --no-hyphenation, --nh turn off hyphenation
      --no-justification,                              --nj   turn off justification
  -p, --preprocessor=字符串   字符串表示要运行哪些预处理器:
                             e - [n]eqn, p - pic, t - tbl,
g - grap, r - refer, v - vgrind

  -t, --troff                使用 groff 对手册页排版
  -T, --troff-device[=设备]   使用 groff 的指定设备

  -H, --html[=浏览器]     使用 www-browser 或指定浏览器显示 HTML
                             输出
  -X, --gxditview[=分辨率]   使用 groff 并通过 gxditview (X11)
                             来显示:
                             -X = -TX75, -X100 = -TX100, -X100-12 = -TX100-12
  -Z, --ditroff              使用 groff 并强制它生成 ditroff

  -?, --help                 显示此帮助列表
      --usage                显示一份简洁的用法信息
  -V, --version              打印程序版本

二.常用系统工作指令

1.echo 用于在终端输出字符串或变量后提取出的值

qiyang@qiyang-Inspiron-5420:~$ echo qiyang
qiyang
qiyang@qiyang-Inspiron-5420:~$ echo $SHELL
/bin/bash

2.date 用于显示及设置系统的时间或日期

qiyang@qiyang-Inspiron-5420:~$ date
2019年 07月 14日 星期日 20:15:40 CST
qiyang@qiyang-Inspiron-5420:~$ date "+%Y-%m-%d %H:%M:%S"
2019-07-14 20:16:07
qiyang@qiyang-Inspiron-5420:~$ date -s "20190714 20:30:00"
date: 无法设置日期: 不允许的操作
2019年 07月 14日 星期日 20:30:00 CST
qiyang@qiyang-Inspiron-5420:~$ su root
密码:
root@qiyang-Inspiron-5420:/home/qiyang# date -s "20190714 20:30:00"
2019年 07月 14日 星期日 20:30:00 CST
root@qiyang-Inspiron-5420:/home/qiyang# date
2019年 07月 14日 星期日 20:30:05 CST

qiyang@qiyang-Inspiron-5420:~$ date "+%j"
195

date命令中的%j可以用来查看今天是当年中的第几天

3.reboot 用于重启系统  涉及硬件系统的管理权限,只能默认只能使用root

4.poweroff 用于关闭系统  涉及硬件系统的管理权限,只能默认只能使用root

5.wget 用于在终端中下载网络文件

qiyang@qiyang-Inspiron-5420:~$ wget http://www.baidu.com
--2019-07-14 20:25:46--  http://www.baidu.com/
正在解析主机 www.baidu.com (www.baidu.com)... 39.156.66.18, 39.156.66.14
正在连接 www.baidu.com (www.baidu.com)|39.156.66.18|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 2381 (2.3K) [text/html]
正在保存至: “index.html”

index.html          100%[===================>]   2.33K  --.-KB/s    in 0s      

2019-07-14 20:25:46 (78.9 MB/s) - 已保存 “index.html” [2381/2381])

6.ps 用于查看系统中的进程状态

qiyang@qiyang-Inspiron-5420:~$ ps ux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
qiyang    1277  0.0  0.0  45248  4652 ?        Ss   19:49   0:00 /lib/systemd/sy
qiyang    1278  0.0  0.0  63472  2112 ?        S    19:49   0:00 (sd-pam)
qiyang    1282  0.0  0.0  48384  4900 ?        Ss   19:49   0:00 /sbin/upstart -
qiyang    1546  0.0  0.0  34668   276 ?        S    19:49   0:00 upstart-udev-br
qiyang    1547  0.2  0.0  44060  4584 ?        Ss   19:49   0:07 dbus-daemon --f
qiyang    1559  0.0  0.1  88092 10040 ?        Ss   19:49   0:00 /usr/lib/x86_64
qiyang    1581  0.0  0.0  34572   300 ?        S    19:49   0:00 upstart-dbus-br
qiyang    1583  0.0  0.0  34572   296 ?        S    19:49   0:01 upstart-dbus-br
qiyang    1585  0.3  1.7 671776 105096 ?       Sl   19:49   0:10 /usr/bin/fcitx
qiyang    1590  0.0  0.0  43196  2212 ?        S    19:49   0:00 upstart-file-br
qiyang    1591  0.0  0.1 354940  8148 ?        SLl  19:49   0:00 gnome-keyring-d
qiyang    1609  0.0  0.4 527520 29272 ?        Ssl  19:49   0:02 /usr/lib/x86_64
qiyang    1633  0.0  0.0  43040  3236 ?        Ss   19:49   0:01 /usr/bin/dbus-d

7.top 用于动态地监视进城活动与系统负载等信息

8.pifod 用于查询某个指定服务进程的PID值

9.kill 用于终止某个指定名称的服务所对应的全部进程

三.系统状态检测指令

1.ifconfig 用于获取网卡配置与网络状态等信息

qiyang@qiyang-Inspiron-5420:~$ ifconfig
enp3s0    Link encap:以太网  硬件地址 84:8f:69:d1:62:44  
          UP BROADCAST MULTICAST  MTU:1500  跃点数:1
          接收数据包:0 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:0 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000 
          接收字节:0 (0.0 B)  发送字节:0 (0.0 B)
          中断:16 

lo        Link encap:本地环回  
          inet 地址:127.0.0.1  掩码:255.0.0.0
          inet6 地址: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  跃点数:1
          接收数据包:1663 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:1663 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1 
          接收字节:186606 (186.6 KB)  发送字节:186606 (186.6 KB)

vmnet1    Link encap:以太网  硬件地址 00:50:56:c0:00:01  
          inet 地址:172.16.74.1  广播:172.16.74.255  掩码:255.255.255.0
          inet6 地址: fe80::250:56ff:fec0:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          接收数据包:0 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:213 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000 
          接收字节:0 (0.0 B)  发送字节:0 (0.0 B)

vmnet8    Link encap:以太网  硬件地址 00:50:56:c0:00:08  
          inet 地址:172.16.157.1  广播:172.16.157.255  掩码:255.255.255.0
          inet6 地址: fe80::250:56ff:fec0:8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          接收数据包:0 错误:0 丢弃:0 过载:0 帧数:0
          发送数据包:214 错误:0 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000 
          接收字节:0 (0.0 B)  发送字节:0 (0.0 B)

wlp2s0    Link encap:以太网  硬件地址 c0:18:85:b7:fa:87  
          inet 地址:192.168.0.103  广播:192.168.0.255  掩码:255.255.255.0
          inet6 地址: fe80::f918:2624:3b9e:8f42/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  跃点数:1
          接收数据包:79453 错误:0 丢弃:0 过载:0 帧数:42697
          发送数据包:56706 错误:536 丢弃:0 过载:0 载波:0
          碰撞:0 发送队列长度:1000 
          接收字节:105316400 (105.3 MB)  发送字节:7064043 (7.0 MB)
          中断:16 

2.uname 用于查看系统内核与系统版本等信息

qiyang@qiyang-Inspiron-5420:~$ uname -a
Linux qiyang-Inspiron-5420 4.4.0-134-generic #160-Ubuntu SMP Wed Aug 15 14:58:00 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

3.uptime 用于查看系统的负载信息

qiyang@qiyang-Inspiron-5420:~$ uptime
 20:49:22 up  1:00,  1 user,  load average: 0.55, 0.52, 0.48

4.free 用于显示当前系统中内存的使用信息

qiyang@qiyang-Inspiron-5420:~$ free -h
              total        used        free      shared  buff/cache   available
Mem:           5.7G        1.4G        2.2G        635M        2.2G        3.4G
Swap:          5.9G          0B        5.9G
qiyang@qiyang-Inspiron-5420:~$ 

5.who 查看当前登入主机的用户终端信息

6.last 查看所有系统的登录记录

7.history 显示历史执行过的命令

8.sosreport 收集系统配置及架构信息并输出诊断文档

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值