tailieunhanh - Module Linux essentials - Module 8: Pipes, redirection and REGEX

Module Linux essentials - Module 8 introduce pipes, redirection and REGEX. After studying this chapter you should be able to understand pipes, redirection and partial POSIX; understand how to search and extrac data from files. Inviting you to refer. | Module 8 Pipes, Redirection and REGEX Exam Objective Searching and Extracting Data from Files Objective Summary Piping and redirection Partial POSIX Command Line and Redirection Command Line Pipes The pipe character ( | ) can be used between two commands to send the output of the first as input to the second: ls /etc | head The output of ls /etc is sent to head as input. Command Line Pipelines Multiple commands can be combined to form pipelines. The order in which commands are added to the pipeline can affect the output: nl is a command to number lines 5 I/O Redirection Three Input/Output (I/O) streams associated with every command: Standard Input (STDIN) is normally provided by the user via the keyboard. Standard Output (STDOUT) is the output produced by the command when operating correctly. STDOUT normally appears in the same window as where command executed. Standard Error (STERR) is the is the output produced by the command when an error has occurred. STDOUT normally appears in the same window as where command executed. I/O Redirection Symbols Summary of redirection possible with the bash shell: /path/to/file (Redirect STDOUT overwriting file) >> /path/to/file (Redirect STDOUT appending file) 2> /path/to/file (Redirect STDERR overwriting file) 2>> /path/to/file (Redirect STDERR appending file) &> /path/to/file (Redirect STDERR and STDOUT overwriting file) &>> /path/to/file (Redirect STDERR and STDOUT appending file) The null device The null device is represented by the /dev/null file. (Otherwise known as the “Bit Bucket”) This file is very useful in redirection of input and output. This file serves two purposes: any output redirected to /dev/null is discarded. /dev/null can be used for input to provide a stream of null values. STDIN, STDOUT, and STDERR STDIN or 0 Standard Input (STDIN) normally is provided by the keyboard but can be redirected with the < symbol. STDIN can be read by programs to get data for them | Module 8 Pipes, Redirection and REGEX Exam Objective Searching and Extracting Data from Files Objective Summary Piping and redirection Partial POSIX Command Line and Redirection Command Line Pipes The pipe character ( | ) can be used between two commands to send the output of the first as input to the second: ls /etc | head The output of ls /etc is sent to head as input. Command Line Pipelines Multiple commands can be combined to form pipelines. The order in which commands are added to the pipeline can affect the output: nl is a command to number lines 5 I/O Redirection Three Input/Output (I/O) streams associated with every command: Standard Input (STDIN) is normally provided by the user via the keyboard. Standard Output (STDOUT) is the output produced by the command when operating correctly. STDOUT normally appears in the same window as where command executed. Standard Error (STERR) is the is the output produced by the command when an error has occurred. STDOUT normally appears .

TỪ KHÓA LIÊN QUAN