Command Line Interface (CLI)

กระบวนการทำงานของเชลล์ และชุดคำสั่งที่เกี่ยวข้อง (Command Sequences)

เชลล์ (Shell)

shell เป็นตัวกลางในการรับคำสั่ง (Command Line) จากผู้ใช้แล้วจะทำการแปลชุดคำสั่ง (Command Line Interpreter - CLI) ที่ผู้ใช้ป้อนเข้ามา โดยขบวนการภายในตัว shell จะซ่อนรายละเอียดอันซับซ้อนของระบบปฏิบัติการเอาไว้ โดยที่ผู้ใช้จะไม่รู้ว่าหลังจากที่ป้อนคำสั่งไปแล้วภายในจะต้องมีขบวนการเช่นไรบ้าง ตัวอย่างเช่น ถ้าผู้ใช้ต้องการทราบหน่วยความจำที่เหลือหรือพื้นที่ของฮาร์ดดิสก์ที่เหลืออยู่ ผู้ใช้เพียงพิมพ์คำสั่ง free/df ตัว shell ก็จะทำหน้าเชื่อมต่อและเข้าไปจัดการในหน่วยความจำหรือฮาร์ดดิสก์ให้ตรวจสอบตัวเองว่าขณะนี้มีการใช้งานเก็บข้อมูลไปเท่าไหร่แล้วและเหลือพื้นที่ให้ใช้งานได้อีกเท่าไหร่ ซึ่งขบวนการดังที่ได้กล่าวข้างต้นเป็นการติดต่อสื่อสารในระดับล่างที่เรียกว่าระดับเคอร์เนล ซึ่งถือได้ว่าเป็นแกนกลางสำคัญในการควบคุมการทำงานระบบทั้งหมดภายในเครื่องคอมพิวเตอร์ โดยจะกล่าวถึงรายละเอียดของเคอร์เนลในบทถัดๆไป

นอกจากนั้น shell ยังสามารถรองรับการเขียนชุดคำสั่งมากกว่าหนึ่งคำสั่งพร้อมกัน และสามารถรับชุดคำสั่งล่วงหน้าให้ทำงานตามเงื่อนไขต่างๆที่ได้กำหนดไว้ในลักษณะสคริปท์ (Script) ที่ถูกเก็บลงในไฟล์ได้ ทำให้เพิ่มความสะดวกและมีประสิทธิภาพในการใช้งานระบบปฏิบัติการลีนุกซ์ โดยเฉพาะผู้ใช้ที่มีทักษะอยู่ระดับหนึ่งในการเขียนสคริปท์หรือที่เรียกกันว่าเชลล์สคริปท์ (Shell script) นั้น และนอกจากนั้นลูกเล่นความสามารถจะมากน้อยเพียงใดก็ยังขึ้นอยู่กับยี่ห้อหรือรุ่นโปรแกรม shell นั้นด้วย ในปัจจุบัน shell ที่มีอิทธิพลและเป็นที่นิยมมากที่สุดตัวหนึ่งคือ Bourne shell (ปัจจุบันกลายเป็น Bourne Again shell) และ C shell

ตัวอย่างการแสดง prompt ในรูปแบบต่างๆ เมื่อเข้าสู่ระบบปฏิบัติการในฐานะผู้ใช้ทั่วไป

[ee-server@wiroon]$ หรือ
wiroon@ee-server:~$ หรือ
$

นอกจากนั้นเมื่อผู้ใช้ต้องการเข้าในฐานะผู้ดูแลระบบที่เรียกว่า Superuser หรือ root โดยใช้คำสั่ง sudo su เพื่อเปลี่ยนมาเป็น root ดังคำสั่งข้างล่างนี้

$ sudo su
[sudo] password for wiroon: 
root@EE-Server:/home/wiroon# 

จากคำสั่งข้างต้นเมื่อผู้ใช้ระบุรหัสผ่านของ Superuser แล้ว ก็แสดงผลของ prompt นั้นจากเดิมใช้สัญลักษณ์ “$” ก็จะถูกเปลี่ยนเป็นสัญลักษณ์ “#” เพื่อบอกให้สามารถถึงการเปลี่ยนมาอยู่ในฐานะ root เรียบร้อยแล้ว

