103k views
1 vote
Execute Linux/Unix commands to achieve the following:

(a) In your home directory create directories/subdirectories to illustrate your family tree based on offsprings starting from your grandfather. Each directory should be the full name (firstname_lastname) in lower case of each individual ending with yourself. [Should illustrate each student’s family tree]
(b) From your home directory move to the directory with your name created from a) using absolute pathname.
(c) Do b) using relative pathname.
(d) Within the directory with your name created from a) create text files with the filename being the ID# of each student.
(e) Each file should be readable & writable by the owner, readable by group members and others have no permissions to the file.
(f) List the contents of the directory with your name created from a).
(g) The contents of each file should have the firstname, lastname and gender of the respective student.
(h) Return to your home directory.
(i) Create directories/subdirectories to represent the relationship of counties, parishes and three (3) towns within the parish inclusive of the capital. Each directory name (lower case) will use the underscore character rather than the space character.
(j) In the parish that you reside create a text file with filename of an attraction (lower case).

1 Answer

2 votes

Final answer:

To achieve the requirements, you can use various Linux/Unix commands. This includes creating directories/subdirectories for your family tree, moving to directories using absolute/relative pathnames, creating text files with student IDs, setting permissions, listing directory contents, and creating directories/subdirectories to represent counties, parishes, and towns.

Step-by-step explanation:

To achieve the requirements of the question, you can use various Linux/Unix commands. Here is a step-by-step guide:

(a) To create directories/subdirectories for your family tree, you can use the mkdir command. For example, mkdir grandfather && mkdir father && mkdir yourself.

(b) To move to the directory with your name using an absolute pathname, you can use the cd command. For example, cd /home/username/yourself.

(c) To move to the directory with your name using a relative pathname, you can use the cd command. For example, cd yourself.

(d) To create text files with the filename being the ID# of each student, you can use the touch command. For example, touch ID1.txt && touch ID2.txt.

(e) To set the permissions of each file, you can use the chmod command. For example, chmod 640 ID1.txt.

(f) To list the contents of the directory with your name, you can use the ls command. For example, ls.

(g) To add the firstname, lastname, and gender to each file, you can use a text editor like vi or nano.

(h) To return to your home directory, you can use the cd command without any arguments.

(i) To create directories/subdirectories to represent counties, parishes, and towns, you can use the mkdir command. For example, mkdir counties && mkdir parishes && mkdir towns.

(j) To create a text file with the filename of an attraction, you can use the touch command. For example, touch attraction.txt.

User Parvaneh
by
7.2k points