---
hackpadID: AeFJoopaS0G
hackpadWorkspace: tossug
tags: hackpad-import, tossug
---
# Linux 讀書會 - 第 6 週 09/09/2014
總目錄 [edX Introduction to Linux](https://tossug.hackpad.com/dVX1LvoCcii)
## 課程筆記
**Chapter 09**
<undefined>* Section 1</undefined>
* Low-level: useradd, userdel, groupadd, groupdel (default)
* More friendly: adduser, deluser, addgroup, delgroup (See also: [](http://tinyurl.com/m8sm7fe))[http://tinyurl.com/m8sm7fe](http://tinyurl.com/m8sm7fe))
* Typing `id**`** with no argument gives information about the current user, as in:
* `uid=1000(carl) gid=1000(carl) groups=1000(carl),10(wheel),987(docker) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023`
* Order of the Startup Files
1. /etc/profile
2. ~/.bash_profile
3. ~/.bash_login
4. ~/.profile
* 各位可能發現有些檔案不存在,這是正常的。shell 會按照順序讀取這些初始設定。
<undefined>* Section 2</undefined>
* set, env, export
* $HOME, $PATH
* $PS1
* \u - User name
* \h - Host name
* \w - Current working directory
* \! - History number of this command
* \d - Date
* 如果想要改 PS1,若非特殊原因,建議在 $HOME 目錄底下改,即便只有一個使用者也一樣。
* 也許可以試著加在 ~/.bash_login 底下,重開一個 shell 就生效。
* 另一個即時生效的方式是 `source ~/.bash_login`,立即看得到效果。
* $SHELL
* Have a glance at `/etc/shells` to see how many acceptable shells you have on your system.
<undefined>* Section 3</undefined>
* history, ~/.bash_history
* $HISTFILE, $HISTFILESIZE, $HISTSIZE
* Up/Down, !!, CTRL-R
* !, !$, !n, !string
<undefined>* Section 4</undefined>
* Most often these aliases are placed in your `~/.bashrc` file.
* `alias ll=’ls -l --color=auto’`
<undefined>* Section 5</undefined>
* chmod uo+x,g-w a_file
* chmod 755 a_file
PATH = $HOME/bin::$PATH
每組冒號分隔不同的值,在這裡空值代表目前所在目錄 (./)。
假設目前在 /home/carl/Documents/,中間的空值就會等同這個目錄。
空冒號可以出現在最前面或最尾端。
$PATH 用意是讓 shell 依序到這些目錄找要執行的指令,如果找不到,就會說找不到指令。
假設寫了一個程式,放在 $HOME/bin,如果想要優先執行該目錄下的指令,只要把它附加到 $PATH 最前面,再整串指定給 $PATH,shell 會先認 $HOME/bin,再認原來的 $PATH。
## 本週作業
* 複習前九章
* Chapter 10
## 活動簽到
[Carl Su](/ep/profile/n5euV0AaWLn)
[violetson](/ep/profile/oJusv72f72w)
[P Fisher](/ep/profile/oTOWRrYfPRk)
[Scott Yu](/ep/profile/FXMAg851dkz)
[steven huang](/ep/profile/sncZfUbLaeE)