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

 

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