ตัวแปรสภาพแวดล้อมของระบบ (Environment Variable)

ตัวแปรสภาพแวดล้อม (Environment variables) เป็นตัวแปรที่มีความสำคัญมากในระบบปฏิบัติการลีนุกซ์ เนื่องจากเป็นตัวแปรกลางที่ shell หรือ โปรแกรมประยุกต์ต่างๆสามารถเรียกใช้งานได้ อาทิเช่น ตัวแปรที่เก็บข้อมูลของ shell หรือตัวแปรที่เก็บข้อมูลของไดเรกทอรีประจำตัวของผู้ใช้ (Home Directory) และยังมีตัวแปรต่างๆ อีกมากมายที่ shell ได้มีการตั้งค่าไว้ในขณะที่ shell เริ่มทำงาน ตัวอย่างเช่น bash shell จะมีการเรียกไฟล์เริ่มต้นอยู่ 2 ไฟล์ได้แก่ ไฟล์ ~/.profile และไฟล์ ~/.bashrc

$ cat .profile  
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
export USE_CCACHE=0
export CCACHE_DIR=~/ccache
export JAVA_HOME=/usr/lib/jvm/jdk
export ANT_HOME=~/android/ant
export ANDROID_SDK_HOME=~/android/sdk
export ANDROID_NDK_HOME=~/android/ndk
export AOSP_HOME=~/aosp
export PATH=$HOME/bin:$JAVA_HOME/bin:$ANT_HOME/bin:$ANDROID_SDK_HOME/tools:$ANDROID_SDK_HOME/platform-tools:$ANDROID_NDK_HOME:$PATH

$ cat .bashrc
# .bashrc
# User specific aliases and functions
HISTSIZE=1000
HISTFILESIZE=2000
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'


# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

ในกรณีที่เป็น zsh shell ซึ่งในปัจจุบันกำลังได้รับความนิยม จะอ้างอิงไฟล์ ~/.zshrc

$ cat ~/.zshrc                                                                                                   ─╯
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel10k/powerlevel10k"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled  # disable automatic updates
# zstyle ':omz:update' mode auto      # update automatically without asking
# zstyle ':omz:update' mode reminder  # just remind me to update when it's time

# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(common-aliases history git zsh-autosuggestions zsh-syntax-highlighting kubectl emoji encode64 dirhistory web-search macos sudo web-search copyfile copybuffer colored-man-pages command-not-found pip python rust brew docker golang history-substring-search iterm2)

eval $(/usr/bin/thefuck --alias fix)
eval $(/usr/bin/thefuck --alias wtf)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias ..="cd .."
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias ..4="cd ../../../.."
alias ..5="cd ../../../../.."

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

export FREERTOS_PATH=/opt/FreeRTOS_202212.00/
export PICO_SDK_PATH=/home/wiroon/bdh/freertos/rpi_pico/pico-sdk
export PATH="$PATH:/home/wiroon/bdh/freertos/rpi_pico/pico-toolbox/makepico"

asciicast ตัวอย่างการติดตั้ง Oh-My-Zsh Shell

เมื่อผู้ใช้เข้าสู่ระบบ Login โดยการใช้งานผ่านหน้าจอเทอร์มินัลซึ่งนิยมเรียกสั้นๆว่า tty (Teletypewriter) เมื่อหน้าจอเทอร์มินัลถูกสร้างขึ้น ตัวโปรแกรมสำหรับการเข้าสู่ระบบก็จะถูกเรียกขึ้นมาเพื่อแสดงข้อความให้ผู้ใช้กรอกชื่อผู้ใช้ (username) และรหัสผ่าน (password) เมื่อเข้าสู่ระบบได้สำเร็จก็จะทำการเรียกโปรแกรม shell เพื่ออ่านค่าพื้นฐานที่ตั้งไว้สำหรับสภาพแวดล้อมของระบบ (system environments) ดังขั้นตอนในรูปข้างล่าง

แสดงรายชื่อ Shells ที่มีอยู่ในระบบ Linux โดยดูจากไฟล์ /etc/shells

$ cat /etc/shells                                                                                                            ─╯
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/usr/bin/sh
/bin/dash
/usr/bin/dash
/bin/zsh
/usr/bin/zsh
/usr/bin/screen

