天天看點

菜鳥學Linux 第007篇筆記 簡單指令的使用講解(文本、時間、目錄)

Linux 發行版

Fedora, RedHat(CentOS), SUSU, Debian(Ubuntu, Mint), Gentoo, LFS(Linux From Scratch)

Command

目錄管理(先前節數已經講)

ls、cd、pwd、mkdir、rmdir、tree

檔案管理(先前節數已經講)

touch、stat、file、rm、cp、nano、mv

日期時間(先前節數已經講)

date、clock、hwclock、cal

檢視文本

cat、tac、more、less、head、tail

文本處理

cut、join(用得不多)、sed、awk

文本排序

sort、uniq

文本統計

wc

字元處理

tr

detail of Command

cat concatenate(V.連接配接) files and print on the standard output

-n number all output lines

-A --show-all

-E display $ at end of each line 行結束符

tac concatenate and print files in reverse(反轉)

more  file perusal filter for crt viewing(和less差別到end會退出而less不會)

less opposite of more

head  output the first part of files

tail output the last part of files

-f   output appended data as the file grows; -f, --follow, and --fol-

  low=descriptor are equivalent 檢視檔案尾部,等待顯示後續追加内容

head/tail -n output the first/last N lines

cut  remove sections from each line of files

-d  use DELIM instead of TAB for field delimiter(定界符)

-f  select only these fields;

sort  sort lines of text files

-n  compare according to string numerical value

-r  reverse the result of comparisons(比較)

-t  use SEP instead of non-blank to blank transition(字段分隔符)

-k start a key at POS1, end it at POS2 (origin 1)(從哪裡開始排序)

-u 去除重複 with  -c,  check  for  strict ordering; without -c, output

  only the first of an equal run

-f fold lower case to upper case characters(折疊大小寫 按字翻譯哈哈)

uniq report or omit repeated lines(顯示相鄰重複的行)

-d only print duplicate(重複) lines

-c prefix(字首) lines by the number of occurrences 顯示重複行次數

wc print the number of newlines, words, and bytes in files

-c print the byte counts

-l print the newline counts

-w print the word counts

-L print the length of the longest line

tr translate or delete characters

用法示例: tr 'a-z' 'A-z' < /etc/passwd   将此檔案裡的小字轉換為大寫 <此符号以後會講

-d delete characters in SET1, do not translate

Ctrl+c 中斷目前程式

Shift+Page up/down 在終端裡翻頁(有限會有一部分被删除)

本文轉自Winthcloud部落格51CTO部落格,原文連結http://blog.51cto.com/winthcloud/1856977如需轉載請自行聯系原作者

Winthcloud

繼續閱讀