OPS102 - Week 4 - Lab ADI
docx
keyboard_arrow_up
School
Seneca College *
*We aren’t endorsed by this school
Course
102
Subject
Information Systems
Date
Dec 6, 2023
Type
docx
Pages
9
Uploaded by DrQuail3570
OPS102 – Week 4 – File Systems - Sample Lab
Student Name: Aditya Mahesh Tambe
Student ID: 171969223
Activity 1: Redirection and Piping
Put following text to a file called gpt.txt
ChatGPT is an artificial intelligence chatbot developed by OpenAI and released in November
2022.
The name "ChatGPT" combines "Chat", referring to its chatbot functionality, and "GPT", which
stands for Generative Pre-trained Transformer, a type of large language model.
Wikipedia
ChatGPT has been trained on huge amount of data scraped from internet.
This has enabled us to develp artificial programes that can answer questions like humans.
Redirection:
Redirection can send input to a command from a file or can send output of a command to a file.
Input redirection symbol: <
Command < filename
1.
Run the command on Linux:
cat < gpt.txt
What do you see and why?
I can see the content inside the file which is .txt. basically cat commands helps to view
the file contents so that might be the reason for it.
2.
Run similar command on Windows:
TYPE < gpt.txt
What do you see and why?
In windows this command is not able to execute the above what linux did because
windows don’t have command to do so.
Output redirection symbol: >
Command > filename
3.
Run the command on Linux
ls -l > list.txt
What is the output? Explain
It did create a new file called list.txt and when I tried the ls command it did list the new
and the old which was gpt.txt and list.txt.
4.
Run equivalent command on Windows:
dir > list.txt
What is the output? Explain
Well it did the same for windows as what it did for linux, it did created the list.txt file and
listed it with the gpt.txt file
5.
Run the command on both Linux and Windows:
sort < list.txt
What is the output?
It did not change anything as it was already sorted in alphabetically at the time when I
created and sorting it again will sort the files in alphabetic manner.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Piping:
Command1 | Command2
Piping is used to redirect output of first command to the input of the second command. This
allows to combine simple commands to achieve more complex task.
Perform following tasks and add screenshots
1.
On Linux run the command
ls /bin | more
What do you see and why?
It did listed the bin files and there are other files listed which are
does not belong to bin
files.
2.
Suppose you have a text file called gpt.txt having following text in it
On Windows run the command
TYPE gpt.txt | FIND “GPT”
What is the output? Explain it:
(TYPE is equivalent to cat command on Linux)
This did view the word which had GPT in it and listed the lines which had the same word
and showed them in terminal in this case I told him to look in gpt.txt that’s why the
search results were limited to the gpt.txt only.
3.
Run and explain the command:
cat < gpt.txt | sort > out.txt
Explain what is happening in above command?
Activity 2: File Permissions
Consider following image for next tasks
Choose any way to create following files in the respective folders
1.
Issue the following Linux commands:
ls -ld ~/documents ~/clients ~/vendors
ls -lR ~/documents ~/clients ~/vendors
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
2.
Let's limit access to the
clients
and
vendors
directories to only yourself and same group
members.
Issue the following Linux command:
chmod 750 ~/clients ~/vendors
3.
Issue the
ls -ld
and
ls -lR
commands (as you did in
step #8
) to confirm that the
permissions for those directories have been changed.
NOTE:
The
-R
option for the
chmod
command can change the file permissions
recursively
within a directory structure.
4.
Issue the following Linux command:
chmod 750 -R ~/documents
5.
Issue the
ls -ld
command to confirm the permissions for the
~/documents
,
~/document/memos
,
~/documents/reports
, and
~/documents/contracts
directories.
6.
Issue the following Linux command:
ls -lR ~/documents
What do you noticed happened to the permissions for the regular files contained in
those directories.
Did those regular file permissions change?
No
I did not see the changes in
the permission, even though the commands did not
show me the errors and were executed successfully.
We will now change permissions for regular text file contained in subdirectories
of the
documents
directory to:
r w - r - - - - -
7.
Issue the following Linux commands:
chmod 640 ~/documents/memos/memo*.txt
chmod 640 ~/documents/reports/report*.txt
chmod 640 ~/documents/contracts/contract*.txt
8.
Issue the
ls -lR
command for the
~/documents
directory to confirm that those regular
file permissions have changed.
9.
Issue the following Linux command to add write permissions for all files in the memos
directory
for yourself (i.e. user):
chmod u+w ~/documents/memos/*
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help