1. Pipe command symbol "|" function is to use the standard output of the previous command as the standard input for the latter command, in the form: " command a| command B".
The command to find the restricted login user is: grep "/sbin/nologin"/etc/passwd
The command to count the number of lines of text is: Wc-l
The output value of the search order is passed to the statistic command, in fact, as long as the pipe Fu Jian in the middle can be:
grep "/sbin/nologin"/etc/passwd|wc-l
Appendix:
The pipe character command is entirely possible: command a| Command b| command C
2. View the home directory information:
ls/home/
To view information about the ZZZZZ directory:
LS zzzzz/
These two as if the command has been executed successfully, but in fact there is a difference, the former is returned by the standard output , the latter execution fails to return the error output .
Standard input (STDIN, file descriptor 0): The default is input from the keyboard, and 0 indicates the output from other files or commands.
Standard output (STDOUT, file descriptor 1): The default output to the screen, 1 indicates the file.
Error output (STDERR, file descriptor 2): The default output to the screen, 2 indicates the file.
There are these conditions for output redirects:
There are these conditions for the input redirection character:
Empty the original content data:
echo "Jacun" > Test.txt
Append to the original content:
echo "Jacun" >> test.txt
REDIRECT the Test.txt file as input to the wc-l command to calculate the number of rows:
Cat Test.txt | Wc-l
Equivalent to:
Wc-l < Test.txt
Linux should learn this--command set 7 (Pipeline command)