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

preguntasrevision

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

preguntasrevision

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Sistemas Operativos (11031/19385) Preguntas de revisión 1

Universidad de Cuenca
Facultad de Ingeniería
Escuela de Ingeniería Electrónica y Telecomunicaciones

Sistemas Operativos
Ing. Fabián Astudillo, PhD.<[email protected]>

Preguntas de revisión 1: Capítulo 3

1. Which of the following Linux file system commands can you issue
(a) On a directory?
(b) On a file?

ls cd mv rm cp sort touch less cat wc chmod


2. Referring to Figure 3.4, assume you are currently in the directory /home/foxr/temp2/a.
(a) Write an absolute path to take you to zappaf.
(b) Write a relative path to take you to zappaf.
(c) Write an absolute path to take you to etc.
(d) Write a relative path to take you to etc.
3. You are user zappaf. You were in the directory /usr and then performed cd /home/ foxr/temp. What
values would you find in these environment variables? PWD OLDPWD HOME.

4. What is the difference between home/foxr and /home/foxr?


5. What does represent? What does zappaf represent?
6. What is the difference between . and ..? For questions 7 through 16, assume that the current directory
contains the following items (all of which are files): abc.txt abc1.txt abb.txt bbb.txt bbb.dat bbb bbbb
c123.txt ccc.txt
7. List the files that the following command will display: ls *
8. List the files that the following command will display: ls *.txt
9. List the files that the following command will display: ls a*.*

10. List the files that the following command will display: ls ab?.txt
11. List the files that the following command will display: ls bbb*
12. List the files that the following command will display: ls bbb.*

13. List the files that the following command will display: ls c??.txt
14. List the files that the following command will display: ls [ab][ab][ab].*
15. List the files that the following command will display: ls [a-c]??.???
16. List the files that the following command will display: ls [!c]*

17. Refer back to Figure 3.4. Assume that you are currently in the subdirectory temp2 of foxr. Assume
the subdirectory a contains five files and subdirectory b is empty.
Sistemas Operativos (11031/19385) Preguntas de revisión 1

(a) What is the result of doing rmdir a?


(b) What is the result of doing rmdir b?
(c) What is the result of doing rm -ir a*?
(d) How would rm -fr a* differ from rm -ir a* from part c?
For questions 18 through 21, assume the directory zappaf has the following partial long listing: -rw-rw-
r– zappaf zappaf ... foo1.txt -rw-rw-r– zappaf zappaf ... foo2.txt -rw-rw—- zappaf zappaf ... foo3.txt
18. Write a command, as foxr, to copy these files to foxr’s temp directory.
19. Will your command from 18 successfully copy all three files? Why or why not?
20. For your copy command from #18, what would differ if you added the option -p?
21. How does the command mv zappaf/foo1.txt. differ from the command mv zappaf/ foo1.txt foo4.txt?
22. The -f option in rm forces a file to be deleted without asking for permission. What then does the -f
option do for cp?
23. What is the difference between tail -n 10 and tail -n +10 when issued on a file of 100 lines?
24. What is the difference between tail -c 10 and tail -n 10 when issued on a file of 100 lines and 1000
characters?
25. Assume you have two files that are nearly identical. To view the differences between them, which file
comparison program should you use?
26. Assume you have two files that are sorted. To view the differences between them, which file comparison
program should you use?
27. Which of the file comparison programs can compare one file to several other files?
28. How does uniq differ from diff and cmp? Assume you have two files: names.txt and phone.txt which
each contain enumerated (numbered) lists of names (names.txt) and phone numbers (phone.txt). We
assume that the ith entry in file 1 corresponds to the ith entry in file 2 for all entries. Answer questions
29 and 30.
29. What command could you issue to create a file containing all names and phone numbers, properly
organized?
30. Assume that the phone.txt file is incomplete so that some entries do not contain phone numbers.
The numbers between the two files still correspond (for instance, if the 3rd person’s phone number is
missing, the phone.txt file skips a line with the entry 3). Revise your command from question 29 so
that missing phone numbers are indicated with the word UNKNOWN.
31. Explain what the split instruction does.
32. Imagine that you have a large multimedia (1 GB) file (e.g., a movie stored as an mpg or avi file). You
want to break up the file into smaller 100 MB files. Provide a command to accomplish this so that the
file components are all numbered like 00, 01, 02, 03 after their name.
33. What is the difference between wc foo1.txt and wc -l foo1.txt?
34. Referring to Figure 3.3, write a command to create a symbolic link of the file in zappaf’s directory
foo1.txt from foxr’s temp directory. How would your command differ if you wanted to create a hard
link?
35. Assume that file alink is a symbolic link to the file afile located in another directory. What happens to
afile if you delete alink? What happens to alink if you delete afile?

