Linux第一節之指令初識體驗

2021-07-28 22:53:43 字數 4741 閱讀 3099

你知道作業系統都有些什麼嗎?windows啊。這是我在上大學之前的問答,我當時認為只一種叫做windows的作業系統,可是我錯了,當我上大學以後,第一次接觸到了除windows以外的作業系統,那就是linux,之後我便自己裝了個虛擬機器在上面又安裝了linux發行版的centos系統和ubuntu,開始了linux之旅。
linux作業系統,是一種計算機作業系統,中文讀法大致一般為「哩內克斯」,但真正的讀法應為「哩納克斯」。linux作業系統的核心的名字也是「linux」。linux作業系統也是自由軟體開放源**發展中最著名的例子。linux的基本思想有兩點:第一,一切都是檔案;第二,每個軟體都有確定的用途,同時它們都盡可能被編寫得更好。其中第一條詳細來講就是系統中的所有都歸結為乙個檔案,包括命令、硬體和軟體裝置、作業系統、程序等等對於作業系統核心而言,都被視為擁有各自特性或型別的檔案。至於說linux是基於unix的,很大程度上也是因為這兩者的基本思想十分相近。

殼層(英語:shell)在電腦科學中,是指「提供使用者使用介面」的軟體,通常指的是命令列介面的解析器。一般來說,這個詞是指作業系統中,提供訪問核心所提供之服務的程式。

shell基本有兩層含義:一種是圖形介面shell 另一種是命令符shell

在linux作業系統中,使用者只能通過shell來與作業系統建立聯絡,傳入資料先通過shell接收,然後確保其安全,可操作(保護作業系統)之後再傳遞給作業系統。不過shall不會親自去執行這些命令,都會調遣他的子程序去傳遞資料。

linux常用命令:

ls    //顯示當前目錄下所有檔案

[sent@localhost ~]$ ls

[sent@localhost ~]$ ls -r //連同子目錄的內容一同列出(有遞迴形式)

[sent@localhost ~]$ ls -a //列出所有的檔案連同隱藏檔案(開頭為.的檔案)一起列出來

cp //複製檔案copy之意,它還可以把多個檔案一次性複製到乙個目錄之下

[sent@localhost ~]$ cp -a //將檔案特性一起複製

[sent@localhost ~]$ cp -p //連同檔案屬性一起複製常用於備份

[sent@localhost ~]$ cp -i //若目標檔案存在,會先詢問再進行操作

[sent@localhost ~]$ cp -r //遞迴複製,常用於複製目錄

mv //移動檔案,目錄,或重新命名

[sent@localhost test]$ ls

test_8 test_9 wang2.c

[sent@localhost test]$ mv wang2.c wang3.c //重新命名

[sent@localhost test]$ ls

test_8 test_9 wang3.c

[sent@localhost test]$ mv wang3.c .. //把wang3.c移動到上級目錄下(可一次把多個檔案移動到資料夾,但最後乙個檔案必須是目錄)

[sent@localhost test]$ ls

test_8 test_9

[sent@localhost test]$ cd .. // 返回到上級目錄

[sent@localhost ~]$ ls

desktop downloads music public test wang3.c

documents linux pictures templates videos

rm //用於刪除檔案或目錄(remove)

[sent@localhost ~]$ rm wang3.c //刪除wang3.c檔案其內部不包含檔案

[sent@localhost ~]$ ls

desktop downloads music public test

documents linux pictures templates videos

[sent@localhost meng]$ mkdir 1 2 3 //在meng目錄下建立三個檔案

[sent@localhost meng]$ ls

1 2 3

[sent@localhost meng]$ cd ..

[sent@localhost ~]$ rm meng //不能直接刪除 會提示是乙個目錄