ตัวอย่างการตรวจสอบชนิดของ shell ที่กำลังใช้งานอยู่ในระบบด้วยคำสั่ง echo และตรวจสอบรุ่นของ shell ด้วย --version

$ echo $SHELL
/bin/bash  
$ bash --version
GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

นอกจากนั้นระบบจะมีการตั้งค่าตัวแปรระบบพื้นฐาน ซึ่งเป็นตัวแปรสำคัญที่จะพบเจอบ่อยได้แก่

ตารางแสดงตัวแปรระบบ

ชื่อคำอธิบาย

USER

เรียกชื่อผู้ใช้งานที่ใช้ในการเข้าสู่ระบบ

UID

เรียกรหัสผู้ใช้งานที่ใช้ในการเข้าสู่ระบบ

HOME

เรียก Home Directory

PWD

เรียก Directory ที่กำลังใช้งาน

SHELL

เรียกชื่อ shell ที่กำลังใช้งาน

$

เรียก process id ที่กำลังใช้งาน

PPID

เรียก process id ที่ได้รับการสืบทอดมา

?

The exit code of the last command

คำสั่ง Echo

เป็นคำสั่งที่ใช้ในการแสดงข้อความใดๆที่ต้องการให้ถูกปรากฏบนหน้าต่างเทอร์มินัล ดังตัวอย่างการใช้คำสั่งดังนี้

$ echo Welcome to Embedded System
Welcome to Embedded System!
$ echo Welcome      to       Embedded      System
Welcome to Embedded System!
$ echo 'Welcome      to       Embedded      System'
Welcome      to       Embedded      System!

จากตัวอย่างจะเห็นว่าคำสั่ง echo จะไม่สนใจช่องว่างว่าจะมีกี่ช่องว่าง การแสดงผลจะถูกตัดช่องว่างเหลือเพียง 1 ช่องว่างเสมอ แต่ถ้าต้องการให้แสดงผลลัพธ์ตามระยะห่างที่ต้องการจะต้องใช้เครื่องหมาย อัญประกาศ (‘ -Apostrophe) หรือเครื่องหมายคำพูด (“ - Quotation Mark) ครอบข้อความนั้น เนื่องจากใน Bash shell นั้นจะใช้ white space (โดยการกดปุ่ม space bar) ในการแยกข้อความออกเป็น token หรือเรียกว่า พารามิเตอร์เพื่อใช้ในการแสดงผล แต่ถ้ามีการใส่เครื่องหมายครอบข้อความเช่น ‘Burapha University’ ข้อความนั้นจะถูกเก็บไว้ใน token เพียงตัวเดียว

การใช้งานคำสั่ง echo จะมีตัวเลือก (Option) หลายแบบ (ซึ่งสามารถดูรายละเอียดคำสั่งได้โดยพิมพ์ man echo) ยกตัวอย่างเช่น การใช้ตัวเลือก -n ต่อท้ายคำสั่ง echo จะหมายถึงการไม่ขึ้นบรรทัดใหม่ (New Line)

$ echo -n "My name is Android"
My name is Android$

แต่ถ้าต้องการขึ้นบรรทัดใหม่ตามอักขระพิเศษ \n (new line) ต้องระบุตัวเลือก -e หลังคำสั่ง echo

$ echo -e "My name is \nAndroid"
My name is 
Android

นอกจากอักขระ \n แล้วยังมีอักขระในการควบคุมการแสดงผลข้อความดังรายละเอียดในตารางข้างล่างนี้

ตารางแสดงการใช้งานอักขระพิเศษ

Escape sequenceรายละเอียด

\a

Alert (bell)

\b

Backspace

\c

หยุดการขึ้นบรรทัดใหม่ (ลักษณะเดียวกับการใช้งาน -n)

\f

Form feed

\n

New line

\r

Carriage return

\t

Horizontal tab

ในการใช้งาน Bash shell นั้นยังมีอักขระเฉพาะมากมายที่ไม่สามารถนำมาใช้แสดงเป็นตัวข้อความได้ เนื่องจากถูกใช้เป็นเครื่องมือในการจัดการอินพุทของคำสั่ง เช่น '|', '&', ';', '(', ')', '<', '>' แต่ถ้าต้องการแสดงอักขระเหล่านี้ให้ปรากฏอยู่ในข้อความจะต้องเติมสัญลักษณ์ \ นำหน้าอักขระเสมอ หรือใช้เครื่องหมายอัญประกาศครอบทั้งข้อความที่มีอักขระผสมอยู่ก็ได้

