Your SlideShare is downloading. ×
Managing DocumentsObjectivesIn this lesson, you will learn to: Identify the standard input, output, and error files Use in...
Managing DocumentsStandard Files Standard Input File    The keyboard is referred to as the standard input     file     In ...
Managing DocumentsStandard Files (contd) Standard Error File    The monitor is also the standard error file     The file d...
Managing DocumentsRedirectionRedirection changes the assignments for the standardinput, output, and errorInput Redirection...
Managing DocumentsRedirection (contd.) Error Redirection   The following example illustrates the use of error   redirectio...
Managing DocumentsFiltersA filter is a program that takes its input from the standardinput file, processes (or filters) it...
Managing DocumentsFilters (contd.)The grep Filter (contd.)  Options of the grep Filter        -n : This prints each line m...
Managing DocumentsFilters (contd.) The wc Filter     The wc filter is used to count the number of lines,      words, and c...
Managing DocumentsFilters (contd.) The tr Filter     The tr filter can be used to translate one set of      characters to ...
Managing DocumentsJust a Minute…        The details of various customers who have        registered with Diaz Telecommunic...
Managing DocumentsJust a Minute…(contd.)     Write a command to find the number of people      staying in the state of Kan...
Managing DocumentsPipes The vertical bar (|) is the pipe character It indicates to the shell that the output of the comman...
Managing DocumentsJust a Minute…        The details of various customers who have        registered with Diaz Telecommunic...
Managing DocumentsJust a Minute…(contd.)        In the file, the field delimiter is ,. The various fields        are Custo...
Managing DocumentsLocating Files in Linux The find Command    find [path] [expression]     The find command is used to lo...
Managing DocumentsFile Access Permissions (FAPs) File Access Permissions (FAPs) refer to the  permissions associated with ...
Managing DocumentsAssigning Permissions to Files The chmod command    chmod mode file/s     The chmod command is used to c...
Managing DocumentsSummaryIn this lesson, you learned that: You can redirect input, output, and errors to a file  other tha...
Managing DocumentsSummary (contd.) The cut filter is used when specific columns from the  output of certain commands (or f...
Managing DocumentsSummary (contd.) The find command is used to search for a file The FAPs can be changed using the chmod c...
Upcoming SlideShare
Loading in...5
×

03 t1 s2_linux_lesson3

271

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
271
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "03 t1 s2_linux_lesson3"

  1. 1. Managing DocumentsObjectivesIn this lesson, you will learn to: Identify the standard input, output, and error files Use input, output, and error redirection Identify the features and options of the grep, wc, cut, and tr filters Combine multiple commands by using Pipes Locate a file by using the find command Assign File Access Permissions (FAPs)©NIIT Linux/Lesson 2/Slide 1 of 20
  2. 2. Managing DocumentsStandard Files Standard Input File The keyboard is referred to as the standard input file In Linux, all the open files, including the standard files, are assigned a number called the file descriptor. The file descriptor 0 is assigned to the standard input file Standard Output File The monitor is referred to as the standard output file The file descriptor 1 is assigned to the standard output file©NIIT Linux/Lesson 2/Slide 2 of 20
  3. 3. Managing DocumentsStandard Files (contd) Standard Error File The monitor is also the standard error file The file descriptor 2 is assigned to the standard error file©NIIT Linux/Lesson 2/Slide 3 of 20
  4. 4. Managing DocumentsRedirectionRedirection changes the assignments for the standardinput, output, and errorInput Redirection The following example illustrates the use of input redirection: $ cat test1 EnterOutput Redirection The following example illustrates the use of output redirection: $ cat test1 test2©NIIT Linux/Lesson 2/Slide 4 of 20
  5. 5. Managing DocumentsRedirection (contd.) Error Redirection The following example illustrates the use of error redirection: $ cat datafile 2 error-mesg Enter©NIIT Linux/Lesson 2/Slide 5 of 20
  6. 6. Managing DocumentsFiltersA filter is a program that takes its input from the standardinput file, processes (or filters) it, and sends its output tothe standard output fileThe grep Filter The grep filter searches a file for a particular pattern of characters and displays all the lines that contain that pattern. The pattern that is searched for is referred to as a regular expression grep regular_expression [filename]©NIIT Linux/Lesson 2/Slide 6 of 20
  7. 7. Managing DocumentsFilters (contd.)The grep Filter (contd.) Options of the grep Filter -n : This prints each line matching the pattern along with its line number -c : This prints only a count of the lines that match a pattern -v : This prints all the lines that do not match the pattern specified by the regular expression©NIIT Linux/Lesson 2/Slide 7 of 20
  8. 8. Managing DocumentsFilters (contd.) The wc Filter The wc filter is used to count the number of lines, words, and characters in a disk file or in the standard input wc [-lwc] [filename/s ] The cut Filter The cut filter is useful when specific columns from the output of certain commands (such as ls, who) need to be extracted cut [options] [filename/s]©NIIT Linux/Lesson 2/Slide 8 of 20
  9. 9. Managing DocumentsFilters (contd.) The tr Filter The tr filter can be used to translate one set of characters to another $ tr : /etc/passwd©NIIT Linux/Lesson 2/Slide 9 of 20
  10. 10. Managing DocumentsJust a Minute… The details of various customers who have registered with Diaz Telecommunications are stored in the Customers file. The sample data of the file is as follows: 000001,Angela,Smith,16223 Radiance Court,Kansas City,Kansas 000002,Barbara,Johnson,227 Beach Ave.,Alexandria,Virginia 000003,Betty,Williams,1 Tread Road,Dublin,Georgia©NIIT Linux/Lesson 2/Slide 10 of 20
  11. 11. Managing DocumentsJust a Minute…(contd.) Write a command to find the number of people staying in the state of Kansas Write a command to display the complete details along with the line number in which the details are present for the customer Linda©NIIT Linux/Lesson 2/Slide 11 of 20
  12. 12. Managing DocumentsPipes The vertical bar (|) is the pipe character It indicates to the shell that the output of the command before ‘|’ is to be sent as input to the command after ‘|’ The tee Command The tee command takes standard input and writes to standard output to file(s) If the file where data is to be written does not exist, the file is created If the file already exists, its contents are overwritten cat temp | tee temp1 temp2©NIIT Linux/Lesson 2/Slide 12 of 20
  13. 13. Managing DocumentsJust a Minute… The details of various customers who have registered with Diaz Telecommunications are stored in the Customers file. Sample data from the file is as follows: 000001,Angela,Smith,16223 Radiance Court,Kansas City,Kansas 000002,Barbara,Johnson,227 Beach Ave.,Alexandria,Virginia 000003,Betty,Williams,1 Tread Road,Dublin,Georgia©NIIT Linux/Lesson 2/Slide 13 of 20
  14. 14. Managing DocumentsJust a Minute…(contd.) In the file, the field delimiter is ,. The various fields are CustomerCode, FirstName, LastName, Address, City, and State. Write a command to display only the FirstName and the LastName of the customers living in Georgia©NIIT Linux/Lesson 2/Slide 14 of 20
  15. 15. Managing DocumentsLocating Files in Linux The find Command find [path] [expression]  The find command is used to locate a file in a particular directory and in all its subdirectories. It is the most commonly used command for locating files and has various options for advanced searches©NIIT Linux/Lesson 2/Slide 15 of 20
  16. 16. Managing DocumentsFile Access Permissions (FAPs) File Access Permissions (FAPs) refer to the permissions associated with a file with respect to the following:  The file owner  The group owner  Other users©NIIT Linux/Lesson 2/Slide 16 of 20
  17. 17. Managing DocumentsAssigning Permissions to Files The chmod command chmod mode file/s The chmod command is used to change the permissions associated with a file or a directory. There are two modes for assigning the permissions: • Symbolic mode – the permissions and the type of users for whom the permission is to be granted are given in symbols. • Absolute mode – In this, a series of digits is used to represent the actual permissions.©NIIT Linux/Lesson 2/Slide 17 of 20
  18. 18. Managing DocumentsSummaryIn this lesson, you learned that: You can redirect input, output, and errors to a file other than the standard files by the file descriptors along with the redirection symbols, and The output and error(s) of a command can be appended to another file using the symbol The grep filter searches the standard input or a file for a particular pattern of characters, and displays all lines that contain that pattern The wc filter counts the number of lines, words, and characters in a disk file or in the standard input©NIIT Linux/Lesson 2/Slide 18 of 20
  19. 19. Managing DocumentsSummary (contd.) The cut filter is used when specific columns from the output of certain commands (or files) need to be extracted The tr filter is used to translate one set of characters to another A pipe is a feature through which the standard output of a command or user program can be sent as the standard input to another command or user program The tee command takes standard input and writes to standard output and to file(s)©NIIT Linux/Lesson 2/Slide 19 of 20
  20. 20. Managing DocumentsSummary (contd.) The find command is used to search for a file The FAPs can be changed using the chmod command©NIIT Linux/Lesson 2/Slide 20 of 20

×