Linux學習筆記(二)命令格式與簡單命令

來源:互聯網
上載者:User
文章目錄
  • 命令格式
  • 更改支援語言
  • 幾個簡單的命令

本文是我讀《鳥哥的Linux私房菜》的學習筆記。

命令格式

命令格式:  command   [-options]   parameter1 parameter2...

例如:

gin@ubuntu :~$  ls -al ~

命令為ls;選項為-al;參數為~    該命令的功能為列出主資料夾下的所有檔案(包括隱藏檔案)與相關的檔案屬性。

其中,-a表示列出主資料夾下的包括隱藏檔案在內的所有檔案,-l表示列出相關的檔案屬性。

注意:

  • 在Linux系統中,命令區分大小寫。
  • 命令太長,則用反斜線(\)來轉移[Enter]字元。([Enter]一般是代表一行命令的開始啟動,這裡以反斜線來進行轉義)
  • 命令中無論有多少個連續空格,則一定當做一個空格看。例如:gin@ubuntu :~$ ls -al ~等同於gin@ubuntu :~$ ls           -al          ~

更改支援語言使用 echo $LANG命令可以顯示當前的支援語言。使用 LANG = en_US 命令可以更改當前支援語言。en_US 代表美國英語。如下: 注意:這僅僅是在當前這次登陸更改了支援語言。

幾個簡單的命令 1.協助命令:--help 2.顯示日期與時間:date 以下是使用 date --help協助命令調出的一些格式  %%   a literal %
  %a   locale's abbreviated weekday name (e.g., Sun)
  %A   locale's full weekday name (e.g., Sunday)
  %b   locale's abbreviated month name (e.g., Jan)
  %B   locale's full month name (e.g., January)
  %c   locale's date and time (e.g., Thu Mar  3 23:05:25 2005)
  %C   century; like %Y, except omit last two digits (e.g., 20)
  %d   day of month (e.g., 01)
  %D   date; same as %m/%d/%y
  %e   day of month, space padded; same as %_d
  %F   full date; same as %Y-%m-%d
  %g   last two digits of year of ISO week number (see %G)
  %G   year of ISO week number (see %V); normally useful only with %V
  %h   same as %b
  %H   hour (00..23)
  %I   hour (01..12)
  %j   day of year (001..366)
  %k   hour, space padded ( 0..23); same as %_H
  %l   hour, space padded ( 1..12); same as %_I
  %m   month (01..12)
  %M   minute (00..59)
  %n   a newline
  %N   nanoseconds (000000000..999999999)
  %p   locale's equivalent of either AM or PM; blank if not known
  %P   like %p, but lower case
  %r   locale's 12-hour clock time (e.g., 11:11:04 PM)
  %R   24-hour hour and minute; same as %H:%M
  %s   seconds since 1970-01-01 00:00:00 UTC
  %S   second (00..60)
  %t   a tab
  %T   time; same as %H:%M:%S
  %u   day of week (1..7); 1 is Monday
  %U   week number of year, with Sunday as first day of week (00..53)
  %V   ISO week number, with Monday as first day of week (01..53)
  %w   day of week (0..6); 0 is Sunday
  %W   week number of year, with Monday as first day of week (00..53)
  %x   locale's date representation (e.g., 12/31/99)
  %X   locale's time representation (e.g., 23:13:48)
  %y   last two digits of year (00..99)
  %Y   year
  %z   +hhmm numeric time zone (e.g., -0400)
  %:z  +hh:mm numeric time zone (e.g., -04:00)
  %::z  +hh:mm:ss numeric time zone (e.g., -04:00:00)
  %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)
  %Z   alphabetic time zone abbreviation (e.g., EDT)簡單例子:
顯示日曆命令:cal命令格式:cal [ [month] year ]如下:計算機:bc退出是quit命令。注意:命令列模式有兩種命令:
  • 一種是該命令會直接顯示結果並返回到命令提示字元,等待下一個命令。例如cal命令。
  • 一種是進入到該命令的環境,知道結束該命令才會回到命令提示字元。例如bc命令。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.