KEMBAR78
Practical 2 Managing Files in Linux System | PDF
0% found this document useful (0 votes)
126 views4 pages

Practical 2 Managing Files in Linux System

Uploaded by

kowzq-wm22
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)
126 views4 pages

Practical 2 Managing Files in Linux System

Uploaded by

kowzq-wm22
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/ 4

AACS2284 Operating Systems

Practical 2 – Managing Files in Linux System


Section A
Starting from the user’s home directory (cd ~), perform the following in sequence.
1. Show the current path.

2. Create a directory “D2”.

3. Give two commands which can list all the contents at the current directory.

4. Create a directory “super” inside the directory “D2”.

5. Inside this “super” directory, create four files “apple.doc”, “april.doc”, “box.txt” and
“ultra.txt” using touch command.

6. (a) Show the file(s) starting with “ap”.

(b) Show the file(s) that the length of the filename contains 7 characters.

(c) Show the file(s) ending with “txt” extension.

(d) Show the file(s) that the third character of the filename is “p”.

7. Go to root directory.

8. Search a directory named “super” from the root directory.

9. Search a file named “ultra.txt” from the root directory.

10. Go back to directory “super”. Rename the file “ultra.txt” to “mega.txt”

1
AACS2284 Operating Systems

11. Copy “super” directory to home directory and rename it to “super2” in one command line.

12. Confirm whether “super2” directory is created and copied.

13. Remove “super” and all its subdirectories and files.

14. Create a text file “sampleA.txt” using vi command inside the directory “D2”.

15. Type the following contents into “sampleA.txt” and save the file.
“The shell is a program that takes keyboard commands and passes them to the operating
system to carry out. Almost all Linux distributions supply a shell program from the GNU
Project called bash.”

16. Create another text file “sampleB.txt” using cat command.

17. Type the following contents into “sampleB.txt” and save the file.
“When using a graphical user interface, we need another program called a terminal
emulator to interact with the shell.”

18. Open “sampleB.txt” again using vi command and add the following sentences.
“It’s likely called simply “terminal”.”

19. Show the word count of “sampleB.txt”

20. Combine the two files “sampleA.txt” and “sampleB.txt” to a file named “sampleC.txt”.

21. Show the content of “sampleC.txt” on the terminal.

22. Archive “sampleA.txt” and “sampleB.txt” to “sampleC.tar”

2
AACS2284 Operating Systems

23. Overwrite “sampleB.txt” by “sampleA.txt” and show the content of both files on the
terminal.

24. Delete the file “sampleB.txt”.

25. Go back to home directory and create a new directory named “backup”.

26. Backup “sampleA.txt” and “sampleC.txt” to “backup” directory.

Section B
True/False. Explain the answer if it is false.

True/False
1. The structure of the file system in Linux can be depicted in a form
of tree. It begins at the root (/), and branches out like the branches
of a tree.

2. A relative path starting from the current directory while an


absolute path starting from the root of the entire file system tree.

3. When the terminal is opened the starting directory is the root (/)
directory.

4. /etc directory in Linux is similar to Control Panel in WINDOWS.

5. Windows separates directories using forward slash (“/”) while


LINUX uses back slash (“\”).

6. LINUX is non-case sensitive while WINDOWS is.

7. Windows uses a volume-based file hierarchy (e.g. C: volume, D:


volume) while LINUX uses a unified scheme (e.g. /, /home, /etc).

8. .tar is a text file extension in LINUX system.

3
AACS2284 Operating Systems

9. LINUX uses color to differentiate the files and folder/directory.


Blue is for executable file, Green is for directory.

10. Lossless compression preserves all the data after compression


while lossy compression drops some information after
compression.

You might also like