《aix系统应用基础usingfiles.pptx》由会员分享,可在线阅读,更多相关《aix系统应用基础usingfiles.pptx(18页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、 Copyright IBM Corporation 2008Unit ObjectivesAfter 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 named file Use the ln command to allow a file to have more t
2、han one name Display the contents of a file using the cat,pg,and more commandsUse the rm command to remove files Print files第1页/共18页 Copyright IBM Corporation 2008To copy the file/home/team03/pgms/suba to/home/team01/doc and name it programa:$pwd/home/team01/doc$cp/home/team03/pgms/suba programamon_
3、reporttrio_ltrwalrushometeam01docmon_reportprogramatrio_ltrwalrushometeam01doccp source targetcp file1 file2.target_dir beforeafterCopying Files第2页/共18页 Copyright IBM Corporation 2008$cd/home/team01$cp doc/programa test1 chometeam01.profilemanualstest1cdocprogramahometeam01.profilemanualstest1cprogr
4、amaprogramatest1dochometeam01ctrio_ltrtrio_ltrdochometeam01ctrio_ltrdoc$cd/home/team01/doc$cp trio_ltr./ccp Examples第3页/共18页 Copyright IBM Corporation 2008$pwd/home/team01/c$mv trio_ltr t.letterhometeam01ctrio_ltrhometeam01ct.lettermv source target mv file1 file2.target_dir Moving and Renaming Files
5、第4页/共18页 Copyright IBM Corporation 2008$pwd/home/team01/c$mv t.letter./doc/letterhometeam01cmon_reportdochometeam01ctrio_ltrletterdochometeam01ctrio_ltrt.letterdochometeam01cmon_reportdoc$pwd/home/team01/c$mv./doc/mon_report.mv Examples第5页/共18页 Copyright IBM Corporation 2008$cat walrusThe time has c
6、ome,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.From The Walrus And The Carpenterby Lewis Carroll(1871)cat file1 file2.Listing File Contents第6页/共18页 Copyright IBM Corporation 2008pg filenam
7、emore filename$pg walrusThe 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.:one page at a time$more walrusThe time has come,the Walrus said,To talk of many things:Of shoes-and sh
8、ips-and sealing wax-Of cabbages-and kings-And why the sea is boiling hot-And whether pigs have wings.walrus(100%)Displaying Files第7页/共18页 Copyright IBM Corporation 200817126 1085 myfilecharacterswordslineswc CommandThe wc command counts the number of lines,words,and bytes in a named file:$wc-c-l-w f
9、ilenameOptions:-ccounts the number of bytes-lcounts lines-wcounts wordsExample:$wc myfile第8页/共18页 Copyright IBM Corporation 2008ActivityActivity:Working with the wc Command第9页/共18页 Copyright IBM Corporation 2008 Allows files to have more than one name in the directory structure Both files reference
10、the same i-node Cannot be used with directories,cannot span file systemsln source_file target_file Linking Files$ls li63-rw-r-r-2 team01 staff 1910 Nov 21 14:19 man_files$ln man_files manuals$ls-li63-rw-r-r-2 team01 staff 1910 Nov 21 14:19 man_files63-rw-r-r-2 team01 staff 1910 Nov 21 14:19 manuals$
11、第10页/共18页 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 directories and span file systemsln s source_file target_file Linking Files(cont.)$ls li63-rw-r-r-2 team01 staff 1910 Nov 21 14:19 man_file
12、s$ln s man_files manuals$ls-li63-rw-r-r-1 team01 staff 1910 Nov 21 14:19 man_files66 lrwxrwxrwx 1 team01 staff 1910 Nov 21 14:19 manuals-man_files$第11页/共18页 Copyright IBM Corporation 2008rm file1 file2 file3.Removing Files$lsmon_report trio_ltr walrus$rm mon_report$lstrio_ltr walrus$rm i walrusrm:re
13、move walrus?y$lstrio_ltr$第12页/共18页 Copyright IBM Corporation 2008Printing Fileslqprt-queue files to the printerlqchk display the current status of a print queuelqcan cancel a print job(specify job number)$qprt walrus$qchkQueue Dev Status Job Files User PP%Blks Cp Rnklp0 lp0 Running 99 walrus team01
14、1 1 1 1$qcan x 99$第13页/共18页 Copyright IBM Corporation 2008Checkpoint1.What is the effect of the following commands?$cd/home/team01$cp file1 file22.What is the effect of the following commands?$cd/home/team01$mv file1 newfile3.What is the effect of the following commands?$cd/home/team01$ln newfile my
15、file4.List commands that can be used to view the contents of a file.第14页/共18页 Copyright IBM Corporation 2008Checkpoint Solutions1.What is the effect of the following commands?$cd/home/team01$cp file1 file2The cp command creates a new file,file 2 from a copy of file1.Each copy will have a different n
16、ame,as shown,file1 and file2.The two copies are independent of each other.If one file is modified,it does not reflect in the second file.2.What is the effect of the following commands?$cd/home/team01$mv file1 newfileThese commands will rename file1 to newfile.file1 will no longer exist,but instead b
17、e shown as newfile.3.What is the effect of the following commands?$cd/home/team01$ln newfile myfileThe file called newfile is now know as myfile.An ls-l will show both files.An ls li will show that both files share the same node number.Note that there is still only one physical file on disk.If a cha
18、nge is made to newfile that change will also be reflected if using myfile.4.List commands that can be used to view the contents of a file.cat,pg,more第15页/共18页 Copyright IBM Corporation 2008Exercise:Using Files第16页/共18页 Copyright IBM Corporation 2008Unit SummaryThe cp command can be used to copy file
19、s.The mv command can be used to move and rename files.The ln command can be used to create additional names for a file.Display the contents of a file using cat,pg,or more.Use the rm command to delete files.Use the qprt command to print files.The wc command could be used to count words or lines from files or command output.第17页/共18页 Copyright IBM Corporation 2008感谢您的观看!第18页/共18页