aix系统应用基础05usingfiles_第1页
aix系统应用基础05usingfiles_第2页
aix系统应用基础05usingfiles_第3页
aix系统应用基础05usingfiles_第4页
aix系统应用基础05usingfiles_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 Copyright IBM Corporation 2008,Unit 5 Using Files, Copyright IBM Corporation 2008,Unit Objectives,After completing this unit, you should be able to: Use the cp command to copy files Use the mv command to move or rename files Use the wc command to count the number of lines, words, and bytes in a nam

2、ed file Use the ln command to allow a have more than one name Display the contents of a the cat, pg, and more commands Use the rm command to remove files Print files, Copyright IBM Corporation 2008,To copy the file /home/team03/pgms/suba to /home/team01/doc and name it programa: $ pwd /home/team01/d

3、oc $ cp /home/team03/pgms/suba programa,mon_report trio_ltr walrus,home,team01,doc,mon_report programa trio_ltr walrus,home,team01,doc,cp source target cp file1 file2 . target_dir,before,after,Copying Files, Copyright IBM Corporation 2008,$ cd /home/team01 $ cp doc/programa test1 c,home,team01,.prof

4、ile manuals test1,c,doc,programa,home,team01,.profile manuals test1,c,programa,programa test1,doc,home,team01,c,trio_ltr,trio_ltr,doc,home,team01,c,trio_ltr,doc,$ cd /home/team01/doc $ cp trio_ltr ./c,cp Examples, Copyright IBM Corporation 2008,$ pwd /home/team01/c $ mv trio_ltr t.letter,home,team01

5、,c,trio_ltr,home,team01,c,t.letter,mv source target mv file1 file2 . target_dir,Moving and Renaming Files, Copyright IBM Corporation 2008,$ pwd /home/team01/c $ mv t.letter ./doc/letter,home,team01,c,mon_report,doc,home,team01,c,trio_ltr letter,doc,home,team01,c,trio_ltr,t.letter,doc,home,team01,c,m

6、on_report,doc,$ pwd /home/team01/c $ mv ./doc/mon_report .,mv Examples, Copyright IBM Corporation 2008,$ cat walrus The time has come, the Walrus said, To talk of many things: Of shoes - and ships - and sealing wax - Of cabbages - and kings - And why the sea is boiling hot - And whether pigs have wi

7、ngs. From The Walrus And The Carpenter by Lewis Carroll (1871),cat file1 file2 .,Listing, Copyright IBM Corporation 2008,pg more,$ pg walrus The time has come, the Walrus said, To talk of many things: Of shoes - and ships - and sealing wax - Of cabbages - and kings - And why the sea is boiling hot -

8、 And whether pigs have wings. : ,one page at a time,$ more walrus The time has come, the Walrus said, To talk of many things: Of shoes - and ships - and sealing wax - Of cabbages - and kings - And why the sea is boiling hot - And whether pigs have wings. walrus (100%) ,Displaying Files, Copyright IB

9、M Corporation 2008,17126 1085 myfile,characters,words,lines,wc Command,The wc command counts the number of lines, words, and bytes in a named file: $ wc -c -l -w Options: -ccounts the number of bytes -lcounts lines -wcounts words Example: $ wc myfile, Copyright IBM Corporation 2008,Activity,Activity

10、: Working with the wc Command, Copyright IBM Corporation 2008,Allows files to have more than one name in the directory structure Both files reference the same i-node Cannot be used with directories, cannot span,ln source_,Linking Files,$ ls li 63 -rw-r-r- 2 team01 staff 1910 Nov 21 14:19 man_files $

11、 ln man_files manuals $ ls -li 63 -rw-r-r- 2 team01 staff 1910 Nov 21 14:19 man_files 63 -rw-r-r- 2 team01 staff 1910 Nov 21 14:19 manuals $, Copyright IBM Corporation 2008,Creates an indirect reference to a file (symbolic link) Name references the original files name and path Can be used with direc

12、tories and span,ln s source_,Linking Files (cont.),$ ls li 63 -rw-r-r- 2 team01 staff 1910 Nov 21 14:19 man_files $ ln s man_files manuals $ ls -li 63 -rw-r-r- 1 team01 staff 1910 Nov 21 14:19 man_files 66 lrwxrwxrwx 1 team01 staff 1910 Nov 21 14:19 manuals - man_files $, Copyright IBM Corporation 2

13、008,rm file1 file2 file3 .,Removing Files,$ ls mon_report trio_ltr walrus $ rm mon_report $ ls trio_ltr walrus $ rm i walrus rm: remove walrus?y $ ls trio_ltr $, Copyright IBM Corporation 2008,Printing Files,qprt - queue files to the printer qchk display the current status of a print queue qcan canc

14、el a print job (specify job number),$ qprt walrus $ qchk Queue Dev Status Job Files User PP% Blks Cp Rnk lp0 lp0 Running 99 walrus team01 1 1 1 1 $ qcan x 99 $, Copyright IBM Corporation 2008,Checkpoint,What is the effect of the following commands? $ cd /home/team01 $ cp file1 file2 What is the effe

15、ct of the following commands? $ cd /home/team01 $ mv file1 newfile What is the effect of the following commands? $ cd /home/team01 $ ln new List commands that can be used to view the contents of a file., Copyright IBM Corporation 2008,Checkpoint Solutions,What is the effect of the following commands

16、? $ cd /home/team01 $ cp file1 file2 The cp command creates a new file, file 2 from a copy of file1. Each copy will have a different name, as shown, file1 and file2. The two copies are independent of each other. If one modified, it does not reflect in the second file. What is the effect of the follo

17、wing commands? $ cd /home/team01 $ mv file1 newfile These commands will rename file1 to newfile. file1 will no longer exist, but instead be shown as newfile. What is the effect of the following commands? $ cd /home/team01 $ ln new The new now know as myfile. An ls -l will show both files. An ls li w

18、ill show that both files share the same node number. Note that there is still only one physical disk. If a change is made to new change will also be reflected if using myfile. List commands that can be used to view the contents of a file. cat, pg, more, Copyright IBM Corporation 2008,Exercise: Using Files, Copyright IBM Corporation 2008,Unit Summary,The cp command can be used to copy files. The mv command can be used to

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论