LINUX 的哲學思想:一切皆檔案;
普通檔案
目錄檔案
連結檔案
裝置檔案
管道檔案
目錄:
/ 檔案系統的上層根目錄
/bin 存放使用者經常使用的指令,如LS,CAT
/boot 作業系統啟動時所需的檔案
/dev 接口裝置檔案 如/dev/sda表示第一個實體SATA接口硬碟
/etc 存放系統管理所需要的配置檔案和子目錄
/home 一般使用者的主目錄
/media 裝置的檔案系統挂載點
/proc 是一個虛拟的目錄,是系統記憶體的映射,可以擷取系統資訊
/root root使用者的主目錄
/sbin 存放系統啟動時所需執行的程式
/tmp 存入一些臨時檔案
/usr 存放使用者使用的系統指令和應用程式資訊
/lib 存放系統最基本的動态連結共享庫
/lost+found 平時為空,當不正常關機時,這裡就存放恢複的檔案
/var 存放變動性質的相關程式目錄
mkdir: 建立目錄
mkdir linux 表示在目前目錄下建立
[root@Freedom1991 ~]# mkdir linux
[root@Freedom1991 ~]# ls
anaconda-ks.cfg install.log install.log.syslog linux test.txt 公共的 模闆 視訊 圖檔 文檔 下載下傳 音樂 桌面
mkdir /linux :表示在根目錄下建立LINUX目錄
[root@Freedom1991 ~]# mkdir /linux
[root@Freedom1991 ~]# cd /
[root@Freedom1991 /]# ls
bin boot cgroup dev etc home lib linux lost+found media misc mnt mydata net opt proc root sbin selinux squid srv sys tmp usr var
[root@Freedom1991 /]# rmdir linux 删除目錄
[root@Freedom1991 ~]# rm test.txt
rm:是否删除普通檔案 "test.txt"?y 删除檔案
rm -rf : 表示強制删除目錄及其中的檔案
[root@Freedom1991 ~]# rm -rf /linux 這個指令很危險,慎用!
[root@Freedom1991 ~]# mkdir test
[root@Freedom1991 ~]# mkdir test1
[root@Freedom1991 ~]# cd test
[root@Freedom1991 test]# touch file
[root@Freedom1991 ~]# ln -s /test/file test1/file.ln
[root@Freedom1991 ~]# cd test1
[root@Freedom1991 test1]# ls
file.ln 建立連結檔案
cd:切換目錄
[root@Freedom1991 test1]# cd /home
[root@Freedom1991 home]# cd .. 切換上層目錄
[root@Freedom1991 /]#
pwd:顯示目前所在目錄
[root@Freedom1991 /]# pwd
/
ls : 列出目錄内容
bin boot cgroup dev etc home lib lost+found media misc mnt mydata net opt proc root sbin selinux squid srv sys tmp usr var
[root@Freedom1991 /]# ls -a
. .. .autofsck .autorelabel bin boot cgroup .dbus dev etc home lib lost+found media misc mnt mydata net opt proc root sbin selinux squid srv sys tmp usr var
[root@Freedom1991 /]# ls -A
.autofsck .autorelabel bin boot cgroup .dbus dev etc home lib lost+found media misc mnt mydata net opt proc root sbin selinux squid srv sys tmp usr var
[root@Freedom1991 /]# ls -l
總用量 112
dr-xr-xr-x. 2 root root 4096 9月 25 20:06 bin
dr-xr-xr-x. 4 root root 4096 9月 17 17:13 boot
drwxr-xr-x. 10 root root 4096 9月 17 21:02 cgroup
drwxr-xr-x 19 root root 3860 9月 30 09:51 dev
drwxr-xr-x. 153 root root 12288 9月 30 09:51 etc
drwxr-xr-x. 6 root root 4096 9月 29 17:49 home
……
[root@Freedom1991 home]# ls -R 遞歸顯示目錄下的所有檔案清單和子目錄清單
.:
dingning dn123456 lost+found nginx
./dingning:
./dn123456:
公共的 模闆 視訊 圖檔 文檔 下載下傳 音樂 桌面
./dn123456/公共的:
./dn123456/模闆:
./dn123456/視訊:
[root@Freedom1991 test]# touch lily 建立新的空檔案
[root@Freedom1991 test]# ls
file lily
cat:檢視檔案内容
[root@Freedom1991 test]# cat file 檢視:
This is Linux!
[root@Freedom1991 test]# cat /root/test/file 絕對路徑
This is Linux!
[root@Freedom1991 ~]# cat > /home/love.txt 用cat建立檔案,最後一行一定要按下回車,CTRL+C結束
I Love Liujiayao!
^C
[root@Freedom1991 ~]# cat /home/love.txt
[root@Freedom1991 ~]# cat -b /home/love.txt 加入編号
1 I Love Liujiayao!
2 god bless you!
[root@Freedom1991 nginx]# less /etc/nginx/nginx.conf 互動式操作
[root@Freedom1991 nginx]# more /etc/nginx/nginx.conf 分頁顯示内容
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
index index.html index.htm;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
[root@Freedom1991 ~]# more +3 /etc/nginx/nginx.conf 以第三行開始顯示頁面
[root@Freedom1991 ~]# more +/error /etc/nginx/nginx.conf 檔案中第一個error字元串出現的頁面及以後内容