基本操作命令練習
附上今天的幕布筆記

Day2.png
刪除操作
[wang@VM_16_12_centos test]$ mkdir rm_test
[wang@VM_16_12_centos test]$ cd rm_test/
[wang@VM_16_12_centos rm_test]$ touch huahua.txt
[wang@VM_16_12_centos rm_test]$ ls
huahua.txt
[wang@VM_16_12_centos rm_test]$ rm -I huahua.txt
[wang@VM_16_12_centos rm_test]$ ls
[wang@VM_16_12_centos rm_test]$ pwd
/home/wang/test/rm_test
[wang@VM_16_12_centos rm_test]$ mkdir huahua
[wang@VM_16_12_centos rm_test]$ rmdir huahua
[wang@VM_16_12_centos rm_test]$ ls
[wang@VM_16_12_centos rm_test]$
練習
1.長格式輸出文件信息
ls -l
2.看文件大小
[wang@VM_16_12_centos test]$ ls -lh
total 4.9M
-rw-rw-r-- 1 wang wang 58 May 11 23:58 2.txt
lrwxrwxrwx 1 wang wang 6 May 11 23:56 3.txt -> me.txt
-rw-rw-r-- 1 wang wang 2.6M Jan 11 2017 hg38.tss
-rw-rw-r-- 1 wang wang 0 May 11 23:46 h.txt
-rw-rw-r-- 1 wang wang 141 May 11 21:32 id.gz
-rwxrw-r-- 1 wang wang 148 May 14 12:59 myprog.c
drwxrwxr-x 2 wang wang 4.0K May 23 10:40 rm_test
drwxrwxr-x 3 wang wang 4.0K May 12 17:23 sickle-results
-rw-rw-r-- 1 wang wang 2.3M Oct 6 2016 sickle-results.zip
-rw-rw-r-- 1 wang wang 3.1K May 18 2017 test.bed
-rw-rw-r-- 1 wang wang 12 May 11 20:52 tmp.sh
-rw-rw-r-- 1 wang wang 12 May 11 23:43 you.txt
3.查看系統(tǒng)版本、內(nèi)存、硬盤空間
[wang@VM_16_12_centos ~]$ uname -a
Linux VM_16_12_centos 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[wang@VM_16_12_centos ~]$ free
total used free shared buff/cache available
Mem: 1882192 136536 81664 480 1663992 1557700
Swap: 0 0 0
[wang@VM_16_12_centos ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 909M 0 909M 0% /dev
tmpfs 920M 24K 920M 1% /dev/shm
tmpfs 920M 448K 919M 1% /run
tmpfs 920M 0 920M 0% /sys/fs/cgroup
/dev/vda1 50G 3.9G 44G 9% /
tmpfs 184M 0 184M 0% /run/user/0
4.建立層級目錄及刪除
[wang@VM_16_12_centos xingqiu]$ tree
.
`-- 1
`-- 2
`-- 3
`-- 4
`-- 5
`-- 6
`-- 7
7 directories, 0 files
[wang@VM_16_12_centos xingqiu]$ rm -r 1
[wang@VM_16_12_centos xingqiu]$ tree
.
0 directories, 0 files
linux命令行與shell腳本編程 學習筆記
發(fā)行版
CentOS 一款基于Red Hat企業(yè)版Linux源代碼構(gòu)建的免費發(fā)行版
Ubuntu 一款用于學校和家庭的免費發(fā)行版
什么是shell
- 最底下是計算機硬件,然后硬件被系統(tǒng)核心包住,在系統(tǒng)核心外層的就是shell,然后shell外層的就是我們最容易理解的應用程序,我們平時接觸最多的就是應用程序了。
- shell其實是一個命令解釋器(包裹在系統(tǒng)核心外層,像外殼)
絕對/相對路徑
- 絕對文件路徑
總是以正斜線(/)作為起始,指明虛擬文件系統(tǒng)的根目錄
[wang@VM_16_12_centos ~]$ pwd /home/wang - 相對文件路徑
允許用戶指定一個基于當前位置的目標文件路徑。 相對文件路徑不以代表根目錄的正斜線(/)開頭,而是以目錄名。
~表明位于home目錄下
較常見的Linux頂層虛擬目錄名及其內(nèi)容
來源 Linux命令行與shell腳本編程(第三版)
其他命令
搜索grep
grep -v #反向
grep -n #顯示行號
文本編輯的三駕馬車
grep,awk,sed
