0% found this document useful (0 votes)
23 views

Lab 3

Uploaded by

Hamizatul Wafaa
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)
23 views

Lab 3

Uploaded by

Hamizatul Wafaa
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/ 19

TMF – OPERATING SYSTEMS

LAB 3

NAME: HAMIZATULWAFAA

MATRIC NUMBER: 78011

GROUP NUMBER: 7

TASK 1: Description of the use of these commands in your own words: touch, rm, mv, head, tail, echo,
cat, more and less.

 touch: The touch is applied to the creation of empty files. The touch command generated an
empty file. When the user doesn't have any data to store at the moment of file creation, they
can use this command.

 rm: The rm is used to remove objects such as files, directories, symbolic links. When you use the
rm command, user confirmation, read permission, and write permission are not necessary
before a file is deleted. Because you cannot retrieve the contents of deleted files or directories,
you should use extreme caution while using the rm command. However, you must have write
access to the directory where the file is located.

 mv: The mv command renames or moves files and folders from one directory to another. A file
or directory keeps its base file name when moved to a new directory. All links to other files are
preserved when you move a file, with the exception of when you move it to a different file
system. A directory and its contents are added beneath the existing directory when you transfer
a directory into it.

 head: The head command emits the standard output the initial lines of one or more files. It
displays the first 10 lines by default. Data from each file is preceded by its file name if more than
one file name is given.

 tail: It is head command's complementary. The tail command prints the last N numbers of data
from the specified input, as the name suggests. It prints the last 10 lines of the selected files by
default. Data from each file is preceded by its file name if more than one file name is given.

 echo: The echo is used to display a line of text or string that is supplied as a parameter. This
built-in command is frequently used to output status text to the screen or a file in shell scripts
and batch files.
 cat: The cat command is used to read data from the file and gives their content as output. It can
be used to print the content of a file onto the standard output stream, copy content from one
file to another, concatenate the contents of multiple files, display the line number, display $ at
the end of the line, etc. Other than that, the cat command also allows us to write some texts
into a file.

 more: The more command is used to view the contents of a text file one screen at a time in case
the file is large. However, when you have large files, it only gives you the last section of the file
that constitutes the last few lines of the file. This compels you to scroll all the way up to start
reading the file from the very beginning. The more command also allows the user do scroll up
and down through the page.

 less: The less command displays a file's contents one screen at a time. Because it accesses the
file page by page rather than loading the full thing at once, it is helpful for working with huge
text files because it produces quick loading times.

Task 2: Try all the above commands by following the steps in the video. Screenshot all your works in the
terminal emulator and paste them in your report.

Figure 1: file command


Figure 2: touch command

Figure 3: touch command result


Figure 4: mv command and the result

Figure 5: head command

Figure 6: head command result

Figure 7: tail command


Figure 8: head command and the result

Figure 9: head command result


Figure 10: tail command and the result

Figure 11: tail command result


Figure 12: cat command and the result

Figure 13: cat command result


Figure 14: cat command result

Figure 15: cat command result


Figure 16: cat command result

Figure 17: cat command result


Figure 18: cat command result

Figure 19: cat command result


Figure 20: cat command result

Figure 21: echo command and the result

Figure 22: cat command and the result


Figure 23: cat command result

Figure 24: cat command result

Figure 25: more command and the result


Figure 26: more command result

Figure 27: more command result


Figure 28: more command result : by pressing space button, it will display more lines of text

Figure 29: more command result : by pressing space button, it will display more lines of text
Figure 30: more command result : by pressing space button, it will display more lines of text

Figure 31: more command result : by pressing space button, it will display more lines of text
Figure 32: more command result : by pressing space button, it will display more lines of text

Figure 33: more command result : by pressing space button, it will display more lines of text
Figure 34: more command result : by pressing space button, it will display more lines of text

Figure 35: more command result : by pressing space button, it will display more lines of text
Figure 36: the end of more command

Figure 37: less command


Figure 38: less command result

Figure 39: the end of less command

You might also like