Página 2
Sistemas Operativos (11031/19385) Preguntas de revisión 1

36. Repeat question 35 assuming that alink is a hard link instead of a symbolic link.
37. Write a find command to find and list all files in the current directory accessed within the last 3 days.
38. Write a find command to find all files in your home directory modified less than 60 min ago and delete
them.
39. Write a find command to perform wc -l on all files in your home directory newer thanthe file myfile.txt.
40. Write a find command to find all files in the entire file system (starting at /) whose permissions are
666 and change them to 664.
41. Write a find command to find all files in the current directory whose size is between 1000 and 10,000
bytes.
Assume for questions 42 through 50, we have the following partial long listing of files and subdirectories
in the current directory. Also assume that you are not user foxr but you are in the group cool. Answer
each question independently (i.e., do not assume that a previous instruction changed the permissions
as shown below). drwxrwxr– foxr foxr ... subdir1 drwxr-xr– foxr cool ... subdir2 -rw-rw-r– foxr foxr ...
foo1 -r-xr-xr– foxr foxr ... foo2 -rwxr—– foxr cool ... foo3 -rw-r–r– foxr foxr ... foo4 -rw-rw-rw- foxr foxr
... foo5
42. Provide the 3-digit permissions for each of the items listed here.
43. Write a chmod command to permit execute access both group and world for foo3 using the ugo=
approach. Write a chmod command to permit execute access both group and world for foo3 using the
ugo+/- approach.
44. Write a chmod command to permit execute access both group and world for foo3 using the 3-digit
approach.
45. Write a chmod command to permit write access to foo4 for group but remove read access for world
using the ugo+/- approach.
46. Write a chmod command to remove all group and world access to foo1 using the ugo+/- approach.
47. Write a chmod command to remove all group and world access to foo1 using the 3-digit approach.
48. As a member of cool, do you have the ability to cd into subdir2?
49. Of the items listed here, which have permissions that you think should be altered? Why?
50. Which of the following permissions you generally do not see in a Linux system? Why not?
(a) 765
(b) 646
(c) 404
(d) 200
(e) 111
51. What does the permission 1777 mean? How would the permissions of such a directory appear when
you use ls –al?
52. Why might you make a directory world-writable? If you do so, what are the consequences on files
stored there?
53. Why would you set a directory’s sticky bit?
54. How does the /proc directory differ from all other top-level directories?

Página 3
Sistemas Operativos (11031/19385) Preguntas de revisión 1

55. Briefly explain the difference between the types of programs you would find in /bin versus /sbin.
56. Why is /root located under / and not /home?
57. Of the following directories, which would you generally not anticipate changing for weeks or more at a
time? /bin, /boot, /home, /sbin, /var

58. Under which top-level directory will the system administrator probably spend time editing files?
59. Explain why a user may wish to invest in a magnetic tape drive and magnetic tape cartridges.
60. Research the following compression formats and specify whether they are lossy or lossless: flac, gif,
jpeg, mp3, mpeg-1, mpeg-2, mpeg-4, png, tiff, and wma.

61. A file stores the following text. Define a dictionary of words for this file and then substitute each word
with a number as its replacement where the number is the location of the word, alphabetically, in the
dictionary. Periods, spaces, and line breaks should be retained in the file. Include your dictionary in
your replacement file. How much compression do you achieve with your replacement file?
The blue fox jumped over the red cow. The red cow ate the green grass. The green cow ate the blue
grass. The blue fox then jumped over the green cow. The green cow ate more blue grass.

Página 4

You might also like