| 檢視權限 |
drwxr--r--
1 root root 167 Aug 5 01:18 myfile
所屬的使用者,組別的使用者,其他使用者
| - |
沒有權限 |
| r |
有讀取權 |
| w |
有寫入權用 |
| x |
excute權 |
| s |
表示己經設定user ID bit or group bit |
|
| 改變權限 |
chmod [option] [who]
[file]
chmod u+x file [enter]
chgrp .................chown |
| 檢視檔案類型 |
file [option]
檔案名稱 |
| 壓縮檔和解壓縮檔 |
tar -cvf 檔案.tar
file1 file2 file3 (做一個zip)
[root@malina
/root]# tar -cvf file1.tar file2 file3
[root@malina /root]#
|
|
| 顯示壓縮檔 |
tar -tf file1.tar
[root@malina
/root]# tar -tf file1.tar
file2
file3
|
|
| 加檔案入個ZIP |
tar -vrf
file1.tar file4
[root@malina
/root]# tar -vrf file4
[root@malina /root]# tar -tf file1.tar
file2
file3
file4
|
|
| 移除file在tar |
tar --delete -vf file1.tar file4
[root@malina
/root]# tar --delete file1 file4
[root@malina /root]# tar -tf file1
file2
file3 |
|
| 解開zip [ tar ] |
tar -xvf file1.tar
[root@malina
/root]# tar -xvf file1.tar
|
|
下面的方法可以裝成tar 後立即用compress
如要使用bzip2
用這個tar 再用gzip |
tar -cZvf 檔案.tar.Z
檔案1 檔案2
tar -clvf 檔案.tar.bz2
檔案1 檔案2
tar -cvf 檔案.tar .gz
--use-compress-program gzip file1 file2 |
| Compress .Z |
compress [ n ] 檔案
n=1 - 16 16壓縮最大
uncompress [n] 檔案.z |
| Zip |
zip myfile
file1 file2 file3
[root@malina
/root]# zip myile file1 file2 file3
|
|
| 從zip檔中移除file |
zip -d myfile
file1 |
| 解壓縮 |
unzip myfile |
| 顯示zip檔案內容 |
unzip -v myfile |
| 解壓縮到指定的目錄 |
unzip myfile
-d dir
會把檔案放在dir目錄下 |
| 過濾解壓縮的檔案 |
unzip myfile
-x list |
gzip .gz
顯示壓縮比率
顯示檔案內容
解壓縮 |
gzip 檔案
gzip -v 檔案
gzip -l 檔案
gzip -d 檔案 |
| 建立捷徑 |
in 來源檔 連結檔
in /home/ma/file1 link1
in -d /home/ma link1 目錄連結 |
| 目錄的用處 |
| /dev
目錄 |
/dev 目錄中檔案都是代表實體裝備的特殊檔案 |
| /etc
目錄 |
/etc
目錄中放和主機的組態,設定有關的檔案,像是使用者密碼,群組,shell等設定檔. |
| /etc/X11 |
存放X系統的設定檔,如XF86config |
| /etc/skel |
使用者的骨架檔案,當新建立使用者時,用以建立使用者的家目錄下的基本檔案 |
| /lib
目錄 |
存放 /bin 和 /sbin 目錄下可 行檔案所要的 式庫. |
| /proc
目錄 |
是一個特殊的目錄,裡面冇一些特殊的檔案,系統用來傳輸資料給核心程式.可以觀察這些特殊檔案來得到記憶體中行程的資料 |
| /bin
目錄 |
存放root
才有權使用的指令程式,負責啟動及恢復系統的檔案./sbin 目錄下最小應有下列程式:clock, getty,
init, update, mkswap, swapon, swapoff, halt, reboot,
shutdown, fdisk, fsck *, mkfs .*, lilo, arp, ficonfig,
route |
| /user
目錄 |
一個好重要的目錄,很多系統檔案指令都在這裡,存放的檔案可以所有主機,使用者or
網路上的使用者使用,所有通 常都係唯讀的. |
| /var
目錄 |
放一些系統記錄,暫存的地放 |
| /root |
root
的家目錄 |
| /home |
通常是使用者的家目錄 |
|
| 如何掛 ? |
mount [ -t
type ] 裝備 掛 點
mount -t vfat /dev/hd6 /mnt/server
hd6 = 第幾個分割區
server = folder name <一定要在>
|
| |
fstab
看有什麼連接一開機
/etc/mtab 系統掛點都記錄這個file中
mdir a: |
| 管理軟碟機, 光碟機 |
mount /dev/cdrom
mount /dev/fd0 |
| 管理使用者的磁碟空間 |
Step 1: 開啟quota 能
/etc/fstab
/dev/hda5 / ext2 defaults,grpquota,usrquota
Step2: 產生quota 檔案
[root@malina
/root]# quotacheck -guav
Scaning /dev/hda5 [/] done
Checked 2581 directors and 46685 files
Using quotafile / quota.user
Using quotafile / quota.group |
Step2: 設定quota edquota -p 來源
目標 以ma的設定限制chlin
[root@malina
/root]# edquota -p ma chlin
[root@malina /root]# edquota ma
/dev/had5: blocks in use:2497, limits (soft = 20000, hard
= 25000
inodes in use: 341, limits (soft = 1000, hard = 1500 |
如果想所有使用者者都和ma一樣,可以打
edquota -p ma
| block in use |
是已使用左幾多大小 |
| inodes
in use |
是幾多個inodes,一個file一個inodes |
| hand limit |
限制使用者最大的容量 |
| soft limit |
過了hand limit的最大容量 |
Step4: 行quota
[root@malina
/root]# quotaon -guva
/dev/hda5: group quotas turned on
/dev/hda5: user quotas turned on
|
|
| |
|