Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Linux / Unix: please help as much as you can. Thanks. (1) Give commands for the

ID: 3854065 • Letter: L

Question

Linux / Unix: please help as much as you can. Thanks.

(1) Give commands for the following

a. Create the directory tree homework/project/.notes from your home directory in one command. Multiple commands must not be used

b. Change the mode of the directory ".notes" as executable only by you.

c. Modify the permissions of a file not readable or writeable or executable by *anyone*.. in one command. Then remove this file. Show commands to do this

(2) Give number equivalents of the following permissions

-r--rwxr--
-rwx-w--w-
----rwx---

(3) Write commands for the following

a. Create a symlink to $HOME/homework in /tmp. Name the link homework_link.
b. Create a hardlink to $HOME/homework in /tmp. Name the link as homework_hard
c. Set the permissions of a file to readonly for user, group and other without using numbers.
d. Redo the command c. with numbers
e. Add permissions to the same file so that group and other can write and execute. Do not use numbers.

Explanation / Answer

n filename linkname

For example, suppose you have a file called user_guide which is located in /u/workgrp/tasks/projects. To work on this file you would normally cd to that directory before opening the file. However, by creating a link to the file, you can access it from your current directory (without needing to enter the full path of the file). To do this, type the following:

The my_guide argument identifies the link. Whenever you want to work on the file, which is now known to the system by two names (user_guide and my_guide), you can access it from the current directory by using my_guide as the filename.

You must have write permission on a directory before you can create a link that involves that directory or a file in that directory. You cannot create a hard link (the kind of link described above) to a directory or a file on a different filesystem. To create a link to a directory or a different filesystem, you must use a symbolic link. See ``Creating a link to a directory'' for details.

Links can be removed using rm. If a file has several links, it is not physically deleted until the final link is removed.

Finding out whether a file has hard links

To find out how many hard links there are to a file, use the ls -l command, as follows:

You need to locate all the links to a file or directory if you want to delete it: as long as there are links, you cannot delete the file or directory.

In a long listing, the number of links are shown in the second column from the left (after the sets of permissions). For example, in the above example, the file 4.files has three links to it.

You can find out where the common links to a single file are located, in two steps. First, you need to identify the inode number of the file (see ``How the system manages files and directories'' for information on inodes). To do this, use the ls -i option, as follows:

The number before the filename is the file's inode number, for example, 2002 for the file called halibut.

To trace all the links to this file, you must find all the other files in the filesystem with this inode number. You can do this using the find -inum option, as follows:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote