作業系統基本了解以及Linux 基本命令

2021-10-24 12:43:57 字數 3457 閱讀 3470

/opt、/etc、/dev、/var、/kernel、/home等的作用

/opt:存放第三方應用軟體,類似c:\program files

/etc:存放系統配置檔案

/dev:存放裝置檔案,硬體會被對映為檔案,如/dev/cdrom代表光碟機

/var:存放可變資訊,如系統審計日誌

/kernel:存放作業系統核心檔案

/home:使用者的家目錄(unix是多使用者作業系統,每個使用者都可以有自己的家目錄,在該目錄下可以進行增刪改查操作)

絕對路徑 :以/開頭

相對路徑:

a1/a.txt

./1.txt

…/1.html

hao@izuf64tgce8abrnpof310tz:

~$ ls -f

aaa/

hao@izuf64tgce8abrnpof310tz:

~$ cd aaa

hao@izuf64tgce8abrnpof310tz:

~/aaa$ ls -f

a b s

ls -r 級聯遞迴檢視所有檔案

hao@izuf64tgce8abrnpof310tz:

~$ ls -r.:

aaa.

/aaa:

a b s

ls -l 檢視檔案詳情

ls -larf /etc 檢視檔案包括隱藏檔案 並且把子目錄一直向下開啟 並且檢視檔名 檔案型別

$ cd 回到家目錄

$ cd ~ 回到家目錄 ~作為一種指代

$ cd / 到根目錄

$ cd …/ 到上一級目錄

$ cd dir1 到指定的目錄

echo列印 $系統級別環境變數

echo $home

echo $shell

echo $path

格林威治時間 1970.1.1 0:0:0

date -d 『1970-1-1 99999 days』

時間戳:距離格林威治時間的秒數

more /etc/passwd 檢視etc/passwd裡面的更多資訊

hao@izuf64tgce8abrnpof310tz:

~$ more aaa**

* aaa: directory ***

hao@izuf64tgce8abrnpof310tz:

~/aaa$ more a

zhelishiwenjiande bianjiqu

sudo命令:

/etc/sudoers新增一行:

username all=(all:all) all

新增使用者

adduser username

提示設定密碼

個人資訊 id whoami

切換賬號:

su 切換到root

su username 帶著環境切換到username

su - username 重新登入到username

修改密碼

root 下 #passwd

$ mkdir dir1/dir2 在指定目錄下新建目錄

$ mkdir dir3 dir4 dir5 一次新建好幾個目錄

$ mkdir ~/games 在家目錄下新建games目錄

$ mkdir -p dir6/dir7/dir8 級聯新建有層次的目錄 cp

拷貝檔案/目錄到指定檔案/目錄中

$ cp [-i] source_file destination_file

將乙個普通檔案拷貝到指定目錄中並且重新命名

hao@izuf64tgce8abrnpof310tz:

~/b$ ls

a.txt b.txt c1 c2 c3 c.txt

hao@izuf64tgce8abrnpof310tz:

~/b$ cp a.txt c3/a1.txt/*目的檔案/重新命名*/

hao@izuf64tgce8abrnpof310tz:

~/b$ ls c3

a1.txt

hao@izuf64tgce8abrnpof310tz:

~/b$

$ cp [-i] source_file(s) destination_directory

將多個普通檔案拷貝到指定目錄中

hao@izuf64tgce8abrnpof310tz:

~/b$ cp a.txt b.txt c3

hao@izuf64tgce8abrnpof310tz:

~/b$ ls c3

a1.txt a.txt b.txt

hao@izuf64tgce8abrnpof310tz:

~/b$ ls

a.txt b.txt c1 c2 c3 c.txt

hao@izuf64tgce8abrnpof310tz:

~/b$ cp a.txt b.txt /home/hao/a

hao@izuf64tgce8abrnpof310tz:

~/b$ cd ../a

hao@izuf64tgce8abrnpof310tz:

~/a$ ls

a.txt b.txt hh passwd

$ cp -r[i] source_directory(s) destination_directory

複製多個目錄到新的目錄

hao@izuf64tgce8abrnpof310tz:

~/a$ cd ../b

hao@izuf64tgce8abrnpof310tz:

~/b$ cp -r c1 /home/hao/a

hao@izuf64tgce8abrnpof310tz:

~/b$ cd ../a

hao@izuf64tgce8abrnpof310tz:

~/a$ ls

a.txt b.txt c1 hh passwd

$ mv [-i] source_file destination_file 移動源頭普通檔案(目錄)到 目的檔案()目錄(重新命名,覆蓋)

$ mv [-i] source_file(s) destination_directory 移動多個源普通檔案(資料夾)到 目的檔案(目錄)

$ mv [-i] source_directory(s) destination_directory 移動多個源目錄到目的目錄

rm & rmdir

刪除檔案或者刪除非空目錄

$ rm [-i] filename(s) 刪除普通檔案

$ rmdir directory_name(s) 只能刪除空目錄

$ rm -r[i] directory_name(s) 刪除所有目錄(空、非空)

$rm -r * 清空資料夾

了解作業系統

發行版其實就是在核心的基礎上,新增特定的桌面環境和常用的軟體。最大的好處就是省去了組裝的麻煩。安裝virtualbox 安裝centos 6.8 網路配置 1.切換目錄 cd etc sysconfig network scripts 2.備份檔案 cp ifcfg eth0 ifcfg eth0 ...

Linux作業系統的安裝以及基本的操作命令詳解

開啟vmware 檔案 新建虛擬機器 選擇典型 下一步 選擇第三個稍後安裝 下一步 選擇linux 下一步 虛擬機器名稱,位置,自己隨意取 下一步 自己設定磁碟大小,但不能太小,下乙個選擇拆分多個 下一步 點選自定義硬體 記憶體大小看自己機子的大小設定,新cd ide 這個連線的設定使用iso映像檔...

linux作業系統基本介紹

linux作業系統 shell命令 shell指令碼 linux作業系統 核心 kernel 檔案系統 shell 一切皆檔案 linux系統上有且只有檔案 任何東西都以檔案形式存在 資料夾 目錄檔案 新加捲 c d e f 根目錄 包含linux系統所有目錄和檔案 linux作業系統是乙個多使用者...