當(dāng)前位置:首頁 > IT技術(shù) > 系統(tǒng)服務(wù) > 正文

Linux目錄結(jié)構(gòu)01
2021-09-17 19:47:27

Linux里 etcsysconfig == windows里 C:windows

Linux里 oot == windows里 C:windows system32(系統(tǒng)啟動的文件)

png

?

1、/bin:存放系統(tǒng)常用命令

    /usr/bin:在根目錄下點擊/bin目錄會跳轉(zhuǎn)到這個目錄所以根目錄下/bin是它的一個快捷方式 ?根目錄下顯示的/bin目錄就是個快捷方式(以為你很吊結(jié)果就是個備胎)
?
/usr/local/bin:存放安裝的第三方軟件的命令的目錄
?示范:在華為鏡像站下載了個第三方軟件,在用xftp傳輸完下載的文件后etcd、etcdct1,以下是安裝過程
? [root@localhost bin]# chmod +x etcd
? [root@localhost bin]# chmod +x etcdctl
? [root@localhost bin]# ll
? ?total 40544
? ?-rwxr-xr-x. 1 root root 23901760 Sep 17 23:20 etcd
? ?-rwxr-xr-x. 1 root root 17612384 Sep 17 23:20 etcdctl
? [root@localhost bin]# ls
? ?etcd ?etcdctl
? [root@localhost bin]# pwd
/usr/local/bin

2、/boot:系統(tǒng)引導(dǎo)程序+系統(tǒng)內(nèi)核

uname -a查看系統(tǒng)內(nèi)核命令

3、/dev:設(shè)備 光驅(qū) 硬盤

關(guān)于硬件的文件都是在這個目錄中

4、/etc:存放系統(tǒng)或者服務(wù)配置的文件

知識儲備:
ifdown 網(wǎng)卡的名稱:停止網(wǎng)卡
ifup 網(wǎng)卡名稱:開啟網(wǎng)卡
? 網(wǎng)卡地址:
eth0: /etc/sysconfig/network-scripts/ifcfg-eth0
eth1: /etc/sysconfig/network-scripts/ifcfg-eth1

?

5、/home:普通用戶的家目錄

    知識儲備:   
創(chuàng)建用戶:useradd 用戶名
切換用戶:su 用戶名
退出:exit(退出該用戶切換到上一個用戶)

6、/lib:32位操作系統(tǒng)的庫文件目錄

功能一般就是一個庫文件提供的

7、/lib64:64位操作系統(tǒng)的庫文件目錄

8、lost+found:只有在ext文件系統(tǒng)才有,作用就是在斷電或者損壞了,臨時保存文件

選擇文件系統(tǒng)image-20210917160647292

9、/mnt:臨時掛載點目錄

比如插入u盤 掛載點:給設(shè)備提供一個入口

10、/opt:第三方軟件安裝的地方,不過現(xiàn)在一般安裝在/usr/local里

11、/proc:顯示當(dāng)前操作系統(tǒng)運行狀態(tài)的

 ? ?知識儲備:
? 內(nèi)存:free -m
CPU : lscpu

image-20210917161142315

image-20210917161220607

12、/root超級管理員的家目錄

13、/sbin:超級命令,也是快捷方式目錄

image-20210917161658153

14、已經(jīng)沒有/selinux目錄了:都需要修改它,它文件現(xiàn)在在這個目錄/etc/selinux/config

    selinux

禁用selinux :

# 永久關(guān)閉
[root@localhost sbin]$ vim /etc/selinux/config
SELINUX=disabled

# 臨時關(guān)閉
[root@localhost sbin]$ setenforce 0

15、/sys:虛擬目錄,內(nèi)存信息

16、/tmp:臨時文件存放目錄

17、/usr:第三方,還有系統(tǒng)常用命令都在這個目錄

18、/var:存放系統(tǒng)日志

系統(tǒng)日志:/var/log/messages

磁盤

1、增加一塊硬盤

關(guān)機(jī)---》編輯虛擬機(jī)設(shè)置

image-20210917163510086

微信截圖_20210917114659

微信截圖_20210917114725

微信截圖_20210917114731

微信截圖_20210917114743

微信截圖_20210917114748

微信截圖_20210917114809

    知識儲備:

查看硬盤命令:lsblk

2、做磁盤分區(qū)

fdisk 磁盤路徑

?

        [root@www dev]$ fdisk /dev/sdb

Command (m for help): n #選擇指令
Partition type: #分區(qū)類型
? p ? primary (0 primary, 0 extended, 4 free) #主分區(qū)
primary ? ? ?已經(jīng)分過的分區(qū)
extended 已經(jīng)分過的邏輯分區(qū)
free 總共還可以分多少個分區(qū)
? e ? extended #邏輯分區(qū)
Select (default p): #選擇分區(qū)類型
Partition number (1-4, default 1): #選擇分區(qū)的編號
First sector (2048-419430399, default 2048):2048 #分區(qū)開始的桶
Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): +100G #分區(qū)結(jié)束的桶
? ? ? ? ? ?Command (m for help): p
? Device Boot ? ? ?Start ? ? ? ? End ? ? Blocks ? ? ?Id ? ? ? ? ? ? ? ?System
? ?/dev/sdb3 ? ? ? ? ? ?2048 ? 209717247 ? 104857600 ? 83 ? ? ? ? ? ? ? ?Linux
分區(qū)的名稱 開始的桶的編號 ? 結(jié)束的桶的編號 桶的數(shù)量 ? ?當(dāng)前硬盤的編號 ? ? 文件系統(tǒng)
?
指令:
m :幫助信息
n : 新增一個分區(qū)
p : 查看分區(qū)列表
w : 寫入分區(qū)到硬盤

3、格式化文件系統(tǒng)

mkfs.xfs [文件系統(tǒng)分區(qū)的路徑]

    [root@www dev]$ mkfs.xfs /dev/sdb3 
meta-data=/dev/sdb3 ? ? ? ? ? ? ?isize=512 ? ?agcount=4, agsize=6553600 blks
= ? ? ? ? ? ? ? ? ? ? ? sectsz=512 ? attr=2, projid32bit=1
= ? ? ? ? ? ? ? ? ? ? ? crc=1 ? ? ? ?finobt=0, sparse=0
data ? ? = ? ? ? ? ? ? ? ? ? ? ? bsize=4096 ? blocks=26214400, imaxpct=25
= ? ? ? ? ? ? ? ? ? ? ? sunit=0 ? ? ?swidth=0 blks
naming ? =version 2 ? ? ? ? ? ? ?bsize=4096 ? ascii-ci=0 ftype=1
log ? ? =internal log ? ? ? ? ? bsize=4096 ? blocks=12800, version=2
= ? ? ? ? ? ? ? ? ? ? ? sectsz=512 ? sunit=0 blks, lazy-count=1
realtime =none ? ? ? ? ? ? ? ? ? extsz=4096 ? blocks=0, rtextents=0

4、掛載使用

mount [選項(參數(shù),非必須)] [磁盤分區(qū)的路徑] [掛載的路徑]

    mount /dev/sdb3 /mnt

卸載:
umount [掛載的路徑]
umount /mnt

注:卸載文件時,光標(biāo)不能夠在卸載的目錄
[root@www mnt]$ umount /mnt
umount: /mnt: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
[root@www mnt]$ cd
[root@www ~]$ umount /mnt
[root@www ~]$ ls /mnt/
123.txt

?

本文摘自 :https://www.cnblogs.com/

開通會員,享受整站包年服務(wù)立即開通 >