2017年6月20日 星期二

106/06/09 第十四週 Linux桌面系統

考試考到上個禮拜的

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#


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

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

 umask 0002
export HISTCONTROL=ignoredups
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的功能鍵

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

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:~$

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的名字怎麼來的?

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#

2017年4月27日 星期四

106/04/14 第六週 Linux桌面系統

一、本學期教的所有命令的類型及用途
() 可執行程序(以目錄型態顯示,如type gerpà grep is /bin/grep)
1.date︰顯示系統當前的時間與日期
2.cal︰顯示當前月份的月曆
3.df︰查看硬碟剩餘空間
4.free︰顯示空閒內存的數量
5. file確定檔案類型(印出檔案內容的簡單描述)
6. less︰瀏覽檔案(須為文本格式,以簡單的字符與數字間的一對一映射,只包含字符本身和一些控制符,像制表符’\t’、回車符’\r’、換行符’\n’)內容
7. cp︰複製檔案和目錄
8. mv︰移動/重命名檔案和目錄
9. mkdir︰創建目錄
10.rm:刪除檔案和目錄
11.ln︰創建硬連結和符號連結
12.which:顯示會執行哪個可執行程序,用來查指令
13.man:顯示命令手冊頁(查詢指令的用法)
14.apropos:顯示一系列適合的命令
15.info:顯示命令的infopage
16.whatis:顯示一個命令的簡潔描述
17.cat:連接檔案
18.sort:排序文本行
19.uniq:報導或省略重複行
20.grep:印出匹配行
21.wc:印出檔案中共有多少行、多少字、及多少位元組(byte)
22.head:輸出檔案第一部分
23.tail:輸出檔案最後一部分

() shell內部的命令 (type aliasàalias is a shell_builtin)
1.exit︰終止一個終端會話
2.pwd︰印出當前工作目錄名稱(print working directory)
3.cd︰更換當前工作目錄(位置)
絕對路徑:cd /usr/bin (完整路名)
相對路徑:cd ..(前往目前工作目錄的父目錄)cd ./bin(工作目錄)= cd bin
cd (若現在工作目錄不在家目錄),可直接回到工作目錄
    cd - :更改工作目錄到先前的工作目錄
    cd ~user_name:更改工作目錄到用戶家目錄
4.type︰查看檔案的類型
5.alias:用別名創建自己的命令

()命令的別名 (type lsàls is a aliased to ‘ls –color=auto’ )
1.ls︰別名,列出目錄中的內容(包含的檔案與子目錄)
        選項可多重使用,如ls -lt
        選項            用途
        -a      列出所有檔案,包含被隱藏的檔案(檔名開頭為.的檔案)
        -l      以長模式輸出
        -t      按檔案修改時間的先後順序輸出
        -reverse    以相反的順序輸出

**ASCIIcode表 數字0-9 什麼時候換頁、跳行
ASCII美國資訊交換標準代碼 (American Standard Code for Information Interchange)
是美國國家標準協會(American National Standards Institute,簡稱ANSI)制定的一套編碼系統。電腦在處理資訊的時候都是將訊息轉換為二進位的字串,每一個位元(bit)01兩種狀態,因此八個位元就可以組合出256種不同的狀態(2的八次方),每一個狀態對應一個符號,就是256個符號,從0000000011111111。約1960年代左右,美國制定了ASCII字元編碼方式,對英語字元與二進位數位之間的關係作了統一的規定。ASCII一共規定了128個字元的編碼,而這128個編碼所對應的符號都是七位元的,但是儲存時會在最前面加上一個0,以便以位元組(8位元)的形式儲存。可以顯示26個基本拉丁字母、阿拉伯數字、和英式標點符號。

**檔案系統階層標準 (Filesystem Hierarchy Standard,簡稱FHS)
檔案系統階層標準(Filesystem Hierarchy Standard,簡稱FHS)是一份用來定義檔案與目錄標準的文件,在這份文件中主要說明了這些檔案與目錄在Linux作業系統中的階層架構與擺放的路徑,一個統一的標準可以讓使用者可以瞭解到已安裝軟體通常放置於那個目錄下。因此不管你所使用的發行套件版本、套件的開發者為何,都必須遵守這個遊戲規格來設定檔案與目錄的存放路徑。

