您好,登錄后才能下訂單哦!
如何分析Linux系統(tǒng)中的目錄結(jié)構(gòu),針對(duì)這個(gè)問題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡(jiǎn)單易行的方法。
在Linux系統(tǒng)中所有文件和目錄都是以“/”節(jié)點(diǎn)為基礎(chǔ)的樹形結(jié)構(gòu),這和Windows有很大的差別,
/ 根分區(qū),只有root用戶對(duì)此目錄擁有寫權(quán)限。
/etc 配置文件
/boot 啟動(dòng)文件
/var 可增長(zhǎng)的目錄 。日志,文件等。
/root 管理員所有數(shù)據(jù) root用戶的家目錄。
/tmp 臨時(shí)文件 (大概15天清空一次。)
/usr unix software source /usr/src 源代碼目錄。/usr/local 自己的軟件安裝位置。
/bin 命令 二進(jìn)制可執(zhí)行文件。
/sbin 系統(tǒng)命令。
/mnt 掛載目錄。
/dev 設(shè)備文件。 一切皆文件,終端,磁盤等。鍵盤,鼠標(biāo)等。
/home 普通用戶文件存放位置。
/proc 虛擬目錄。可以查看每個(gè)進(jìn)程的情況。
/lib 存放系統(tǒng)的庫文件(動(dòng)態(tài)庫,靜態(tài)庫。 .a靜態(tài)庫,.so動(dòng)態(tài)庫)。類似于.dll文件。
絕對(duì)路徑是從/ 開始的。
相對(duì)路徑是以. .. 開始的。
touch a.txt
創(chuàng)建一個(gè)文件
mkdir test
創(chuàng)建一個(gè)目錄
[root@local ~]# cat a.txt hello linux
查看文件
[root@local ~]# less /var/log/messages
less 可以上下左右查看。enter,空格都是下一頁。q退出查看。
[root@local ~]# more /var/log/messages
more只能向下翻頁查看。
[root@local ~]# cat /var/log/messages
cat一次性展示所有內(nèi)容。
[root@local ~]# tail -n 10 /var/log/messages Jan 5 15:30:01 local systemd: Started Session 14 of user root. Jan 5 15:30:01 local systemd: Starting Session 14 of user root. Jan 5 15:40:01 local systemd: Started Session 15 of user root. Jan 5 15:40:01 local systemd: Starting Session 15 of user root. Jan 5 15:50:01 local systemd: Started Session 16 of user root. Jan 5 15:50:01 local systemd: Starting Session 16 of user root. Jan 5 16:00:01 local systemd: Started Session 17 of user root. Jan 5 16:00:01 local systemd: Starting Session 17 of user root. Jan 5 16:01:01 local systemd: Started Session 18 of user root. Jan 5 16:01:01 local systemd: Starting Session 18 of user root.
tail 最后多少行。
[root@local ~]# head -n 10 /var/log/messages Jan 2 16:17:58 local rsyslogd: [origin software="rsyslogd" swVersion="7.4.7" x-pid="887" x-info="http://www.rsyslog.com"] start Jan 2 16:17:47 local journal: Runtime journal is using 8.0M (max allowed 99.2M, trying to leave 148.9M free of 984.9M available → current limit 99.2M). Jan 2 16:17:47 local journal: Runtime journal is using 8.0M (max allowed 99.2M, trying to leave 148.9M free of 984.9M available → current limit 99.2M). Jan 2 16:17:47 local kernel: Initializing cgroup subsys cpuset Jan 2 16:17:47 local kernel: Initializing cgroup subsys cpu Jan 2 16:17:47 local kernel: Initializing cgroup subsys cpuacct Jan 2 16:17:47 local kernel: Linux version 3.10.0-327.el7.x86_64 (mockbuild@x86-034.build.eng.bos.redhat.com) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Oct 29 17:29:29 EDT 2015 Jan 2 16:17:47 local kernel: Command line: BOOT_IMAGE=/vmlinuz-3.10.0-327.el7.x86_64 root=UUID=87b51ffa-2f57-4ac2-99e7-e491bb257520 ro rhgb quiet LANG=zh_CN.UTF-8 Jan 2 16:17:47 local kernel: Disabled fast string operations Jan 2 16:17:47 local kernel: e820: BIOS-provided physical RAM map:
head 開頭多少行。
[root@local ~]# tail -f -n 10 /var/log/messages Jan 5 15:30:01 local systemd: Started Session 14 of user root. Jan 5 15:30:01 local systemd: Starting Session 14 of user root. Jan 5 15:40:01 local systemd: Started Session 15 of user root. Jan 5 15:40:01 local systemd: Starting Session 15 of user root. Jan 5 15:50:01 local systemd: Started Session 16 of user root. Jan 5 15:50:01 local systemd: Starting Session 16 of user root. Jan 5 16:00:01 local systemd: Started Session 17 of user root. Jan 5 16:00:01 local systemd: Starting Session 17 of user root. Jan 5 16:01:01 local systemd: Started Session 18 of user root. Jan 5 16:01:01 local systemd: Starting Session 18 of user root. Jan 5 16:03:51 local systemd-logind: New session 19 of user root. Jan 5 16:03:51 local systemd: Started Session 19 of user root. Jan 5 16:03:51 local systemd: Starting Session 19 of user root. Jan 5 16:03:51 local dbus[887]: [system] Activating service name='org.freedesktop.problems' (using servicehelper) Jan 5 16:03:51 local dbus-daemon: dbus[887]: [system] Activating service name='org.freedesktop.problems' (using servicehelper) Jan 5 16:03:51 local dbus[887]: [system] Successfully activated service 'org.freedesktop.problems' Jan 5 16:03:51 local dbus-daemon: dbus[887]: [system] Successfully activated service 'org.freedesktop.problems'
tail -f 動(dòng)態(tài)的查看數(shù)據(jù)。這個(gè)很實(shí)用。
[root@local ~]# rm -r test2 rm:是否刪除目錄 "test2"?y [root@local ~]# rm -rf test
rm -r 包括子目錄,-f 強(qiáng)制刪除。
Linux的版本有:Deepin、UbuntuKylin、Manjaro、LinuxMint、Ubuntu等版本。其中Deepin是國內(nèi)發(fā)展最好的Linux發(fā)行版之一;UbuntuKylin是基于Ubuntu的衍生發(fā)行版;Manjaro是基于Arch的Linux發(fā)行版;LinuxMint默認(rèn)的Cinnamon桌面類似Windows XP簡(jiǎn)單易用;Ubuntu則是以桌面應(yīng)用為主的Linux操作系統(tǒng)。
關(guān)于如何分析Linux系統(tǒng)中的目錄結(jié)構(gòu)問題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識(shí)。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。