考試考到上個禮拜的
mirror site鏡像站
在不同地方設置伺服器分散下載源,對使用者來說很方便
十七十八章
找檔案Searching For Files
● locate – Find files by name用名字找
● find – Search for files in a directory hierarchy找特定的資料夾下所有檔案
We will also look at a command that is often used with file-search commands to process
the resulting list of files:
●xargs – Build and execute command lines from standard input從標準輸入(鍵盤)執行所有命令
In addition, we will introduce a couple of commands to assist us in our explorations:
● touch – Change file times改變存檔的時間
● stat – Display file or file system status顯示檔案系統狀態
找在bin/目錄下所有以zip開頭的程式
mate@mydebian8:~$ locate bin/zip
/usr/bin/zipdetails
/usr/bin/zipgrep
/usr/bin/zipinfo
mate@mydebian8:~$ locate zip | grep bin
/bin/bunzip2
/bin/bzip2
/bin/bzip2recover
/bin/gunzip
/bin/gzip
/usr/bin/funzip
/usr/bin/gpg-zip
/usr/bin/preunzip
/usr/bin/prezip
/usr/bin/prezip-bin
/usr/bin/unzip
/usr/bin/unzipsfx
/usr/bin/zipdetails
/usr/bin/zipgrep
/usr/bin/zipinfo
/usr/lib/klibc/bin/gunzip
/usr/lib/klibc/bin/gzip
/usr/share/man/man1/prezip-bin.1.gz
find ~ | wc -l 計算運行中的程式有哪些
find ~ -type d | wc -l (d只能搜尋目錄)
find ~ -type f -name "\*.JPG" -size +1M | wc -l (f普通文件、 "*.JPG"以jpg格式存檔的、size +1M大小大於1M
實際上他是去找一個資料庫
perm權限0600 0700
6-rw可讀寫
擁有者有什麼權限
群組 擁有者給予的權限或超級管理員給的權限
其他人
Owner Group World
rwx rwx rwx
檔案類型
-一般檔案
d目錄
l連結
用八進位表示的時候從000到111
000用十進位表示就是0
111用十進位表示就是7
0600使用者可以讀寫
0700
要確定是否一個目錄中的所有文件與子目錄擁有安全權限
(查看權限不是0600跟不是0700的目錄)
mate@mydebian8:~$ find ~ \(-type f -not -perm 0600 \) -or \(type d -not -perm 0700\)
find: paths must precede expression: (type
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
and交集
or聯集
not差集
()優先執行
224頁
有效地搜尋檔案是只要搜尋一次就好的
一次搜尋兩組東西
touch本用在更新檔案
但若本來沒有那個檔案他就會用在新增檔案
mate@mydebian8:~$ mkdir -p playground/dir-{001..100}
mate@mydebian8:~$ touch playground/dir-{001..100}/file-{A..Z}
mate@mydebian8:~$ find playground -type f -name 'file-A'
playground/dir-089/file-A
playground/dir-056/file-A
playground/dir-054/file-A
playground/dir-060/file-A
playground/dir-073/file-A
playground/dir-006/file-A
playground/dir-080/file-A
playground/dir-088/file-A
playground/dir-025/file-A
playground/dir-011/file-A
playground/dir-083/file-A
playground/dir-064/file-A
playground/dir-096/file-A
playground/dir-093/file-A
playground/dir-023/file-A
playground/dir-009/file-A
playground/dir-018/file-A
playground/dir-020/file-A
playground/dir-008/file-A
playground/dir-031/file-A
playground/dir-028/file-A
playground/dir-005/file-A
playground/dir-058/file-A
playground/dir-012/file-A
playground/dir-010/file-A
playground/dir-016/file-A
playground/dir-030/file-A
playground/dir-076/file-A
playground/dir-043/file-A
playground/dir-065/file-A
playground/dir-015/file-A
playground/dir-066/file-A
playground/dir-084/file-A
playground/dir-069/file-A
playground/dir-092/file-A
playground/dir-027/file-A
playground/dir-042/file-A
playground/dir-048/file-A
playground/dir-039/file-A
playground/dir-079/file-A
playground/dir-002/file-A
playground/dir-086/file-A
playground/dir-022/file-A
playground/dir-068/file-A
playground/dir-053/file-A
playground/dir-072/file-A
playground/dir-035/file-A
playground/dir-097/file-A
playground/dir-074/file-A
playground/dir-041/file-A
playground/dir-013/file-A
playground/dir-099/file-A
playground/dir-032/file-A
playground/dir-003/file-A
playground/dir-094/file-A
playground/dir-004/file-A
playground/dir-029/file-A
playground/dir-087/file-A
playground/dir-100/file-A
playground/dir-052/file-A
playground/dir-055/file-A
playground/dir-082/file-A
playground/dir-095/file-A
playground/dir-063/file-A
playground/dir-081/file-A
playground/dir-040/file-A
playground/dir-075/file-A
playground/dir-090/file-A
playground/dir-062/file-A
playground/dir-026/file-A
playground/dir-021/file-A
playground/dir-061/file-A
playground/dir-050/file-A
playground/dir-078/file-A
playground/dir-033/file-A
playground/dir-070/file-A
playground/dir-051/file-A
playground/dir-057/file-A
playground/dir-046/file-A
playground/dir-059/file-A
playground/dir-037/file-A
playground/dir-014/file-A
playground/dir-098/file-A
playground/dir-047/file-A
playground/dir-034/file-A
playground/dir-038/file-A
playground/dir-091/file-A
playground/dir-007/file-A
playground/dir-077/file-A
playground/dir-044/file-A
playground/dir-049/file-A
playground/dir-067/file-A
playground/dir-045/file-A
playground/dir-085/file-A
playground/dir-001/file-A
playground/dir-019/file-A
playground/dir-071/file-A
playground/dir-017/file-A
playground/dir-036/file-A
playground/dir-024/file-A
在家目錄建一個playground目錄
裡面建立次目錄編號從-001到-100
在次目錄建檔案名稱file-a到z
第十八章
●gzip – Compress or expand files
● bzip2 – A block sorting file compressor
The archiving programs:
● tar – Tape archiving utility
● zip – Package and compress files
And the file synchronization program:
●
rsync – Remote file and directory synchronization
建立檔案跟備份
壓縮檔案
壓縮一群檔案
同步rsync
壓縮檔案比較輕便好傳
你有一個圖檔其大小是100*100
每一個點用3個byte就是紅藍綠
這樣算起來就是100*100*3=3萬的byte
就用一個演算法去描述這個檔案(壓縮)
每個byte都是777
就不會存到3萬大概100個byte就可以解決了
mp4 mp3壓縮的時候把人聽不到的部份都砍掉了
先產生一個檔案
看他長度是多少
在壓縮
看他長度是多少
在解壓縮
看他長度是多少
mate@mydebian8:~$ ls -l /etc > foo.txt
mate@mydebian8:~$ ls -l foo.*
-rw-r--r-- 1 mate mate 14304 6月 9 08:53 foo.txt
mate@mydebian8:~$ gzip foo.txt
mate@mydebian8:~$ ls -l foo.*
-rw-r--r-- 1 mate mate 2759 6月 9 08:53 foo.txt.gz
mate@mydebian8:~$ gunzip foo.txt
mate@mydebian8:~$ ls -l foo.*
-rw-r--r-- 1 mate mate 14304 6月 9 08:53 foo.txt
mate@mydebian8:~$ ls -l /etc > foo.txt
mate@mydebian8:~$ ls -l foo.txt
-rw-r--r-- 1 mate mate 14304 6月 9 08:56 foo.txt
mate@mydebian8:~$ bzip2 foo.txt
mate@mydebian8:~$ ls -l foo.txt.bz2
-rw-r--r-- 1 mate mate 2477 6月 9 08:56 foo.txt.bz2
mate@mydebian8:~$ bunzip2 foo.txt.bz2
進入超級管理員身份
mate@mydebian8:~$ su
密碼:
更新檔案資料庫
root@mydebian8:/home/mate# apt-get update
安裝rsync
root@mydebian8:/home/mate# apt-get install rsync
mate@mydebian8:~$ rm -rf foo/*
mate@mydebian8:~$ rsync -av playground foo
sending incremental file list
created directory foo
playground/
playground/dir-001/
playground/dir-001/file-A
playground/dir-001/file-B
playground/dir-001/file-C
playground/dir-001/file-D
playground/dir-001/file-E
playground/dir-001/file-F
playground/dir-001/file-G
playground/dir-001/file-H
playground/dir-001/file-I
playground/dir-001/file-J
playground/dir-001/file-K
playground/dir-001/file-L
playground/dir-001/file-M
playground/dir-001/file-N
playground/dir-001/file-O
playground/dir-001/file-P
playground/dir-001/file-Q
playground/dir-001/file-R
playground/dir-001/file-S
playground/dir-001/file-T
playground/dir-001/file-U
playground/dir-001/file-V
playground/dir-001/file-W
playground/dir-001/file-X
playground/dir-001/file-Y
playground/dir-001/file-Z
playground/dir-002/
playground/dir-002/file-A
playground/dir-002/file-B
playground/dir-002/file-C
playground/dir-002/file-D
playground/dir-002/file-E
playground/dir-002/file-F
playground/dir-002/file-G
playground/dir-002/file-H
playground/dir-002/file-I
playground/dir-002/file-J
playground/dir-002/file-K
playground/dir-002/file-L
playground/dir-002/file-M
playground/dir-002/file-N
playground/dir-002/file-O
playground/dir-002/file-P
playground/dir-002/file-Q
playground/dir-002/file-R
playground/dir-002/file-S
playground/dir-002/file-T
playground/dir-002/file-U
playground/dir-002/file-V
playground/dir-002/file-W
playground/dir-002/file-X
playground/dir-002/file-Y
playground/dir-002/file-Z
playground/dir-003/
playground/dir-003/file-A
playground/dir-003/file-B
playground/dir-003/file-C
playground/dir-003/file-D
playground/dir-003/file-E
playground/dir-003/file-F
playground/dir-003/file-G
playground/dir-003/file-H
playground/dir-003/file-I
playground/dir-003/file-J
playground/dir-003/file-K
playground/dir-003/file-L
playground/dir-003/file-M
playground/dir-003/file-N
playground/dir-003/file-O
playground/dir-003/file-P
playground/dir-003/file-Q
playground/dir-003/file-R
playground/dir-003/file-S
playground/dir-003/file-T
playground/dir-003/file-U
playground/dir-003/file-V
playground/dir-003/file-W
playground/dir-003/file-X
playground/dir-003/file-Y
playground/dir-003/file-Z
playground/dir-004/
playground/dir-004/file-A
playground/dir-004/file-B
playground/dir-004/file-C
playground/dir-004/file-D
playground/dir-004/file-E
playground/dir-004/file-F
playground/dir-004/file-G
playground/dir-004/file-H
playground/dir-004/file-I
playground/dir-004/file-J
playground/dir-004/file-K
playground/dir-004/file-L
playground/dir-004/file-M
playground/dir-004/file-N
playground/dir-004/file-O
playground/dir-004/file-P
playground/dir-004/file-Q
playground/dir-004/file-R
playground/dir-004/file-S
playground/dir-004/file-T
playground/dir-004/file-U
略
playground/dir-100/file-X
playground/dir-100/file-Y
playground/dir-100/file-Z
sent 138,129 bytes received 49,878 bytes 376,014.00 bytes/sec
total size is 0 speedup is 0.00
mate@mydebian8:~$ touch playground/dir-099/file-Z
mate@mydebian8:~$ rsync -av playground foo
sending incremental file list
playground/dir-099/file-Z
sent 36,463 bytes received 158 bytes 73,242.00 bytes/sec
total size is 0 speedup is 0.00
開新帳號
mate@mydebian8:~$ su
密碼:
root@mydebian8:/home/mate# adduser TINGJIE
adduser: Please enter a username matching the regular expression configured
via the NAME_REGEX configuration variable. Use the `--force-badname'
option to relax this check or reconfigure NAME_REGEX.
root@mydebian8:/home/mate# adduser tingjie
Adding user `tingjie' ...
Adding new group `tingjie' (1004) ...
Adding new user `tingjie' (1004) with group `tingjie' ...
Creating home directory `/home/tingjie' ...
Copying files from `/etc/skel' ...
輸入新的 UNIX 密碼:
再次輸入新的 UNIX 密碼:
passwd:密碼已成功地變更
正在改變 tingjie 的使用者訊息
請輸入新值,或直接按 ENTER 鍵以使用預設值
全名 []: tingjie
房間號碼 []:
工作電話 []:
住家電話 []:
其它 []:
Is the information correct? [Y/n] y
root@mydebian8:/home/mate#
上課心得/筆記
2017年6月20日 星期二
106/05/26 第十二週 Linux桌面系統
第十三章
客製化提示符號
prompt提示符號讓你知道你現在在哪裡
mate@mydebian8:~$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
提示符號可以變動
當然也是要先備份
mate@mydebian8:~$ ps1_old="$PS1"
mate@mydebian8:~$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
備份後還是要檢查一下有沒有對
mate@mydebian8:~$ echo $ps1_old
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
mate@mydebian8:~$ PS1="$ps1_old"
mate@mydebian8:~$ echo $ps1_old
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
mate@mydebian8:~$ PS1=
PS1="\$ "
$
$ PS1="\[\a\]\$ "
第十四章
套件管理
套件 你一定安裝過chrome
他在安裝的時候一定是裝了n個檔案而不是只有一個
google要做出chrome的時候他就把這些套件都裝起來
在配合使用者的作業系統做出能相應的套件(用延伸檔名讓系統辨識
這些檔案的內容事實上就是一個壓縮檔
.deb .rpm .exe
每個人都會做自己想做的套件
後來就出現一個套件庫(資料庫
把所有東西都放進去
但套件實際上是無法把所有程式都包起來
所以他有相依性(程式是非獨立存在的
他必須要透過其他的軟體幫忙才能做事
就像我們人一樣 我們一定要依靠別人
有時候程式沒做好會是相依性的問題
補足了之後就能順利執行了
安裝套件的指令
dpkg低階語言apt-get, aptitude高階語言
低階的安裝dpkg --install package_file
看我有多少套件 dpkg --list
用pipe把他轉向存到一個檔案輸出在顯示列號他就會顯示有幾列
安裝linux軟體的迷思
通常所有軟體都能安裝
不能安裝的話通常都是下列三個原因
1.設備太新(通常是商業公司的最先出來會讓軟體的相依性來不及更新到那個程度
2. 設備太怪
3.軟體的訊息被隱藏
第十五章
除存媒體
● mount – Mount a file system把檔案系統掛上來(把隨身碟插入電腦就掛上去了
● umount – Unmount a file system退出/卸下資料
● fsck – Check and repair a file system檢查跟修訂檔案系統
● fdisk – Partition table manipulator磁碟分區表
● mkfs – Create a file system新增一個檔案系統
● fdformat – Format a floppy disk(現在幾乎沒人用)
● dd – Write block oriented data directly to a device把你磁碟裡面的區塊(幾個位元之類的)複製到令一個設備
● genisoimage (mkisofs) – Create an ISO 9660 image file產生一個iso檔
● wodim (cdrecord) – Write data to optical storage media把你的資料燒入光碟機
● md5sum – Calculate an MD5 checksum做一個檢查碼給你的資料如果資料被修改過檢查碼就會不同
mount 跟unmount
mate@mydebian8:~$ ls /etc/fstab
/etc/fstab
mate@mydebian8:~$ file /etc/fstab
/etc/fstab: ASCII text
mate@mydebian8:~$ less /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=41c7bbd9-63c9-4c5e-bacb-0cbdcfff87ec / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=8b7cf9cd-46b4-4251-b341-8d8d744d0737 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
mate@mydebian8:~$ mount 看我現在掛上哪些設備或檔案系統
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=990689,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=1588524k,mode=755)
/dev/sda3 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/1001 type tmpfs (rw,nosuid,nodev,relatime,size=794264k,mode=700,uid=1001,gid=1001)
gvfsd-fuse on /run/user/1001/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1001,group_id=1001)
在linux裡面每個設備都是一個檔案
光碟裡的映像檔名為iso其實是國際標準iso9660
插上隨身碟之後再mount一次
前略
/dev/sde1 on /media/mate/TRANSCEND type vfat (rw,nosuid,nodev,relatime,uid=1001,gid=1001,fmask=0022,dmask=0077,codepage=437,iocharset=utf8,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
可以看到他在/dev/sde1裡面
mate@mydebian8:~$ umount /dev/sde1 卸載隨身碟
mate@mydebian8:~$ mount之後就找不到隨身碟
buffers可以讓你把東西先放在電腦裡面(分配cpu時間給你)然後你可以先作別的是
卸載就是讓你清空buffers裡面的東西
不然很容易遇到檔案系統崩盤file system corruption
客製化提示符號
prompt提示符號讓你知道你現在在哪裡
mate@mydebian8:~$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
提示符號可以變動
當然也是要先備份
mate@mydebian8:~$ ps1_old="$PS1"
mate@mydebian8:~$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
備份後還是要檢查一下有沒有對
mate@mydebian8:~$ echo $ps1_old
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
mate@mydebian8:~$ PS1="$ps1_old"
mate@mydebian8:~$ echo $ps1_old
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
mate@mydebian8:~$ PS1=
PS1="\$ "
$
$ PS1="\[\a\]\$ "
第十四章
套件管理
套件 你一定安裝過chrome
他在安裝的時候一定是裝了n個檔案而不是只有一個
google要做出chrome的時候他就把這些套件都裝起來
在配合使用者的作業系統做出能相應的套件(用延伸檔名讓系統辨識
這些檔案的內容事實上就是一個壓縮檔
.deb .rpm .exe
每個人都會做自己想做的套件
後來就出現一個套件庫(資料庫
把所有東西都放進去
但套件實際上是無法把所有程式都包起來
所以他有相依性(程式是非獨立存在的
他必須要透過其他的軟體幫忙才能做事
就像我們人一樣 我們一定要依靠別人
有時候程式沒做好會是相依性的問題
補足了之後就能順利執行了
安裝套件的指令
dpkg低階語言apt-get, aptitude高階語言
低階的安裝dpkg --install package_file
看我有多少套件 dpkg --list
用pipe把他轉向存到一個檔案輸出在顯示列號他就會顯示有幾列
安裝linux軟體的迷思
通常所有軟體都能安裝
不能安裝的話通常都是下列三個原因
1.設備太新(通常是商業公司的最先出來會讓軟體的相依性來不及更新到那個程度
2. 設備太怪
3.軟體的訊息被隱藏
第十五章
除存媒體
● mount – Mount a file system把檔案系統掛上來(把隨身碟插入電腦就掛上去了
● umount – Unmount a file system退出/卸下資料
● fsck – Check and repair a file system檢查跟修訂檔案系統
● fdisk – Partition table manipulator磁碟分區表
● mkfs – Create a file system新增一個檔案系統
● fdformat – Format a floppy disk(現在幾乎沒人用)
● dd – Write block oriented data directly to a device把你磁碟裡面的區塊(幾個位元之類的)複製到令一個設備
● genisoimage (mkisofs) – Create an ISO 9660 image file產生一個iso檔
● wodim (cdrecord) – Write data to optical storage media把你的資料燒入光碟機
● md5sum – Calculate an MD5 checksum做一個檢查碼給你的資料如果資料被修改過檢查碼就會不同
mount 跟unmount
mate@mydebian8:~$ ls /etc/fstab
/etc/fstab
mate@mydebian8:~$ file /etc/fstab
/etc/fstab: ASCII text
mate@mydebian8:~$ less /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=41c7bbd9-63c9-4c5e-bacb-0cbdcfff87ec / ext4 errors=remount-ro 0 1
# swap was on /dev/sda6 during installation
UUID=8b7cf9cd-46b4-4251-b341-8d8d744d0737 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
mate@mydebian8:~$ mount 看我現在掛上哪些設備或檔案系統
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=990689,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=1588524k,mode=755)
/dev/sda3 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/1001 type tmpfs (rw,nosuid,nodev,relatime,size=794264k,mode=700,uid=1001,gid=1001)
gvfsd-fuse on /run/user/1001/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1001,group_id=1001)
在linux裡面每個設備都是一個檔案
光碟裡的映像檔名為iso其實是國際標準iso9660
插上隨身碟之後再mount一次
前略
/dev/sde1 on /media/mate/TRANSCEND type vfat (rw,nosuid,nodev,relatime,uid=1001,gid=1001,fmask=0022,dmask=0077,codepage=437,iocharset=utf8,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
可以看到他在/dev/sde1裡面
mate@mydebian8:~$ umount /dev/sde1 卸載隨身碟
mate@mydebian8:~$ mount之後就找不到隨身碟
buffers可以讓你把東西先放在電腦裡面(分配cpu時間給你)然後你可以先作別的是
卸載就是讓你清空buffers裡面的東西
不然很容易遇到檔案系統崩盤file system corruption
106/05/19 第十一週 Linux桌面系統
第十一章
環境是shell裡面會用到的
● printenv – Print part or all of the environment列出環境
● set – Set shell options設定選項
● export – Export environment to subsequently executed programs列出環境當作執行檔的參數
● alias – Create an alias for a command創建別名
環境李存的是環境變數跟
mate@mydebian8:~$ printenv | less //查看我有哪些環境變數
XDG_VTNR=7
SSH_AGENT_PID=1722
XDG_SESSION_ID=1
CLUTTER_IM_MODULE=xim
GPG_AGENT_INFO=/run/user/1001/keyring/gpg:0:1
SHELL=/bin/bash
TERM=xterm
XDG_MENU_PREFIX=gnome-
VTE_VERSION=3801
GJS_DEBUG_OUTPUT=stderr
WINDOWID=37748742
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
USER=mate
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=:
課本範例裡的hostname在我們這邊是user
mate@mydebian8:~$ printenv USER
mate
mate@mydebian8:~$ set | less
bash: set: 寫入錯誤: 中斷的管線
mate@mydebian8:~$ echo $HOME
/home/mate
mate@mydebian8:~$ alias
alias ls='ls --color=auto'
環境是如何建立的?
用起始檔案把組態腳本放在BASH裡面
開機的時候我們系統就會去讀這四個其中之一
mate@mydebian8:~$ cd /etc
mate@mydebian8:/etc$ ls profile
profile
mate@mydebian8:~$ vi etc/profile
進入root查看~/.bash_profile檔案
compound command複合命令
如果這個檔案存在我們就讀他,若不存在就不會執行
我們在終端機裡面打下的命令每個都是小小的程式
他存放的路徑我們可以設定
路徑檔通常放在家目錄的bin
通常會有一堆
有個環境變數foo設定他的內容是
mate@mydebian8:~$ foo="This is some "
mate@mydebian8:~$ echo $foo
This is some
mate@mydebian8:~$ foo=$foo"text"
mate@mydebian8:~$ echo $foo
This is some text
mate@mydebian8:~$ foo=$foo"text."
mate@mydebian8:~$ echo $foo
This is some texttext.
把環境改成適合他作的
我們用的作業系統debian的桌面管理系統是灌gnome(gnome跟kde都有這些文字編輯器)
文字編輯器有兩種圖像式跟純文字是
nano, vi, and emacs
vi是活很久的編輯器
vim是vi的改進版
emacs是自由軟體基金會理查斯托慢寫的,給你寫程式用的
mate@mydebian8:~$ gedit some_file
** (gedit:3443): WARNING **: 取得檔案「/home/mate/some_file」資訊時發生錯誤:沒有此一檔案或目錄
更改環境變數(跟系統有關的東西)時
第一建試試要記得備份
複製剛剛的檔名
mate@mydebian8:~$ su
密碼:
root@mydebian8:/home/mate# cp /etc/profile /etc/profile.bak
root@mydebian8:/home/mate# nano /etc/profile
export HISTSIZE=1000
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto' size to 1000 lines
export HISTCONTROL=ignoredups
export HISTSIZE=1000
# Add some helpful aliases
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
第十二章
為什麼用vi?因為他永遠都在(不用特別再灌),結構小(只有幾k),速度快
1976年Bill Joy發明的
vi原意是視覺visual
他去做了一個alias讓vi指向vim(就像ls本來不是指到ls)
mate@mydebian8:~$ vi
輸入:q就可以離開或是用:q!
如果都不行就按Esc兩次再一次:q
編輯模式
先刪除那個檔
在創一個新的(有給檔名的)
每一列的作前面是~就表示沒有資料
先別打字
模式編輯器按ir印入編輯模式按esc回到command
"foo.txt" [New File] 268 lines, 535 characters written
用lhjk控制上下左右
l右h左j下K上
a附加文字
到vi文件的最上面(最前面)按/xx(xx是要的字)
enter之後游標就會跳到有xx的那行
如果要改變文字可以用:%s/要改變的文字/想改成的樣子/g
//紀錄下操作vi的功能鍵
環境是shell裡面會用到的
● printenv – Print part or all of the environment列出環境
● set – Set shell options設定選項
● export – Export environment to subsequently executed programs列出環境當作執行檔的參數
● alias – Create an alias for a command創建別名
環境李存的是環境變數跟
mate@mydebian8:~$ printenv | less //查看我有哪些環境變數
XDG_VTNR=7
SSH_AGENT_PID=1722
XDG_SESSION_ID=1
CLUTTER_IM_MODULE=xim
GPG_AGENT_INFO=/run/user/1001/keyring/gpg:0:1
SHELL=/bin/bash
TERM=xterm
XDG_MENU_PREFIX=gnome-
VTE_VERSION=3801
GJS_DEBUG_OUTPUT=stderr
WINDOWID=37748742
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
USER=mate
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=:
課本範例裡的hostname在我們這邊是user
mate@mydebian8:~$ printenv USER
mate
mate@mydebian8:~$ set | less
bash: set: 寫入錯誤: 中斷的管線
mate@mydebian8:~$ echo $HOME
/home/mate
mate@mydebian8:~$ alias
alias ls='ls --color=auto'
環境是如何建立的?
用起始檔案把組態腳本放在BASH裡面
開機的時候我們系統就會去讀這四個其中之一
mate@mydebian8:~$ cd /etc
mate@mydebian8:/etc$ ls profile
profile
mate@mydebian8:~$ vi etc/profile
進入root查看~/.bash_profile檔案
compound command複合命令
如果這個檔案存在我們就讀他,若不存在就不會執行
我們在終端機裡面打下的命令每個都是小小的程式
他存放的路徑我們可以設定
路徑檔通常放在家目錄的bin
通常會有一堆
有個環境變數foo設定他的內容是
mate@mydebian8:~$ foo="This is some "
mate@mydebian8:~$ echo $foo
This is some
mate@mydebian8:~$ foo=$foo"text"
mate@mydebian8:~$ echo $foo
This is some text
mate@mydebian8:~$ foo=$foo"text."
mate@mydebian8:~$ echo $foo
This is some texttext.
把環境改成適合他作的
我們用的作業系統debian的桌面管理系統是灌gnome(gnome跟kde都有這些文字編輯器)
文字編輯器有兩種圖像式跟純文字是
nano, vi, and emacs
vi是活很久的編輯器
vim是vi的改進版
emacs是自由軟體基金會理查斯托慢寫的,給你寫程式用的
mate@mydebian8:~$ gedit some_file
** (gedit:3443): WARNING **: 取得檔案「/home/mate/some_file」資訊時發生錯誤:沒有此一檔案或目錄
更改環境變數(跟系統有關的東西)時
第一建試試要記得備份
複製剛剛的檔名
mate@mydebian8:~$ su
密碼:
root@mydebian8:/home/mate# cp /etc/profile /etc/profile.bak
root@mydebian8:/home/mate# nano /etc/profile
umask 0002
export HISTCONTROL=ignoredupsexport HISTSIZE=1000
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto' size to 1000 lines
export HISTCONTROL=ignoredups
export HISTSIZE=1000
# Add some helpful aliases
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
第十二章
為什麼用vi?因為他永遠都在(不用特別再灌),結構小(只有幾k),速度快
1976年Bill Joy發明的
vi原意是視覺visual
他去做了一個alias讓vi指向vim(就像ls本來不是指到ls)
mate@mydebian8:~$ vi
輸入:q就可以離開或是用:q!
如果都不行就按Esc兩次再一次:q
編輯模式
先刪除那個檔
在創一個新的(有給檔名的)
每一列的作前面是~就表示沒有資料
先別打字
模式編輯器按ir印入編輯模式按esc回到command
"foo.txt" [New File] 268 lines, 535 characters written
用lhjk控制上下左右
l右h左j下K上
a附加文字
到vi文件的最上面(最前面)按/xx(xx是要的字)
enter之後游標就會跳到有xx的那行
如果要改變文字可以用:%s/要改變的文字/想改成的樣子/g
//紀錄下操作vi的功能鍵
106/05/10 第十週 Linux桌面系統
第九章permissions權限
multitasking systems多工系統-把cpu的時間切的小小的
multi-user systems 多使用者
● id – Display user identity
● chmod – Change a file's mode
● umask – Set the default file permissions
● su – Run a shell as another user
● sudo – Execute a command as another user
● chown – Change a file's owner
● chgrp – Change a file's group ownership
● passwd – Change a user's password
(一)擁有者/會員/群組
mate@mydebian8:~$ file /etc/shadow
/etc/shadow: regular file, no read permission
mate@mydebian8:~$ less /etc/shadow
/etc/shadow: 拒絕不符權限的操作
mate@mydebian8:~$ id
uid=1001(mate) gid=1001(mate) groups=1001(mate)
對每個檔案有讀寫執行三種模式跟權限有關
新增檔案再看檔案內容
mate@mydebian8:~$ > foo.txt
mate@mydebian8:~$ ls -l foo.txt
-rw-r--r-- 1 mate mate 0 5月 12 08:38 foo.txt
最前面的字母是檔案類型(-表示是一個regular file.
tale 9-1
l -擁有者跟群組有同樣權限
剩下九個字母是指檔案模式(指三種動作的權限擁有者
Table9-2
列出一個這個問我們這10個位元發生什麼事
chmod
Table 9-4: File Modes In Binary And Octal
Octal Binary File Mode
0 000 ---
1 001 --x
2 010 -w-
3 011 -wx
4 100 r--
5 101 r-x
6 110 rw-
7 111 rwx
所以剛剛的foo.txt以八進位來表示權限擁有者會變成644
umask還原成預設的權限
改變登入者身份
1.登出在以其他使用者身份登入
2.使用su命令(沒給參數就會直接跳到超級使用者身份
3.使用sudo命令
mate@mydebian8:~$ rm -f foo.txt
mate@mydebian8:~$ umask
0022
mate@mydebian8:~$ apt-get update
E: 無法開啟鎖定檔 /var/lib/apt/lists/lock - open (13: 拒絕不符權限的操作)
E: Unable to lock directory /var/lib/apt/lists/
E: 無法開啟鎖定檔 /var/lib/dpkg/lock - open (13: 拒絕不符權限的操作)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
mate@mydebian8:~$ su
密碼:
root@mydebian8:/home/mate# apt-get update(更新所有檔案
exit跳出root身份
su -c 'command'(還沒key過
sudo讓你選擇要以哪個使用者的身份執行什麼命令
chown改變檔案的使用者/群組權限
創一個使用者tony
複製一個檔案給他
然後我想看tony的這個檔案
但我不是他沒有這個權限
所以我要用sudo去看
發現這個檔案的擁有者是root
所以我用chown去改使用者權限
chgrp也能這樣用
改變密碼
第十章processes
● ps – Report a snapshot of current processes
● top – Display tasks
● jobs – List active jobs
● bg – Place a job in the background
● fg – Place a job in the foreground
● kill – Send a signal to a process
● killall – Kill processes by name
● shutdown – Shutdown or reboot the system
kill跟killall可以砍掉造成當機的作業程序讓系統可以繼續正常運作
mate@mydebian8:~$ ps
PID TTY TIME CMD
1168 pts/0 00:00:00 ps
2266 pts/0 00:00:00 bash
pid是process的id(每次都會不一樣
tty終端
CMD(command)命令在哪裡作
table10-1process states
process是下指令的瞬間看到他們的狀況
top是可以持續顯示狀態(每隔三秒顯示一次ps
table10-3
top顯示的欄位
程式名稱-現在時間-本次的開機時間-有幾個使用者登入-
xlogo &顯示logo跟命令型態及樣式
mate@mydebian8:~$ ps
PID TTY TIME CMD
1347 pts/0 00:00:00 xlogo
1356 pts/0 00:00:00 ps
2266 pts/0 00:00:00 bash
mate@mydebian8:~$ ps
PID TTY TIME CMD
1347 pts/0 00:00:00 xlogo
1356 pts/0 00:00:00 ps
2266 pts/0 00:00:00 bash
mate@mydebian8:~$ fg %1
mate@mydebian8:~$ xlogo &
[1] 1410
mate@mydebian8:~$ bg %1
bash: bg: job has terminated
[1]+ Done xlogo
mate@mydebian8:~$ xlogo &
[1] 1447
mate@mydebian8:~$ xlogo &
[2] 1448
mate@mydebian8:~$ killall xlogo
[1]- 終止 xlogo
[2]+ 終止 xlogo
multitasking systems多工系統-把cpu的時間切的小小的
multi-user systems 多使用者
● id – Display user identity
● chmod – Change a file's mode
● umask – Set the default file permissions
● su – Run a shell as another user
● sudo – Execute a command as another user
● chown – Change a file's owner
● chgrp – Change a file's group ownership
● passwd – Change a user's password
(一)擁有者/會員/群組
mate@mydebian8:~$ file /etc/shadow
/etc/shadow: regular file, no read permission
mate@mydebian8:~$ less /etc/shadow
/etc/shadow: 拒絕不符權限的操作
mate@mydebian8:~$ id
uid=1001(mate) gid=1001(mate) groups=1001(mate)
對每個檔案有讀寫執行三種模式跟權限有關
新增檔案再看檔案內容
mate@mydebian8:~$ > foo.txt
mate@mydebian8:~$ ls -l foo.txt
-rw-r--r-- 1 mate mate 0 5月 12 08:38 foo.txt
最前面的字母是檔案類型(-表示是一個regular file.
tale 9-1
l -擁有者跟群組有同樣權限
剩下九個字母是指檔案模式(指三種動作的權限擁有者
Table9-2
列出一個這個問我們這10個位元發生什麼事
chmod
Table 9-4: File Modes In Binary And Octal
Octal Binary File Mode
0 000 ---
1 001 --x
2 010 -w-
3 011 -wx
4 100 r--
5 101 r-x
6 110 rw-
7 111 rwx
所以剛剛的foo.txt以八進位來表示權限擁有者會變成644
umask還原成預設的權限
改變登入者身份
1.登出在以其他使用者身份登入
2.使用su命令(沒給參數就會直接跳到超級使用者身份
3.使用sudo命令
mate@mydebian8:~$ rm -f foo.txt
mate@mydebian8:~$ umask
0022
mate@mydebian8:~$ apt-get update
E: 無法開啟鎖定檔 /var/lib/apt/lists/lock - open (13: 拒絕不符權限的操作)
E: Unable to lock directory /var/lib/apt/lists/
E: 無法開啟鎖定檔 /var/lib/dpkg/lock - open (13: 拒絕不符權限的操作)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
mate@mydebian8:~$ su
密碼:
root@mydebian8:/home/mate# apt-get update(更新所有檔案
exit跳出root身份
su -c 'command'(還沒key過
sudo讓你選擇要以哪個使用者的身份執行什麼命令
chown改變檔案的使用者/群組權限
創一個使用者tony
複製一個檔案給他
然後我想看tony的這個檔案
但我不是他沒有這個權限
所以我要用sudo去看
發現這個檔案的擁有者是root
所以我用chown去改使用者權限
chgrp也能這樣用
改變密碼
第十章processes
● ps – Report a snapshot of current processes
● top – Display tasks
● jobs – List active jobs
● bg – Place a job in the background
● fg – Place a job in the foreground
● kill – Send a signal to a process
● killall – Kill processes by name
● shutdown – Shutdown or reboot the system
kill跟killall可以砍掉造成當機的作業程序讓系統可以繼續正常運作
mate@mydebian8:~$ ps
PID TTY TIME CMD
1168 pts/0 00:00:00 ps
2266 pts/0 00:00:00 bash
pid是process的id(每次都會不一樣
tty終端
CMD(command)命令在哪裡作
table10-1process states
process是下指令的瞬間看到他們的狀況
top是可以持續顯示狀態(每隔三秒顯示一次ps
table10-3
top顯示的欄位
程式名稱-現在時間-本次的開機時間-有幾個使用者登入-
xlogo &顯示logo跟命令型態及樣式
mate@mydebian8:~$ ps
PID TTY TIME CMD
1347 pts/0 00:00:00 xlogo
1356 pts/0 00:00:00 ps
2266 pts/0 00:00:00 bash
mate@mydebian8:~$ ps
PID TTY TIME CMD
1347 pts/0 00:00:00 xlogo
1356 pts/0 00:00:00 ps
2266 pts/0 00:00:00 bash
mate@mydebian8:~$ fg %1
mate@mydebian8:~$ xlogo &
[1] 1410
mate@mydebian8:~$ bg %1
bash: bg: job has terminated
[1]+ Done xlogo
mate@mydebian8:~$ xlogo &
[1] 1447
mate@mydebian8:~$ xlogo &
[2] 1448
mate@mydebian8:~$ killall xlogo
[1]- 終止 xlogo
[2]+ 終止 xlogo
106/05/05 第九週 Linux桌面系統
第七章~第九章
mate@mydebian8:~/Student$ echo $USER
mate
mate@mydebian8:~/Student$ cd ~
mate@mydebian8:~$ printenv | less
mate@mydebian8:~$ echo $(ls)
0942.txt 404040389.txt 40404089.txt jiaying87 lazy_dog.txt ls-error.txt ls-output.txt ls.txt movie.mpeg Student 下載 公共 圖片 影片 文件 桌面 模板 音樂
mate@mydebian8:~$ ls -l $(which cp)
-rwxr-xr-x 1 root root 150824 3月 14 2015 /bin/cp
mate@mydebian8:~$ file $(ls -d /usr/bin/* | grep zip)
/usr/bin/funzip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=5b0506c8be78c25ef759c2faa6b3335eb1b01c91, stripped
/usr/bin/gpg-zip: POSIX shell script, ASCII text executable
/usr/bin/preunzip: POSIX shell script, ASCII text executable
/usr/bin/prezip: POSIX shell script, ASCII text executable
/usr/bin/prezip-bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=9f858e8b59fe10b434e638a95be7d2a85f2fbc1a, stripped
/usr/bin/unzip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ad98f8ca0a6425fc7909aad6f0b99013630346be, stripped
/usr/bin/unzipsfx: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=588b1dbafe2dc608823daa966e6d4836b7abe5da, stripped
/usr/bin/zipdetails: Perl script, ASCII text executable
/usr/bin/zipgrep: POSIX shell script, ASCII text executable
/usr/bin/zipinfo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ad98f8ca0a6425fc7909aad6f0b99013630346be, stripped
mate@mydebian8:~$ ls -l `which cp`
-rwxr-xr-x 1 root root 150824 3月 14 2015 /bin/cp
mate@mydebian8:~$ ls -l `which cd`
總計 1816
-rw-r--r-- 1 root root 30 10月 14 2016 0942.txt
-rw-r--r-- 1 mate mate 109 10月 28 2016 404040389.txt
-rw-r--r-- 1 mate mate 192 10月 28 2016 40404089.txt
-rw-r--r-- 1 mate mate 12 11月 10 21:19 jiaying87
-rw-r--r-- 1 mate mate 7 3月 24 09:34 lazy_dog.txt
-rw-r--r-- 1 mate mate 55 3月 24 08:55 ls-error.txt
-rw-r--r-- 1 mate mate 58 3月 24 09:24 ls-output.txt
-rw-r--r-- 1 mate mate 21804 3月 24 09:56 ls.txt
-rw-r--r-- 1 mate mate 0 3月 24 09:29 movie.mpeg
drwxr-xr-x 1 mate mate 1769472 5月 5 08:38 Student
drwxr-xr-x 2 mate mate 4096 3月 24 08:13 下載
drwxr-xr-x 2 mate mate 4096 9月 30 2016 公共
drwxr-xr-x 2 mate mate 4096 4月 20 17:36 圖片
drwxr-xr-x 2 mate mate 4096 9月 30 2016 影片
drwxr-xr-x 2 mate mate 4096 3月 10 12:25 文件
drwxr-xr-x 2 mate mate 4096 4月 19 12:16 桌面
drwxr-xr-x 2 mate mate 4096 9月 30 2016 模板
drwxr-xr-x 2 mate mate 4096 9月 30 2016 音樂
mate@mydebian8:~$ ls -l `which mkdir`
-rwxr-xr-x 1 root root 80744 3月 14 2015 /bin/mkdir
mate@mydebian8:~$ echo this is a test
this is a test
mate@mydebian8:~$ echo Yhe total is $100.00
Yhe total is 00.00
mate@mydebian8:~$ echo 'this is a test'
this is a test
mate@mydebian8:~$ ls -l two words.txt
ls: 無法存取 two: 沒有此一檔案或目錄
ls: 無法存取 words.txt: 沒有此一檔案或目錄
mate@mydebian8:~$ ls -l two lazydog.txt
ls: 無法存取 two: 沒有此一檔案或目錄
ls: 無法存取 lazydog.txt: 沒有此一檔案或目錄
mate@mydebian8:~$ ls -l two 404040389.txt
ls: 無法存取 two: 沒有此一檔案或目錄
-rw-r--r-- 1 mate mate 109 10月 28 2016 404040389.txt
mate@mydebian8:~$ ls -l two words.txt
ls: 無法存取 two: 沒有此一檔案或目錄
ls: 無法存取 words.txt: 沒有此一檔案或目錄
mate@mydebian8:~$ ls -l "two words.txt"
ls: 無法存取 two words.txt: 沒有此一檔案或目錄
mate@mydebian8:~$ echo "$USER $((2+2}} $(cal)"
> q
> ^C
mate@mydebian8:~$ echo "$USER $((2+2)) $(cal)"
mate 4 五月 2017
日 一 二 三 四 五 六
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
mate@mydebian8:~$ echo "$USER $((2+3)) $(cal)"
mate 5 五月 2017
日 一 二 三 四 五 六
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
mate@mydebian8:~$ echo $(cal)
五月 2017 日 一 二 三 四 五 六 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
mate@mydebian8:~$ echo "$(cal)"
五月 2017
日 一 二 三 四 五 六
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
mate@mydebian8:~$ echo "text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER"
text ~/*.txt {a,b} foo 4 mate
mate@mydebian8:~$ mkdir Students
mate@mydebian8:~$ cd Students
mate@mydebian8:~/Students$ mkdir {2015..2017}-{09..12}
mate@mydebian8:~/Students$ ls
2015-09 2015-11 2016-09 2016-11 2017-09 2017-11
2015-10 2015-12 2016-10 2016-12 2017-10 2017-12
mate@mydebian8:~/Students$ echo *
2015-09 2015-10 2015-11 2015-12 2016-09 2016-10 2016-11 2016-12 2017-09 2017-10 2017-11 2017-12
mate@mydebian8:~/Students$ cd ~
mate@mydebian8:~$ echo *
0942.txt 404040389.txt 40404089.txt jiaying87 lazy_dog.txt ls-error.txt ls-output.txt ls.txt movie.mpeg Student Students 下載 公共 圖片 影片 文件 桌面 模板 音樂
mate@mydebian8:~$ echo ppap
ppap
mate@mydebian8:~$ echo $USER
mate
mate@mydebian8:~$ echo '$USER'
$USER
mate@mydebian8:~$ echo "$USER"
mate
mate@mydebian8:~$ ls
0942.txt jiaying87 ls-output.txt Student 公共 文件 音樂
404040389.txt lazy_dog.txt ls.txt Students 圖片 桌面
40404089.txt ls-error.txt movie.mpeg 下載 影片 模板
mate@mydebian8:~$ ls l
lazy_dog.txt ls-error.txt ls-output.txt ls.txt
mate@mydebian8:~$
mate@mydebian8:~/Student$ echo $USER
mate
mate@mydebian8:~/Student$ cd ~
mate@mydebian8:~$ printenv | less
mate@mydebian8:~$ echo $(ls)
0942.txt 404040389.txt 40404089.txt jiaying87 lazy_dog.txt ls-error.txt ls-output.txt ls.txt movie.mpeg Student 下載 公共 圖片 影片 文件 桌面 模板 音樂
mate@mydebian8:~$ ls -l $(which cp)
-rwxr-xr-x 1 root root 150824 3月 14 2015 /bin/cp
mate@mydebian8:~$ file $(ls -d /usr/bin/* | grep zip)
/usr/bin/funzip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=5b0506c8be78c25ef759c2faa6b3335eb1b01c91, stripped
/usr/bin/gpg-zip: POSIX shell script, ASCII text executable
/usr/bin/preunzip: POSIX shell script, ASCII text executable
/usr/bin/prezip: POSIX shell script, ASCII text executable
/usr/bin/prezip-bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=9f858e8b59fe10b434e638a95be7d2a85f2fbc1a, stripped
/usr/bin/unzip: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ad98f8ca0a6425fc7909aad6f0b99013630346be, stripped
/usr/bin/unzipsfx: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=588b1dbafe2dc608823daa966e6d4836b7abe5da, stripped
/usr/bin/zipdetails: Perl script, ASCII text executable
/usr/bin/zipgrep: POSIX shell script, ASCII text executable
/usr/bin/zipinfo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ad98f8ca0a6425fc7909aad6f0b99013630346be, stripped
mate@mydebian8:~$ ls -l `which cp`
-rwxr-xr-x 1 root root 150824 3月 14 2015 /bin/cp
mate@mydebian8:~$ ls -l `which cd`
總計 1816
-rw-r--r-- 1 root root 30 10月 14 2016 0942.txt
-rw-r--r-- 1 mate mate 109 10月 28 2016 404040389.txt
-rw-r--r-- 1 mate mate 192 10月 28 2016 40404089.txt
-rw-r--r-- 1 mate mate 12 11月 10 21:19 jiaying87
-rw-r--r-- 1 mate mate 7 3月 24 09:34 lazy_dog.txt
-rw-r--r-- 1 mate mate 55 3月 24 08:55 ls-error.txt
-rw-r--r-- 1 mate mate 58 3月 24 09:24 ls-output.txt
-rw-r--r-- 1 mate mate 21804 3月 24 09:56 ls.txt
-rw-r--r-- 1 mate mate 0 3月 24 09:29 movie.mpeg
drwxr-xr-x 1 mate mate 1769472 5月 5 08:38 Student
drwxr-xr-x 2 mate mate 4096 3月 24 08:13 下載
drwxr-xr-x 2 mate mate 4096 9月 30 2016 公共
drwxr-xr-x 2 mate mate 4096 4月 20 17:36 圖片
drwxr-xr-x 2 mate mate 4096 9月 30 2016 影片
drwxr-xr-x 2 mate mate 4096 3月 10 12:25 文件
drwxr-xr-x 2 mate mate 4096 4月 19 12:16 桌面
drwxr-xr-x 2 mate mate 4096 9月 30 2016 模板
drwxr-xr-x 2 mate mate 4096 9月 30 2016 音樂
mate@mydebian8:~$ ls -l `which mkdir`
-rwxr-xr-x 1 root root 80744 3月 14 2015 /bin/mkdir
mate@mydebian8:~$ echo this is a test
this is a test
mate@mydebian8:~$ echo Yhe total is $100.00
Yhe total is 00.00
mate@mydebian8:~$ echo 'this is a test'
this is a test
mate@mydebian8:~$ ls -l two words.txt
ls: 無法存取 two: 沒有此一檔案或目錄
ls: 無法存取 words.txt: 沒有此一檔案或目錄
mate@mydebian8:~$ ls -l two lazydog.txt
ls: 無法存取 two: 沒有此一檔案或目錄
ls: 無法存取 lazydog.txt: 沒有此一檔案或目錄
mate@mydebian8:~$ ls -l two 404040389.txt
ls: 無法存取 two: 沒有此一檔案或目錄
-rw-r--r-- 1 mate mate 109 10月 28 2016 404040389.txt
mate@mydebian8:~$ ls -l two words.txt
ls: 無法存取 two: 沒有此一檔案或目錄
ls: 無法存取 words.txt: 沒有此一檔案或目錄
mate@mydebian8:~$ ls -l "two words.txt"
ls: 無法存取 two words.txt: 沒有此一檔案或目錄
mate@mydebian8:~$ echo "$USER $((2+2}} $(cal)"
> q
> ^C
mate@mydebian8:~$ echo "$USER $((2+2)) $(cal)"
mate 4 五月 2017
日 一 二 三 四 五 六
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
mate@mydebian8:~$ echo "$USER $((2+3)) $(cal)"
mate 5 五月 2017
日 一 二 三 四 五 六
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
mate@mydebian8:~$ echo $(cal)
五月 2017 日 一 二 三 四 五 六 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
mate@mydebian8:~$ echo "$(cal)"
五月 2017
日 一 二 三 四 五 六
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
mate@mydebian8:~$ echo "text ~/*.txt {a,b} $(echo foo) $((2+2)) $USER"
text ~/*.txt {a,b} foo 4 mate
mate@mydebian8:~$ mkdir Students
mate@mydebian8:~$ cd Students
mate@mydebian8:~/Students$ mkdir {2015..2017}-{09..12}
mate@mydebian8:~/Students$ ls
2015-09 2015-11 2016-09 2016-11 2017-09 2017-11
2015-10 2015-12 2016-10 2016-12 2017-10 2017-12
mate@mydebian8:~/Students$ echo *
2015-09 2015-10 2015-11 2015-12 2016-09 2016-10 2016-11 2016-12 2017-09 2017-10 2017-11 2017-12
mate@mydebian8:~/Students$ cd ~
mate@mydebian8:~$ echo *
0942.txt 404040389.txt 40404089.txt jiaying87 lazy_dog.txt ls-error.txt ls-output.txt ls.txt movie.mpeg Student Students 下載 公共 圖片 影片 文件 桌面 模板 音樂
mate@mydebian8:~$ echo ppap
ppap
mate@mydebian8:~$ echo $USER
mate
mate@mydebian8:~$ echo '$USER'
$USER
mate@mydebian8:~$ echo "$USER"
mate
mate@mydebian8:~$ ls
0942.txt jiaying87 ls-output.txt Student 公共 文件 音樂
404040389.txt lazy_dog.txt ls.txt Students 圖片 桌面
40404089.txt ls-error.txt movie.mpeg 下載 影片 模板
mate@mydebian8:~$ ls l
lazy_dog.txt ls-error.txt ls-output.txt ls.txt
mate@mydebian8:~$
106/04/28 第八週 Linux桌面系統
重新編譯各種應用軟體及Linux核心而成的Linux發行版提供一般使用者(不會整合這些東西的人)使用,他們不須重新編譯,只要稍微做設定就好。發行版有很多種,32位元的或64位元的等等,他會自己依據不同的硬體來做調整,但有些地方他可能做不到,這時候就要人工來設定。有些作業系統考量到容量大小,不會裝桌面環境(X Window),一進去就是終端機的環境,效率很高(圖形介面相當耗資源)。Linux發行版現在少說3000種。
每個軟體都不只是一個軟體,他們每個都是包含了很多個軟體是一個軟體包,這種軟體包讓人家不用每使用軟體包中其中一個軟體就要取得授權,因為自由軟體秉持大家都能共享的精神,所以他在把軟體包釋出到網路上的時候,就會把授權條款也包在軟體包裡。
商業發行版如Ubuntu、社群發行版如Debian是由自由團體社群支援的發行版,哪一種發行版指的是包裝的團體是什麼人做的。
一個發行版的組成包含一個Linux內核、及來自GNU的工具和函數庫,還有附加的軟體、文件,及一個視窗管理員、和一個桌面環境。
在公元兩千年以前要做發行版要自己選核心、函數、應用軟體,操作的方式是文字介面,比現在複雜很多,文字介面是為了讓開發者可以有更多自由做其他的事,
在usb發展到3.0之後我們就確認他的效率比電腦的排線還快,而且把硬碟拔掉,在桌面環境就不會有中毒的這件事發生,當然還是可能在電腦的其他部分中毒。
流行的發行版有很多種,選擇的時候最好選擇有人支援的,最低限度的是找台灣有人在做的,這樣出問題而且你不知道怎麼解決的時候就能找到援助。
Debian只是眾多的發行版其中之一,嚴格講Debian是一個計劃,目前Debian有兩種核心Linux跟FreeBSD,他也支援其他核心,最主要就是Hurd。因為Debian作業系統中大部分使用的工具是來自GNU計畫,他們認可GNU的功勞,所以用GNU/Linux、GNU/kFreeBSD、和GNU/Hurd來稱呼這個作業系統。Debian能提供很多套件,有一個叫APT的管理器能幫助我們在使用Debian上順暢的執行。但要記得的是,這個系統最重要的不只是核心,所有東西都很重要,包括使用者,不然沒人用也沒意義。
Debian設立社群契約來規範Debian社群與自由軟體社群在Debian計畫中的所有事情:Debian永遠會是百分百的自由軟體、Debian社群會把遇到的問題回報給自由軟體社群、Debian社群永遠會優先考慮他們的使用者與自由軟體、Debian了解那些作品不符合他們的自由軟體規範。
而Debian自由軟體指導方針(204年通過的1.1版)有同意Debian的元件被再次散佈、散佈的形式必須附上原始碼、同意作品的衍生、作者原始碼的完整性(在修改過後、或有補缺後再散佈的時候,就要一併把你修改的部分詳細註明出來,還要把你處理過的這個東西的來源也清楚的寫上去)、禁止歧視人仕或團體、禁止歧視用途(不能歧視任何人把這些東西以任何目的使用)、許可證的散佈(程式的散佈必須附帶許可證)、許可證不能特定於Debian(必須以在任何系統都適用的理念執行)、(自由軟體講究Copyleft)許可證的規定不得污染其他軟體、許可證示例(列出他們視為自由的許可證示例,包含GPL、BSD等)
**Debian為什麼能活到今天?Debian的名字怎麼來的?
每個軟體都不只是一個軟體,他們每個都是包含了很多個軟體是一個軟體包,這種軟體包讓人家不用每使用軟體包中其中一個軟體就要取得授權,因為自由軟體秉持大家都能共享的精神,所以他在把軟體包釋出到網路上的時候,就會把授權條款也包在軟體包裡。
商業發行版如Ubuntu、社群發行版如Debian是由自由團體社群支援的發行版,哪一種發行版指的是包裝的團體是什麼人做的。
一個發行版的組成包含一個Linux內核、及來自GNU的工具和函數庫,還有附加的軟體、文件,及一個視窗管理員、和一個桌面環境。
在公元兩千年以前要做發行版要自己選核心、函數、應用軟體,操作的方式是文字介面,比現在複雜很多,文字介面是為了讓開發者可以有更多自由做其他的事,
在usb發展到3.0之後我們就確認他的效率比電腦的排線還快,而且把硬碟拔掉,在桌面環境就不會有中毒的這件事發生,當然還是可能在電腦的其他部分中毒。
流行的發行版有很多種,選擇的時候最好選擇有人支援的,最低限度的是找台灣有人在做的,這樣出問題而且你不知道怎麼解決的時候就能找到援助。
Debian只是眾多的發行版其中之一,嚴格講Debian是一個計劃,目前Debian有兩種核心Linux跟FreeBSD,他也支援其他核心,最主要就是Hurd。因為Debian作業系統中大部分使用的工具是來自GNU計畫,他們認可GNU的功勞,所以用GNU/Linux、GNU/kFreeBSD、和GNU/Hurd來稱呼這個作業系統。Debian能提供很多套件,有一個叫APT的管理器能幫助我們在使用Debian上順暢的執行。但要記得的是,這個系統最重要的不只是核心,所有東西都很重要,包括使用者,不然沒人用也沒意義。
Debian設立社群契約來規範Debian社群與自由軟體社群在Debian計畫中的所有事情:Debian永遠會是百分百的自由軟體、Debian社群會把遇到的問題回報給自由軟體社群、Debian社群永遠會優先考慮他們的使用者與自由軟體、Debian了解那些作品不符合他們的自由軟體規範。
而Debian自由軟體指導方針(204年通過的1.1版)有同意Debian的元件被再次散佈、散佈的形式必須附上原始碼、同意作品的衍生、作者原始碼的完整性(在修改過後、或有補缺後再散佈的時候,就要一併把你修改的部分詳細註明出來,還要把你處理過的這個東西的來源也清楚的寫上去)、禁止歧視人仕或團體、禁止歧視用途(不能歧視任何人把這些東西以任何目的使用)、許可證的散佈(程式的散佈必須附帶許可證)、許可證不能特定於Debian(必須以在任何系統都適用的理念執行)、(自由軟體講究Copyleft)許可證的規定不得污染其他軟體、許可證示例(列出他們視為自由的許可證示例,包含GPL、BSD等)
**Debian為什麼能活到今天?Debian的名字怎麼來的?
2017年6月1日 星期四
106/06/02 第十三週 Linux桌面系統
su進入超級使用者
十五章187頁建立檔案系統
預設值安裝是ext4
建立一個分割區的layout在建立一個空白的檔案系統
用fdisk f是format
這是低階的工作(離人較遠的)
fdisk可以去修改你在設備上的這些東西
root@mydebian8:/home/mate# umount /dev/sdf1
root@mydebian8:/home/mate# fdisk /dev/sdf
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): p
Disk /dev/sdf: 14.1 GiB, 15158738944 bytes, 29606912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x04dd5721
Device Boot Start End Sectors Size Id Type
/dev/sdf1 * 63 29606911 29606849 14.1G c W95 FAT32 (LBA)
Command (m for help): l
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 83
If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information.
Changed type of partition 'W95 FAT32 (LBA)' to 'Linux'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@mydebian8:/home/mate# mount
略
/dev/sdf1 on /media/mate/e6ae755d-1c8d-4bee-aa18-fe4d011c8730 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
root@mydebian8:/home/mate#
存檔的時候以sector為單位
但顯示容量的時候都是以byte為單位
root@mydebian8:/home/mate# umount /dev/sdf1
root@mydebian8:/home/mate# mkfs -t ext4 /dev/sdf1
mke2fs 1.42.12 (29-Aug-2014)
/dev/sdf1 contains a ext4 file system
last mounted on Fri Jun 2 08:59:16 2017
Proceed anyway? (y,n) y
Creating filesystem with 3700856 4k blocks and 925696 inodes
Filesystem UUID: 2c3334c6-9ea9-40cb-b48e-da8d46edf32b
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
mate@mydebian8:~$ su
密碼:
root@mydebian8:/home/mate# umount /dev/sdf1
root@mydebian8:/home/mate# fdisk /dev/sdf
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): p
Disk /dev/sdf: 14.1 GiB, 15158738944 bytes, 29606912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x04dd5721
Device Boot Start End Sectors Size Id Type
/dev/sdf1 * 63 29606911 29606849 14.1G 83 Linux
Command (m for help): l
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): c
If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information.
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@mydebian8:/home/mate# mkfs -t vfat /dev/sdf1
mkfs.fat 3.0.27 (2014-11-12)
root@mydebian8:/home/mate# fsck /dev/sdf1
fsck from util-linux 2.25.2
fsck.fat 3.0.27 (2014-11-12)
/dev/sdf1: 0 files, 1/1848620 clusters
root@mydebian8:/home/mate#
十五章187頁建立檔案系統
預設值安裝是ext4
建立一個分割區的layout在建立一個空白的檔案系統
用fdisk f是format
這是低階的工作(離人較遠的)
fdisk可以去修改你在設備上的這些東西
root@mydebian8:/home/mate# umount /dev/sdf1
root@mydebian8:/home/mate# fdisk /dev/sdf
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): p
Disk /dev/sdf: 14.1 GiB, 15158738944 bytes, 29606912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x04dd5721
Device Boot Start End Sectors Size Id Type
/dev/sdf1 * 63 29606911 29606849 14.1G c W95 FAT32 (LBA)
Command (m for help): l
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 83
If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information.
Changed type of partition 'W95 FAT32 (LBA)' to 'Linux'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@mydebian8:/home/mate# mount
略
/dev/sdf1 on /media/mate/e6ae755d-1c8d-4bee-aa18-fe4d011c8730 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)
root@mydebian8:/home/mate#
存檔的時候以sector為單位
但顯示容量的時候都是以byte為單位
root@mydebian8:/home/mate# umount /dev/sdf1
root@mydebian8:/home/mate# mkfs -t ext4 /dev/sdf1
mke2fs 1.42.12 (29-Aug-2014)
/dev/sdf1 contains a ext4 file system
last mounted on Fri Jun 2 08:59:16 2017
Proceed anyway? (y,n) y
Creating filesystem with 3700856 4k blocks and 925696 inodes
Filesystem UUID: 2c3334c6-9ea9-40cb-b48e-da8d46edf32b
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
mate@mydebian8:~$ su
密碼:
root@mydebian8:/home/mate# umount /dev/sdf1
root@mydebian8:/home/mate# fdisk /dev/sdf
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): p
Disk /dev/sdf: 14.1 GiB, 15158738944 bytes, 29606912 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x04dd5721
Device Boot Start End Sectors Size Id Type
/dev/sdf1 * 63 29606911 29606849 14.1G 83 Linux
Command (m for help): l
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT
1e Hidden W95 FAT1 80 Old Minix
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): c
If you have created or modified any DOS 6.x partitions, please see the fdisk documentation for additional information.
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
root@mydebian8:/home/mate# mkfs -t vfat /dev/sdf1
mkfs.fat 3.0.27 (2014-11-12)
root@mydebian8:/home/mate# fsck /dev/sdf1
fsck from util-linux 2.25.2
fsck.fat 3.0.27 (2014-11-12)
/dev/sdf1: 0 files, 1/1848620 clusters
root@mydebian8:/home/mate#
訂閱:
文章 (Atom)