在整個FHS中,大部分的目錄階層都可以允許使用者自行定義,而且他指定義了兩個基本的階層,分別為目錄階層的最頂層(根目錄)、及根目錄底下的/usr/var目錄。根目錄是FHS定義的最高階層目錄,也是系統啟動時第一個被掛載起來的目錄。因為Linux核心無法提供完全的作業系統功能程式,因此還是需要許多其他應用程式於啟動時來進行執行,簡單說就是/root(根目錄)跟開機系統有關。而/usr是指Unix特殊資源或是Unix系統資源,裡面包含與應用程式的執行檔、圖形介面程式、函數庫等檔案,與軟體安裝與執行有關,常用的/usr目錄內容如/bin是用來存放使用者執行的相關指令。/var則是與系統運作過程有關,目錄中存放的檔案都是變動性較高的檔案,如系統相關紀錄檔等。

**命令中的說明文件放在哪裡
Linux中大部分的命令文件都是放在bin的目錄下,以可執行檔案形式儲存/儲存類型以可執行檔儲存。
取得命令文件的方式可以透過在終端機中輸入”man空格指令,他就會直接在終端機裡面開啟該命令的說明文件。手冊頁分為不同的區域。這些區域的名字是用大寫和粗體表示,且靠左對齊:
NAME:手冊頁對應的命令或函數名字,後接簡單描述。
SYNOPSIS: 使用此命令的所有方法。下面我們會詳述這個區域,因為此區域的內容極為關鍵。
DESCRIPTION: 命令的更深入的描述。這個區域也會包括所有參數及其用法。一般來說這個區域是文字最多的。
apropos命令是當想找命令卻不知道命令的名稱是什麼的時候可以使用,與man命令有點對立的關係,man命令用於顯示命令的使用手冊,而apropos命令用於根據手冊中的關鍵字來找到命令。
比如想要查看時區,但是不知道指令名稱是什麼,就可以輸入apropos view(因為在英文中view是看的意思),然後會出現很多命令(在左列),後面還會附上在使用手冊中有出現view的關鍵句(在右列),我們就可以從中找到可以查看時區的tzselect,就可以用它來查看時區。  
另外,info也可以取得檔案的說明文件,比如我們想找nano,輸入info nano後,會出現一個nano.info的說明文件,但他會以目錄的形式顯現,讓檢索者可以從標題目錄去查找他想看的,先鍵入m再打目錄標題,即可找到所需。
Info有別於manman是將說明文件直接顯示於畫面,雖有作分段,但是不像info有一個目錄可以選擇要進入哪個段落。
whatis命令則可說是man命令的精簡版,它只會列出man命令顯示的手冊的開頭部分,就是概述命令的作用。若只想查shell內部的命令說明文件,也可以用help


參考資料:
https://goo.gl/7cp27Y
https://goo.gl/oBwTRE
https://goo.gl/VtBMqv
https://goo.gl/Cgylva
https://goo.gl/yNfz0l
https://goo.gl/tloRxV
https://goo.gl/H69M5z
https://goo.gl/13Vsm0
https://goo.gl/sbxg3x

2017年4月13日 星期四

106/03/24 第五週 Linux桌面系統

1.試舉出三個命令及其功能
pwdshell (類型:內部的命令)

                印出當前工作目錄名稱(print working directory)

ls︰(類型:別名)
                列出目錄中的內容(包含的檔案與子目錄)
                選項可多重使用,如ls -lt
                選項                        用途
                -a             列出所有檔案,包含被隱藏的檔案(檔名開頭為.的檔案)
                -l              以長模式輸出
                -t              按檔案修改時間的先後順序輸出
                -reverse   以相反的順序輸出



cd (類型:shell 內部的命令)
                更換當前工作目錄(位置)
可透過兩種方式,絕對路徑和相對路徑
絕對路徑:cd /usr/bin (完整路名)
相對路徑:cd ..(前往目前工作目錄的父目錄)cd ./bin(工作目錄)= cd bin
cd (若現在工作目錄不在家目錄),可直接回到工作目錄
        cd - :更改工作目錄到先前的工作目錄
        cd ~user_name:更改工作目錄到用戶家目錄