ตัวอย่างการใช้สัญลักษณ์ \ นำหน้าอักขระที่ต้องการแสดงเป็นข้อความ

$ echo I love Linux & Android
[1] 30136
I love Linux
Android: command not found
[1]+  Done                    echo I love Linux
[1]+  Done                    echo I love Linux
$ echo I love Linux \& Android
I love Linux & Android
$ echo 'I love Linux & Android'
I love Linux & Android

env และ export

คำสั่ง export เป็นคำสั่งที่ผู้ใช้งานสามารถสร้างตัวแประบบเพิ่มเติมได้เอง โดยการระบุเข้าไปในไฟล์ .bashrc หรือพิมพ์คำสั่งการตั้งค่าได้โดยตรงใน terminal ดังตัวอย่างข้างล่าง

$ export my_project_codes=/home/student/embedded/sourcecode/

หากผู้ใช้ต้องการดูค่าตัวแประบบที่มีการใช้งานอยู่ สามารถใช้คำสั่ง env หรือ export -p ดังนี้

$ env
ORBIT_SOCKETDIR=/tmp/orbit-student
SSH_AGENT_PID=1383
TERM=xterm
SHELL=/bin/bash
...
USER=student
PATH=/home/student/bin:/usr/lib/jvm/jdk/bin:/home/student/android/ant/bin:/home/student/android/sdk/tools:/home/student/android/sdk/platform-tools:/home/student/android/ndk:/home/student/bin:/home/student/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
my_project_codes=/home/student/embedded/sourcecode/  
ANDROID_SDK_HOME=/home/student/android/sdk
PWD=/home/student
JAVA_HOME=/usr/lib/jvm/jdk
GDM_KEYBOARD_LAYOUT=us
LANG=en_US.utf8
GDM_LANG=en_US.utf8
MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path
GDMSESSION=gnome
SHLVL=1
HOME=/home/student
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=student
DISPLAY=:0.0
AOSP_HOME=/home/student/aosp
LESSCLOSE=/usr/bin/lesspipe %s %s
COLORTERM=gnome-terminal
XAUTHORITY=/var/run/gdm/auth-for-student-9wtySF/database
_=/usr/bin/env


$ export -p
declare -x ANDROID_NDK_HOME="/home/student/android/ndk"
declare -x ANDROID_SDK_HOME="/home/student/android/sdk"
declare -x ANT_HOME="/home/student/android/ant"
...
declare -x USER="student"
declare -x USERNAME="student"
declare -x USE_CCACHE="0"
declare -x WINDOWID="14722574"
declare -x XAUTHORITY="/var/run/gdm/auth-for-student-9wtySF/database"
declare -x XDG_CONFIG_DIRS="/etc/xdg/xdg-gnome:/etc/xdg"
declare -x XDG_DATA_DIRS="/usr/share/gnome:/usr/local/share/:/usr/share/"

ยกตัวอย่างการใช้คำสั่ง echo เพื่อแสดงค่าภายในตัวแประบบ

$ echo $SHELL
/bin/bash


$ echo -e " My Home directory is $HOME\n My username is $USER\n My current directory is $PWD"
 My Home directory is /home/student
 My username is student
 My current directory is /home/student


$ echo $PPID
1927


$ ps -aux | grep 1927
student   1927  0.0  0.5 192052 11236 ?   Sl  08:15  0:33 gnome-terminal

ตารางปรับแต่งการแสดง shell prompt

คำสั่งคำอธิบาย

PS1='\w $ '

แสดงไดเรกทอรีใน shell prompt

PS1='\h $ '

แสดงชื่อ hostname ใน shell prompt

PS1='\u $ '

แสดงชื่อ user ใน shell prompt

PS1='\t $ '

แสดงเวลา 24-hr time format ใน shell prompt

PS1='@ $ '

แสดงเวลา 12-hr time format ใน shell prompt

PS1='! $ '

แสดงหมายเลข history ใน shell prompt

PS1='EE $ '

