2015年8月17日 星期一

Chapter 1. Accessing the Command Line.

  1. The bash shell
    A command line  is a text-based interface.

    Shell prompt :
    regular user : $
    superuser(root) : #
     
  2. Virtual  consoles
    Users access the bash shell through a terminal.
    Another way to access a shell is from a virtual console.

    With a graphical environment running,access a text login prompt
    on a virtual console by holding Ctrl+Alt and pressing a function
    key (F2 through F6). Press Ctrl+Alt+F1to return to the first virtual
    console and the graphical desktop.
     
  3. Shell  basics : Command -[Options] Arguments
    For example : usermod -L morgan
    指令繁多,要善用 --help 查詢參數
     
  4. The  GNOME  desktop environment

    圖形化介面操作,有些快速鍵與視窗介面配置
    和Windows的設置不同,須熟悉
    另外,要會登出、登入、切換使用者、變更密
    碼、鎖定、重新啟動、關機等基本操作

    GNOME Help 
    # yelp
    GNOME Help : Getting Started with GNOME
    # yelp help:gnome -help/getting -started
     
  5. Basic command  syntax

    ※ 要善用 Tab 鍵的自動完成(Tab completion)

    # date
    Sat Apr  5 08 : 13 : 50 PDT 2014
    列出本機當前日期與時間

    # date +%R
    08 : 13
    以24小時制格式,列出本機當前時間的時與分

    # date +%x
    04/05/2014
    以mm/dd/yy的格式,列出本機當前日期的月/日/年

    # passwd
    修改當前登入帳號的密碼

    # file <filename>
    顯示 <filename> 的檔案類型

    # head -n <Number> <filename>
    顯示 <filename> 檔案前 <Number> 行的內容

    # tail -n <Number> <filename>
    顯示 <filename> 檔案後 <Number> 行的內容

    # wc [Options] <filename>
    -l     顯示 <filename> 的行數
    -w   顯示 <filename> 的字數
    -c    顯示 <filename> 的 byte 數

    # history
    顯示使用者曾經輸入過的指令
    !number 可直接執行該編號的指令
    !string    可執行最近一次所執行過的指令,其開頭為指定的字符串
     
  6. Editing the command line