106/03/10 第三週 Linux桌面系統

第40頁

 -rw-r--r--
1硬連結
root擁有者
root擁有者的群組
32059檔案大小
2007-04-03 11:05日期
oo-cd-cover.odf檔案名稱



less /etc/passwd
q離開


【What is "Text"?】
純文字
 一個byte為8個bit
古代只定義7bit
一個bit可以定義2種
所以以前指定意了2的7次方(128種)位置
編號從0到7

【ASCII 】
American Standard Code for Information Interchange,美国信息交换标准代码
背英文字母大小寫與數字
A-Z 十進位41-510


二進轉十進
 101=>1*2^1+0*2^1+1*2^1

十六進轉十進
16進位遇到10轉成A(因為10有兩位會塞不下所以改用A)
7A=7*16^1+10*16^2

換頁鍵
ctrl+^enter

enter
換行 

symbolic links軟連結
hard links硬連結

第四章處理檔案及目錄
ln建立連結

*萬用字元
?萬用字元,但大小只有一個字元

〔英文字母〕方括弧中可輸入任意英文字母
[:lower:]一個小寫的字母
[[:lower:]123]一個小寫的字母或一或二或三

GNOME預設的檔案總管為Nautilus

新增一個資料夾mkdir 資料夾名稱

有一個檔案叫foo
他被很多程序使用
但是這個檔案又常常需要更換檔案名稱
所以可以透過重建連結來連到新名稱的foo
就不用一個一個改程序內的foo

hard links有兩個限制
1.只能連結到自己的系統
只能在同一個硬碟分割區
2.只能用在檔案(不能用在目錄)

sysbolic links則沒有這些限制

線上虛擬機https://copy.sh/v86/

作34~41頁
如果試了之後沒有差異就按ls -l仔細看有什麼不一樣
下禮拜教第五章


2017年3月23日 星期四

106/03/17 第四週 Linux桌面系統

 命令的類型
1.date︰可執行程序


2.cal︰可執行程序

3.df︰可執行程序


4.free︰可執行程序


5.exit︰shell 內部的命令


6.pwd︰shell 內部的命令


7.ls︰別名

8.cd︰ shell 內部的命令

9.file︰可執行程序

10.less︰可執行程序

11.cp︰可執行程序

12.mv︰可執行程序

13.mkdir︰可執行程序

14.rm︰可執行程序

15.ln︰可執行程序

16.link︰可執行程序

17.type︰shell 內部的命令
查看檔案的類型
type  command



12個可執行程序、4個shell 內部的命令、1個別名

2017年3月9日 星期四

106/03/03 第二週 Linux桌面系統

GNU/Linux名稱(稱法的不同、作者怎麼看、我怎麼看)

【變更密碼指令】
想改變的密碼擁有者為:
1.一般使用者
passwd
 輸入目前密碼與新密碼再重複輸入新密碼

sudo passwd XXXX (XXXX為使用者帳號)
在root身份情況下執行passwd則不須輸入該使用者目前密碼可直接更改其密碼

2.root
(1)進入grub開機畫面,對常用的linux核心按"e",進入編輯模式。
(2)對類似於linux   vmlinuz-2.6.15 ro root=/dev/hda2 的那行句尾加上"init=/bin/bash
(3)再按Ctrl+x進入single模式(螢幕應直接顯示以root身分登入)
(5)輸入mount -rw -o remount /
(6)輸入passwd (root)
(7)輸入新root密碼
(8)再輸入一次新密碼
(9)輸入reboot

今日課堂實作command line

date今日日期與現在時間

cal看月曆

df硬碟容量與使用狀況

free 顯示記憶體使用情況(已用容量與未用容量大小)
第一列是ram
除以1024除兩次就是你的主機有幾GB

ls列出此目錄的內容
file顯示檔案類型
less查看檔案內容

2017年3月2日 星期四

106/02/24 第一週 Linux桌面系統

trademark商標權
ubiquitous無所不在的、十分普遍的、處處可見的
wondrous[形]令人驚奇的、不可思議的、奇妙的;[副]極其
empowerment賦權、授能
Terminal Emulators 終端機模擬器

自由軟體的精神在於從骨子裡就沒有任何隱私,而使用Linux得以自由可以決定你要用你的電腦做什麼,進而取回電腦的控制權。

圖形介面桌面管理系統KDE的終端機處理器為konsole;GNOME則是gnome-terminal
alt+ctrl+f1-f6-->TTY7 這個才是終端機
TTY(Teletypes):終端機的文字輸入介面

The Console Behind The Curtain
Even if we have no terminal emulator running, several terminal sessions continue
to run behind the graphical desktop. Called virtual terminals or virtual consoles,
these sessions can be accessed on most Linux distributions by pressing CtrlAlt-F1
through Ctrl-Alt-F6. When a session is accessed, it presents a login
prompt into which we can enter our username and password. To switch from one
virtual console to another, press Alt and F1-F6. To return to the graphical desktop,press Alt-F7.

[實作]
Ctrl+Alt+Fn (n=1~6)
進入純文字桌面模式
登入後可直接進入終端機
輸入exit可離開

Alt+F7
回到圖形桌面模式


shell prompt提示符:[username@machinename 目錄 ]$
在[]後面若非$而是#-->以root身分或其他系統管理員身分登入
輸入exit-->關閉終端機
buffer:緩衝機
swap:可做為模擬的RAM


2017年1月8日 星期日

105/12/30 第十五週 Linux桌面系統

一、什麼是GNU?
1.名稱由來、涵義、精神
GNU的名稱來自”Gnu's Not Unix”的遞迴縮寫,GNU是一個計畫,由Richard Stallman與他的夥伴於1983年共同發起,其開發GNU系統與軟體的目的在於創造一個新的共享軟體社群,能夠自由的把此系統給想要用它的人,使用者更不會受限於商業利益

GNU 的精神在GNU宣言中提到軟體的原始碼應該要自由流通, 軟體公司該做的,不是把原始碼據為己有,賺取發行 binary 的金錢,而是整合與服務的費用而已, 因為原始碼自由流通的軟體才能讓軟體的品質提高,讓軟體程式設計師可以自由的與他人交換心得,不受智慧財產權的約束

2.使用的授權條款
GNU通用公眾授權條款─General Public License(GPL)
GPL是基於GNU自由軟體架構下的授權條款,適用於大多數自由軟體基金會的軟體,以及任何因信任而採用 GNU GPL 的作者所開發的軟體。GPL是被廣泛使用的自由軟體授權條款,保證條款接受者有執行、學習、分享(複製)及編輯軟體之自由。

GPL授予程式接受人以下權利,或稱「自由」,或稱「copyleft」:
1.以任何目的執行此程式的自由;
2.再發行複製件的自由;
3.改進軟體,並公開發布改進版的自由(前提是能得到原始碼)。

GPL規定:只要這種修改文本在整體上或者其某個部分來源於遵循GPL的程式,該修改文本的 整體就必須按照GPL流通,不僅該修改文本的源碼必須向社會公開,而且對於這種修改文本的流通不准許附加修改者自己作出的限制。因此,一項遵循GPL流通 的程式不能同非自由的軟體合併。GPL所表達的這種流通規則稱為copyleft(著佐權),表示與copyright(著作權)的概念「相左」。

{怕有人把自由流通的軟體佔為己有, 自由軟體基金會(Free Software Foundation,FSF)制定的 GPL,先依著作權法獲得軟體的智慧財產權,再透過 GPL 釋放此權力給大眾:只要遵守 GPL,不把原始碼以及對原始碼所作的修改據為己有,則擁有使用 GPL 軟體的權力。GPL 的規定不太適用於 Library(軟體函式庫),為鼓勵更多人使用 GNU 軟體, FSF制定 LGPL--Library GPL}

二、Linux是什麼?作業系統的核心
電腦是由許多硬體所組成的,為了使硬體在共同運作時更有效率人類發明了作業系統。除了有效率的控制這些硬體資源的分配,並提供電腦運作所需要的功能(如網路功能)之外, 也為了要提供程式設計師更容易開發軟體的環境,所以作業系統也會提供一整組系統呼叫介面來給軟體設計師開發用。而一個核心程式與系統呼叫介面即為作業系統。

Linux是1991年芬蘭的大學生 Linus Torvards 寫的作業系統,採用GNU GPL開放給公眾自由重製、散佈、修改,並由全世界很多程式設計師與企業投入心力才漸漸累積成今日的Linux。

{為了實習使用 Andrew S. Tanenbaum 先生的 MINIX 作業系統, 買了他第一 486PC。但是他發現MINIX裡面缺乏很多他想要的功能,於是開始了他的偉大事業 自己寫一個保護模式下的作業系統。 最開始的時候, Linus 是在 USENET 討論區,comp.os.minix 呼朋引伴的, 然後這個娃娃作業系統 ( 名為 Linux) 就以兩個禮拜出一次修正版的速度快速的成長茁壯,討論區也從原來寄生的 comp.os.minix 中獨立成非主流的 alt.os.linux,然後正名為 comp.os.linux 之後因為使用者眾多,討論區因此再細分成 comp.os.linux.* Linux 如此的受歡迎,儼然成為正統UNIX 的繼成者。}

三、GNU跟Linux有什麼關係?GNU使用Linux的核心來發展
GNU研發的作業系統核心稱為Hurd,不過在他完備釋出以前,Linux突然崛起,同時Linux也符合GNU計畫想要做成的作業系統的要件,他更使用GNU的授權條款,多數人認為Linux可以取代Hurd,自由軟體基金會也不必再繼續開發Hurd,直接以Linux作其核心就好了。

而在 Linux 早期的版本,因為發展者怕自己的程式被不肖的廠商竊據,甚至喧賓奪主, 因此使用了一個相當嚴格的版權聲明,禁止一切的商業行為。 後來因為大家希望有人能夠把 Linux 壓成 CD-ROM,推廣 Linux 且造福那些不方便上 Internet FTP 的朋友, 所以將版權宣告換成 GPL 。從此之後,Linux便是公認的GNU作業系統。

FSF 也有發行以 Linux 為核心的 GNU 系統計畫。 這個計畫就 是 FSF 大力支持的 Debian Linux。Debian Linux 是 GNU Software ( 與 Public domain Software )近幾年來最徹底的整合(就是一套完完 全全用 GNU 和 PD 架起來, 而且有 Commercial OS 水準的系統)。 Linux 目前的意義可以說是彌補 Hurd 未完成前的真空, 並且聚集 GNU 與 PD 軟體的力量,為以後 GNU 系統的基礎。


四、圖書館軟體宣言指的是什麼?圖書館軟體使用者/消費者有甚麼權利與義務
圖書館軟體宣言(Library Software Manifesto)
羅伊•泰南20071112日發表。
消費者(圖書館)權益:
1.我有權知道,現在有什麼、未來走向 廣告傳單講得很好,不過,我有權知道今天下單時,可以拿到什麼。例如我買了Lanota,我要知道我付款後,是否可以馬上使用這個APP
2.我有權使用買來的東西(軟體) 例如我買了LanotaLanota裡面所有的曲子我都能玩。
3.我有權使用產品的應用程式介面 應用程式介面是簡單的介面,讓應用程式彼此溝通。在產品本身的應用程式介面,不應該額外收費。例如玩Lanota時,Lanota的介面我不需要額外付費。
4.我有權得到完整且正確的文件。例如我買了Lanota,遊戲安裝時不能有安裝錯誤或者數據資料不完整
5.我權使用自已的資料 不限於記錄本身,還包括使用的記錄(如,某書被借出多少次),對相關排序或其他用途而言,該等資訊愈來愈重要。例如我買了Lanota,裡面的歌曲我都可以盡情玩。
6.我有權近用唯讀資料庫 客戶不能近用底層的資料庫,是可以理解的;但沒有理由禁止近用唯讀資料庫。
7.我有權不讓簡單的事物複雜化。例如我在玩Lanota時,我只要把速度調成一般,不要調成快速。
8.我有權知道已購買產品的發展方向與時間表。例如:我買了Lanota,我有權知道官方網站顯示的,Lanota未來的發展趨勢以及更新表
9.我有權提出技術性問題,並得到答案。
10.我有權不成為產品的白老鼠。廠商必須告知產品的情形。
11.我有權在產品昇級後,仍保有原來的客製化及設定。更新升級後,我遊戲原本的設定不會因為更新而導致消失
消費者(圖書館)責任:
1.我有責任知道使用者的需求。
2.我有責任在購買之前,先瞭解使用者的需求。
3.我有責任清楚且準確地提出需求。
4.我有責任確認強化的需求確實是我要的。
5.我有責任公平地提出優先強化功能的要求。
6.我有責任理解我不是特例 因此,我們應在同樣的事物上達成共識,以最小的投資撰寫軟體。
7.我有責任以公平合理的程序選擇軟體 尤其是,可以不要經歷建議徵求書的過程。
圖書館在選擇軟體時要以公平合理的程序,但是很多圖書館沒有。
8.我有責任報告可重複的錯誤以加速重複的軟體片斷。
9.我有責任儘可能地詳細報告非重複性的錯誤
10.我有責任批判性地檢視內定設定的任何調整。
共享責任:
1.我們共享從互相尊重的立場開始。
2.我們共享良好的溝通。
3.我們共享建立與維護合理的強化程序。
4.我們共享保持最終使用者需求至上的原則。(顧客永遠是對的)
5.我們共享愉悅與快樂!不要在圖書館被操到死,讓我們有點願景。

