0% found this document useful (0 votes)
12 views5 pages

Os Lab 7

This OS Lab Report details exercises involving Linux commands, specifically focusing on the use of pipes and the 'rev' command to manipulate text output. It includes tasks such as reversing text, using 'whoami', and observing the behavior of the 'ls --color' command when piped to other programs. The report is submitted by three students and is dated May 1, 2024.

Uploaded by

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

Os Lab 7

This OS Lab Report details exercises involving Linux commands, specifically focusing on the use of pipes and the 'rev' command to manipulate text output. It includes tasks such as reversing text, using 'whoami', and observing the behavior of the 'ls --color' command when piped to other programs. The report is submitted by three students and is dated May 1, 2024.

Uploaded by

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

OS Lab Report 7

Submitted to Sir Messam Raza

Submitted by:
Muhammad Ali (2757)
Muhammad Huzaifa:
Hassan Mubarak:

Subject Os Lab 6
Class BSCS 5 A
Dated: 1st May 2024
Question 1
A. Try the example on the ‘Pipes’ slide, using rev to reverse some text.
Command: echo My name is Khan | rev
Reversres text after echo, as show below:

B. Try replacing the echo command with some other commands which produce
output (e.g., whoami).
Command: whoami >> same_out

C. What happens when you replace rev with cat? You might like to try running cat
with no arguments and entering some text.
Question 2
a. Run the command ls --color in a directory with a few files and directories. Some
Linux distributions have ls set up to always use the --color option in normal
circumstances, but in this case we will give it explicitly.

Command: ls –color : In Ubuntu default is uses the --color option

Default: We can see default Ls is coloured


b. Try running the same command, but pipe the output into another program (e.g.,
cat or less). You should spot two differences in the output. ls detects whether its
output is going straight to a terminal (to be viewed by a human directly) or into a
pipe (to be read by another program).

Command: ls --color | cat


Differences: A) Orientation It’s in a list format In a signle column as opposed to
3 or 4 columns.

In less:
Output:

You might also like