Ubuntu 18.04 – Shell commands man, grep and pipe |

Pipe connects to commands, <span>Ubuntu 18.04 – Shell commands man, grep and pipe |</span>, KandZ

If you want to see the manual/help of each command you use man. For example if you want to see the manual of ls command then you type:

man ls
Pipe connects to commands, <span>Ubuntu 18.04 – Shell commands man, grep and pipe |</span>, KandZ

You can scroll down to see all the manual. To close the manual you just press q

grep – searches for a pattern in a file. For example I want to search the file file.txt if it has Hello

grep Hello file.txt
Pipe connects to commands, <span>Ubuntu 18.04 – Shell commands man, grep and pipe |</span>, KandZ

You can combine two commands together with the help of pipe | . What pipe does is that takes the output of one command and send it as input to the next command.

ls | grep file
Pipe connects to commands, <span>Ubuntu 18.04 – Shell commands man, grep and pipe |</span>, KandZ

ls displays all the files and directories. grep searches for a pattern, and now it is searching for the pattern “file”. What pipe does? It took the result of the ls command(output) and gave it to the input of the grep command. So now grep searches for the “file” not in a specific file as the first example, but in the output of the ls.

ls | grep txt
Pipe connects to commands, <span>Ubuntu 18.04 – Shell commands man, grep and pipe |</span>, KandZ

Now grep searches for the pattern “txt” in the results of the ls command.

THE END!!!

62660cookie-checkUbuntu 18.04 – Shell commands man, grep and pipe |Ubuntu 18.04 – Shell commands man, grep and pipe |

Related posts

One Thought to “Ubuntu 18.04 – Shell commands man, grep and pipe |

  1. […] Ubuntu 18.04 – Shell commands man, grep and pipe | […]

Comments are closed.