五、Introduction to Free Software中的Liences有沒有智慧財產權?說明什麼是有?台灣如何用法律呈現智慧財產權???其一,著作權;其二,專利法;其三,商標法,在哪些情況違反上述三法
有,根據Introduction to Free SoftwareLegal aspects 法律層面:
intellectual property 智慧財產權:
智慧財產權是人權的一部分,是每個人都有的權力,根據世界人權宣言(1948)27Article 27 of the Declaration of Human Rights
(1)人人有權自由參加社會的文化生活,享受藝術,並分享科學進步及其產生的福利。
(2)人人對由於他所創作的任何科學、文學或美術作品而產生的精神的和物質的利益,有享受保護的權利。
每個人都有權利保障自己的智慧財產權與實體財產權。
       i.Copyright 著作權法
將權力分為兩個:人格權與財產權
人格權:作品散布的權力在作者手上。
財產權:作者藉由作品獲取利益。
著作人格權終身有效,死後也有效 (政府會去維護),著作財產權有期限 (政府特許)
        ii.Trade secret 商業秘密
       iii. Patents and utility models 專利
我國保護智慧財產權的法律包括:
(1)專利法(發明專利、新型專利、設計專利)
(2)商標法(商標、證明標章、團體標章、團體商標、產地標示等)
(3)著作權法(著作人格權、著作財產權)
舉例:
(1)專利法
例如:麵包師傅在製作麵包的過程中,發現一種新的材料,可以創造出更鬆軟綿密的麵包,可以就這個發明,向各國政府申請發明專利權。
(2)著作權法
例如:同學創作的小說或漫畫故事,屬於著作,在完成時受著作權法保護。
(3)商標法
例如:個人電腦在執行操作系統或應用軟體所顯示的「Microsoft」、「Apple」等字樣,則是受到商標法保護的「商標權」,一般看到會在商標文字或圖樣右上方標示R的字樣,就是說明這個商標是已註冊(registered)

六、Free Software有沒有著作權,為什麼他有,舉例他的著作權在哪。找一自由軟體看他的著作權聲明。
{從法律基礎來看,著作權法當初對於電腦程式的保護,是將電腦程式當作是一種「文字創作」,藉此保障電腦程式原創者免於程式被抄襲的著作權侵害,並使作者有權自由地選擇將程式對他人授權的方式。}

著作權是當某項作品完成時就自然產生了,不需申請或註冊,在自由軟體的場合,仍然經常要求姓名標示或維持相同授權。以本文為例,本文在寫作的同時,作者即擁有著作權,任何人皆無法剝奪。而當使用者花錢購買某套軟體時,所購買的只是「使用權」,使用者必須接受該軟體的「軟體授權」,才能使用這個軟體;而軟體的原作者則仍然保有其「著作權」。

像是Stellarium是自由的模擬天文館的3D軟體,Stellarium的使用手冊中著作權聲明(Version 0.15.1-1, December 25, 2016)的部分提到他允許任何人在GNU自由文檔許可證(第1.2版或更新的版本)的授權條件下複製、散佈、修改此份文件。且在散佈的同時也應以跟GNU自由文檔許可證相同的方式授權。