ls | wc command : Using ls|wc, we can count new lines, words and letters of all files of current directory. We can see from the following after execution of the code we get same results.
Approach : First, we have to use pipe for inter process communication over an array where a is used for reading and a is used for writing. We can replicate the process using fork. In the parent process, standard output is closed so that output of ls command will go to a and similarly standard input is closed in children process. Now, if we run the program output will be as same as command of linux ls|wc.
Below is the implementation of above approach :
- Implementation of a Falling Matrix
- Decision tree implementation using Python
- Binary Tree (Array implementation)
- TCP Server-Client implementation in C
- UDP Server-Client implementation in C
- UDP Client Server using connect | C implementation
- Implementation of Locking in DBMS
- Johnson’s algorithm for All-pairs shortest paths | Implementation
- Java Implementation of Deffi-Hellman Algorithm between Client and Server
- Array implementation of queue (Simple)
- Hamming Code implementation in Python
- Types of JVM Garbage Collectors in Java with implementation details
- Box Blur Algorithm - With Python implementation
- Shortest Path Problem Between Routing Terminals - Implementation in Python
- Bloom Filters - Introduction and Implementation
- Impact of free open Source Software in ERP Implementation
- How to find time taken by a command/program on Linux Shell?
- mindepth and maxdepth in Linux find() command for limiting search to a specific directory.
- Netstat command in Linux
- Practical applications of 'ls' command in Linux
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.