Linux命令行大全读书笔记

汇总:

  1. date:获取当前系统时间
  2. cal:显示当前日历
  3. df:查看磁盘可用空间:
  4. free:显示可用内存
  5. pwd:查看当前工作目录
  6. ls /usr :查看制定目录的结构
  7. ls /home /usr指定查看多个目录
  8. ls -l 以长格式显示
  9. file:输出对文件的简短描述
  10. Ctrl+A光标移动到行首,Ctrl+E光标移动到行尾,Ctrl+L清屏,与clear相同
  11. vi 模式下,通过/加搜索内容可以在全文搜索
  12. [root@i]$ cat xxx(文件名) |grep -1  '关键字' --color(查看日志中带有该关键字的信息并标红)
  13. vi 状态下,通过/关键字  可以插件所有包含关键字的行 ,:$快速到行尾 :1快速到行首

1.date:获取当前系统时间

[root@i /]# date
Thu May  2 16:51:54 CST 2019

2.cal:显示当前日历

[root@i /]# cal
      May 2019
Su Mo Tu We Th Fr Sa
          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

3.df:查看磁盘可用空间:

[root@i /]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/vda1       41151808 4465916  34572460  12% /
devtmpfs          932240       0    932240   0% /dev
tmpfs             941744       0    941744   0% /dev/shm
tmpfs             941744     428    941316   1% /run
tmpfs             941744       0    941744   0% /sys/fs/cgroup
tmpfs             188352       0    188352   0% /run/user/0

4.free:显示可用内存

[root@i /]# free
              total        used        free      shared  buff/cache   available
Mem:        1883492      406048       78028         428     1399416     1276492
Swap:             0           0           0

5.pwd:查看当前工作目录

[root@i /]# pwd
/

6.ls /usr:查看制定目录的结构(本例中查看/usr下的结构)

[root@i /]# ls /usr
aaa.txt  aba.txt  bin  etc  games  include  lib  lib64  libexec  local  sbin  share  soft  src  tmp

7.ls /home /usr指定查看多个目录 

[root@i /]# ls /home /usr
/home:
hadoop

/usr:
aaa.txt  aba.txt  bin  etc  games  include  lib  lib64  libexec  local  sbin  share  soft  src  tmp

8.ls -l 以长格式显示

[root@izbp1cy1qgs64b6rf329uez /]# ls -l
total 60
lrwxrwxrwx.  1 root root     7 Oct 15  2017 bin -> usr/bin
dr-xr-xr-x.  5 root root  4096 Oct 30  2018 boot
drwxr-xr-x  19 root root  2960 Nov 14 16:28 dev
drwxr-xr-x. 80 root root  4096 Dec 19 23:19 etc
drwxr-xr-x.  3 root root  4096 Nov 14 17:12 home
lrwxrwxrwx.  1 root root     7 Oct 15  2017 lib -> usr/lib
lrwxrwxrwx.  1 root root     9 Oct 15  2017 lib64 -> usr/lib64
drwx------.  2 root root 16384 Oct 15  2017 lost+found
drwxr-xr-x.  2 root root  4096 Nov  5  2016 media
drwxr-xr-x.  2 root root  4096 Nov  5  2016 mnt
drwxr-xr-x.  2 root root  4096 Nov  5  2016 opt
dr-xr-xr-x  78 root root     0 Nov 14 16:28 proc
dr-xr-x---.  5 root root  4096 Feb  2 18:09 root
drwxr-xr-x  22 root root   660 Feb 28 22:33 run
lrwxrwxrwx.  1 root root     8 Oct 15  2017 sbin -> usr/sbin
drwxr-xr-x.  2 root root  4096 Nov  5  2016 srv
dr-xr-xr-x  13 root root     0 Nov 15 00:28 sys
drwxrwxrwt.  9 root root  4096 May  2 03:35 tmp
drwxr-xr-x. 14 root root  4096 Feb 28 21:22 usr
drwxr-xr-x. 19 root root  4096 Oct 15  2017 var

9.file:输出对文件的简短描述

[root@i usr]# file aaa.txt
aaa.txt: ASCII text
[root@i usr]# file bin/
bin/: directory

 11.vi 模式下,通过/加搜索内容可以在全文搜索

whan
dad
f

fg
hfgh

fgh
gfhf
gh


fghfgh

fgh
~
~

~
/fg

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章