Unix _Solaris_笔记

来源:互联网 发布:it狂人 知乎 编辑:程序博客网 时间:2024/06/05 13:34
  1. ---------------Chapter 1---------------
  2. Basic Unix and Solaris Concepts
  3. shell type
  4.     Bourne shell  sh
  5.     Korn shell ksh
  6.     C shell csh
  7.     Bourne-again shell bash
  8.     tcsh
  9. filesystem
  10.     opt
  11.     etc
  12.     dev
  13.     usr
  14.     kernel
  15.     var
  16.     export
  17. User Accounts
  18.     /etc/passwd
  19.         root    :x  :0  :1:Super User:/:bin/sh
  20.             需要密码    组id
  21.     /etc/shadow
  22. ---------------Chapter 2---------------
  23. Basic Unix Commands
  24. Syntax
  25. $Command [options][arguments]
  26. 256 one line
  27. different from DOS
  28.     Case sensitive
  29.     different command prompt:/
  30. clear
  31. pwd
  32. id      id root     id -a root 
  33. cd ..(parent directory) ~(home) .(current)
  34. ls -a -R -t -l
  35.     -F filetype
  36.         /
  37.         *可执行
  38.         (none)文本
  39. chmod
  40.     chmod g/u/a +/- r/w/x filename
  41.     chmod 766 filename
  42. touch
  43. mkdir   -p(无父目录,一次创建)
  44. cp  -i(提示覆盖)-r(复制目录)
  45. mv  -i(move or rename file and directories)
  46. rm  -i -r
  47. rmdir   (empty_dir)
  48. ln [-s] source_file target_file
  49.     硬链接ln /unix/02/text.txt tt删除源文件还可以用
  50.     软链接ln -s /unix/02/text.txt tt
  51. man
  52. ---------------Chapter 3---------------
  53. Metacharacters 元字符
  54. ls   d*(zero or more)
  55. ls   d?(single character)
  56. ls  [b-f]b* (match a set or range ,single character )
  57. ;   enter multiple commands on a command line cd;ls
  58. >   output to a file  cal >a.txt
  59. <   input from file instead of keyboard
  60. >>  append to output to a existing file
  61. piping  takes the output of one command and passes it as input into a fallowing command
  62.     ls -l /etc | more
  63.     ls -l /etc | tee -a etc.lst
  64. tee 指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。
  65. ---------------Chapter 4---------------
  66. Text Viewer or Editor
  67. cat filename(s)
  68.     cat /dev/null >cat1.txt 清空文件
  69.     cat /etc/passwd | awk -F: '{print $1 "/t" $6}' /
  70.     显示部分信息  以:为间隔   一部分和六部分 无空格
  71. more    
  72. head
  73. tail
  74. vi
  75.     ^ 行首
  76.     $ 行尾
  77.     G 文件尾
  78.     1G 文件头
  79.     nG n行
  80.     H 屏幕头
  81.     M 屏幕中
  82.     L 屏幕底
  83.     Ctrl+f 下翻
  84.     Ctrl+b 上翻
  85.     插入i a o O
  86.     删除x dw 3dw dd 5dd :5,10d
  87.     修改r cw cc C
  88.     复制移动yw yy/Y dw dd p 
  89.         :1,2co3复制行1,2在行3后
  90.         :4,5m6移动4,5在6后
  91.     保存  :w  
  92.         :w newfile
  93.         :wq
  94.         :q!
  95.     高级
  96.         ~   改变大小写
  97.         J   当前行和下一行连接
  98.         u   废除
  99.         :set nu 显示行号
  100.         :2l 光标停留在指定行
  101.         21G 光标停留在指定行
  102.         /串  往下查找
  103.         ?串  往上查找
  104.         n   继续查找
  105.         :r file2    插入文件
  106.         :l,$s/旧串/新串/g       替换全文(:%s/旧串/新串/g)
  107. ---------------Chapter 5---------------
  108. Find things on unix
  109. users 
  110. who
  111. who am i
  112. whoami
  113. find path expression[action]
  114.     find / -name perl
  115.     find . -mtime 10 -print
  116.     find /etc-user 0 -size +400 -print
  117.     find ~ -perm 777 >~/holes
  118.     find /export/home -type f -atime +365 -exec rm {} /;
  119. grep    到文件内查找
  120.     grep root /etc/passwd
  121.     ls -la | grep -i 'sep 1'(-i case non-sensitive)
  122.     ls file*|xargs grep dd
  123. wc  计算单词,字符,行数
  124.     wc [option]filename(s)
  125.     -l Conts lines
  126.     -w Counts words
  127.     -C Counts characters
  128. du  硬盘使用
  129. ps  /usr/bin/ps
  130.     -e  list every process now running
  131.     -f  Generates a full listing
  132.     -U uidlist processes whose real UID or login names age given
  133.     ps -ef | grep talnet  列出telnet进程
  134. kill [-signal] process -id
  135.     kill pid
  136.     kill -9 pid(force)
  137.     sleep pid & 后台执行
  138.     pkill sleep 按名称关闭
  139. job control
  140.     jobs display which jobs are currently running
  141.     fg %n (job num)
  142.     bg %n (job num)
  143.     stop %n(bash不可用)(pid)
  144.     kill %n (pid )
  145.     Control+c
  146.     Control+z
  147. ---------------Chapter 6---------------
  148. network basic
  149. ping 
  150. ifconfig
  151. netstat 
  152. telnet
  153. rlogin
  154. ftp
  155.     cd,lcd
  156.     dir
  157.     bye
  158.     bin,asc
  159.     get,put,mget,mput
  160.     hash
  161.     prompt
  162. ---------------Chapter 7---------------
  163. Unix shell
  164. change Environment variables
  165. Cshell
  166.     %setenv
  167.     %echo
  168.     %csh
  169. path
  170. Bshell
  171. alias
  172. source
  173. export
  174. crontab -l -r -e
  175. mailx
  176. 定时服务