rm: cannot remove `meng': is a directory

[sent@localhost ~]$ rm -r meng // 遞迴刪除,常用於刪除目錄

[sent@localhost ~]$ ls

desktop downloads music public test

documents linux pictures templates videos

[sent@localhost ~]$ rm -fr meng // 強制刪除目錄下所有檔案

[sent@localhost ~]$ rm -i file //刪除檔案file,會詢問是否進行此操作。

ps  //將某個時間點的程序運**況選取下來並輸出

[sent@localhost ~]$ ps -a //顯示所有的程序

[sent@localhost ~]$ ps aux //檢視系統所有的程序資料

[sent@localhost ~]$ ps -la //檢視系統所有的程序資料(顯示不同)

cat //檢視文字檔案內容

[sent@localhost ~]$ cat file //檢視file檔案下內容

chgrp //用於改變檔案所屬使用者組(root限權下)

[sent@localhost test_8]$ ll //顯示檔案屬性

total 0

-rw-rw-r--. 1 sent sent 0 mar 18 03:36 test_2 //sent sent

[sent@localhost test_8]$ su //切換為超級使用者指令 ctrl+d 可切換回來

password:

[root@localhost test_8]# ls

test_2

[root@localhost test_8]# chgrp root test_2 //改變檔案使用者組為root

[root@localhost test_8]# ll

total 0

-rw-rw-r--. 1 sent root 0 mar 18 03:36 test_2 //sent root

chown //改變檔案所有者

[root@localhost test_8]# chown root test_2 //改變檔案所有者

[root@localhost test_8]# ll

total 0

-rw-rw-r--. 1 root sent 0 mar 18 03:36 test_2 //root sent

chmod //改變檔案的許可權 r 讀 w 寫 x 執行

[root@localhost test_8]# chmod 0775 test_2 //第一次改寫

[root@localhost test_8]# ll

total 0

-rwxrwxr-x. 1 sent sent 0 mar 18 03:36 test_2

[root@localhost test_8]# chmod g-wr test_2 //第二次改寫

[root@localhost test_8]# ll

total 0

-rwx--xr-x. 1 sent sent 0 mar 18 03:36 test_2

cal //顯示當前日曆

[root@localhost test_8]# cal 2017 //顯示2023年年曆

[root@localhost test_8]# cal -1 //顯示一月份日曆

date +%y:%m:%d //顯示年月日

date +%y_%m_%d/%h:%m:%s //顯示年月日 時分秒

mkdir //建立檔案

[sent@localhost ~]$ mkdir meng

[sent@localhost ~]$ cd meng

[sent@localhost meng]$ ls

[sent@localhost meng]$ mkdir 1 2 3 //z在meng檔案下連續建立1,2,3三個檔案

[sent@localhost meng]$ ls

1 2 3

[sent@localhost meng]$ mkdir -p 4/5/6 //以遞迴的形式連續建立

[sent@localhost meng]$ ls

1 2 3 4

[sent@localhost meng]$ cd 4

[sent@localhost 4]$ ls

5[sent@localhost 4]$ cd 5

[sent@localhost 5]$ ls

6

linux操作指令(第一節課)

對於linux作業系統很多人會把它和虛擬機器混為一談,然而虛擬機器指的是vmware一類的虛擬機器軟體。linux作業系統的應用是十分廣泛的,比如網際網路公司的伺服器,人手乙個的安卓機的核心就是linux作業系統。好了,開始說指令!首先,建立並開啟乙個虛擬機器,然後滑鼠右擊開啟終端 open in ...

第一節綜述

shader是什麼?shader是著色器。渲染流水線的概念?渲染流水線的工作任務在於由乙個三維場景出發,生成一張二維影象。渲染流程分為3個階段 應用階段 幾何階段 光柵化階段。1 應用階段 由cpu負責實現,由開發者主導。最重要的輸出是渲染所需的幾何資訊,即渲染圖元。這些渲染圖元傳遞給幾何階段。2 ...

第一節 熱機

一.熱機 內燃機是熱機的一種,以汽油或柴油為燃料 二.汽油機 練1.三.柴油機 練2.從能量轉化的角度看,一台四衝程內燃機在乙個迴圈中 1 哪個衝程存在著化學能轉化為內能的過程?2 哪個衝程存在著內能轉化為機械能的過程?3 哪個衝程具有很明顯的機械能轉化為內能的過程?練3.關於單缸四衝程內燃機,下列...