แสดงชื่อที่กำหนด "EE" ใน shell prompt

รายการประวัติการใช้คำสั่ง (Command History)

คำสั่ง History

เป็นคำสั่งที่ผู้ใช้สามารถใช้แสดงคำสั่งย้อนหลังที่เคยได้เรียกใช้งาน จำนวนคำสั่งย้อนหลังจะถูกเก็บบันทึกไว้มากน้อยแค่ไหนขึ้นอยู่กับการตั้งค่าของตัวแประบบชื่อว่า HISTSIZE โดยรายละเอียดในการใช้คำสั่ง history มีดังนี้

ตารางรายละเอียดคำสั่ง history

คำสั่งคำอธิบาย

history

แสดงรายการคำสั่งย้อนหลังทั้งหมด

history N

แสดงรายการคำสั่งย้อนหลังจำนวน N คำสั่งล่าสุด

history -d N

ลบรายการคำสั่งลำดับที่ N

!!

เรียกคำสั่งย้อนหลังล่าสุด

!N

เรียกคำสั่งย้อนหลังลำดับที่ N

!-N

เรียกคำสั่งย้อนหลังกลับไปที่ N ตัว (!-1 มีค่าเท่ากับ !!)

!#

คำสั่งปัจจุบันที่กำลังเรียกอยู่

!string

คำสั่งที่นำหน้าด้วยคำว่า string

!?string?

คำสั่งที่มีคำว่า string บรรจุอยู่

ตัวอย่างคำสั่ง

$ echo $$
3616
$ env -i bash -c 'echo $$'
3718
$ !!
env -i bash -c 'echo $$'
3719
$ !ec
echo $$
3616
$ !en:s/$$/$PPID/
env -i bash -c 'echo $PPID'
3616
$ history 6
  361  ps -p $$ -o "pid ppid cmd"
  362  echo $$
  363  env -i bash -c 'echo $$'
  364  echo $$
  365  env -i bash -c 'echo $PPID'
  366  history 6
$ history -d20

การใช้คู่มือคำสั่ง (Man Page)

เอกสารการใช้งานคำสั่งต่างๆเมื่อได้ติดตั้งโปรแกรมลงในระบบปฏิบัติการลีนุกซ์ เรียกว่า “Manual Pages” โดยสามารถเรียกดูผ่านคำสั่ง man ดังแสดงในรูปข้างล่าง

จากรูปข้างบนจะแสดงรายละเอียดของการใช้คำสั่ง man เพื่อที่จะเรียกดูเอกสารการใช้งานของคำสั่งสำหรับผู้ใช้ทั่วไป นอกจากนั้นยังสามารถดูเอกสารการใช้งานอื่นๆได้แก่

  • User commands (env, ls, echo, mkdir, tty)

  • System calls หรือ kernel functions (link, sethostname, mkdir)

  • Library routines (acosh, asctime, btree, locale, XML::Parser)

  • Device related information (isdn_audio, mouse, tty, zero)

  • File format descriptions (keymaps, motd, wvdial.conf)

  • Miscellaneous (arp, boot, regex, unix utf8)

  • System administration (debugfs, fdisk, fsck, mount, renice, rpm)

มีอยู่ 2 คำสั่งที่เกี่ยวข้องกับคำสั่ง man คือคำสั่ง whatis และ คำสั่ง apropos โดยคำสั่ง whatis จะทำการค้นหา manual pages สำหรับคำสั่งที่ต้องการทราบ ส่วนคำสั่ง aporpos จะค้นหาคำสำคัญ (Keyword) ใน manual pages ดังตัวอย่างข้างล่าง

$ whatis man
man(1)                   - format and display the on-line manual pages
man.conf(5)              - configuration data for man
zshall(1)                - the Z shell meta-man page
xml2man(1)               - MPGL to mdoc (man page) translator
$ whatis mkdir
mkdir(1)                 - make directories
mkdir(2), mkdirat(2)     - make a directory file
$ apropos mkdir
mkdir(1)                 - make directories
mkdir(2), mkdirat(2)     - make a directory file 

Last updated

Assoc. Prof. Wiroon Sriborrirux, Founder of Advance Innovation Center (AIC) and Bangsaen Design House (BDH), Electrical Engineering Department, Faculty of Engineering, Burapha University