0% found this document useful (0 votes)
41 views1 page

Pipe Questions

The document describes various Linux pipe and redirection commands: 1. It lists commands to display processes by name, list newest and oldest files in a directory, count files in subdirectories, and display disk usage by directory. 2. It provides an example of using a pipe to sort files modified in August by size and display them, skipping four fields and sorting numerically. 3. Another command lists and sorts files in a directory ending in x, saving the output to a file. 4. The final commands are to write a script displaying system information and handling command line arguments for adding numbers, and to create folders and files with various naming patterns using loops and files.

Uploaded by

botcreater
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views1 page

Pipe Questions

The document describes various Linux pipe and redirection commands: 1. It lists commands to display processes by name, list newest and oldest files in a directory, count files in subdirectories, and display disk usage by directory. 2. It provides an example of using a pipe to sort files modified in August by size and display them, skipping four fields and sorting numerically. 3. Another command lists and sorts files in a directory ending in x, saving the output to a file. 4. The final commands are to write a script displaying system information and handling command line arguments for adding numbers, and to create folders and files with various naming patterns using loops and files.

Uploaded by

botcreater
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Pipe and Redirection Commands

1. List process with name gdb


2. Displays the 10 newest files in the current directory.
3. Displays the total number of files in the current working directory and all of its
subdirectories.
4. Displays a list of directories and how much space they consume, sorted from the
largest to the smallest.
5. Using pipe sorts all files in your directory modified in August by order of size, and
prints them to the terminal screen. The sort option +4n skips four fields (fields are
separated by blanks) then sorts the lines in numeric order.
6. List files in directory ending with x. sort the output and save it to file named list
7. Displays the 5 oldest files in the current directory.
8. Store network device or network card device information in a file named network.

1. Write Script to see current date, time, username, and current directory
2. How to write shell script that will add two nos, which are supplied as
command line argument, and if this two nos are not given show error and its
usage
3. Write a shell program
1. Create two folders.
2. create 20 files in a one folders folder. File name should start with
file_<1,2,3...20> (use loop and counter for numbers)
3. cut numbers from file name
say: file1 --> 1
file18 --> 18 and so on
4. save these numbers in new file. eg. number_file
5. create 20 files in another folder. This time file name should start with
newfile_<1,2,3,....> (use number_file to add numbers after underscore)

You might also like