Skip to main content

Linux command: ln - make links between files




Question 1:
You are experimenting with a binary in /tmp/foo.d that expects its configuration file at /etc/foo.conf.
You don’t want to save it there, but use a symbolic link to /tmp/foo.d/foo.conf instead.

Which command would accomplish that?

A. ln -s /tmp/foo.d/foo.conf /etc/foo.conf
B. ln /tmp/foo.d/foo.conf /etc/foo.conf
C. ln -s /etc/foo.conf /tmp/foo.d/foo.conf
D. ln /etc/foo.conf /tmp/foo.d/foo.conf





[Hint]
Có hay không có "-s": Dùng "-s" để tạo soft link hay symbolic link (symlink), khi tạo hard link thì không có "-s).
Thứ tự của original file và symlink file: "Có bột mới gột nên hồ", original file phải có sẵn và phải đứng trước symlink.

Hard link chỉ link đến file và chỉ link đến file nằm trên cùng file system

ln -s <orginal> <symlink>


[Reference]
Learn Linux, 101: Create and change hard and symbolic links

Answer: A



Question 2:
You want to create a hard link to a regular file. What are requirements of the regular file for
the ln command to succeed? (Choose two)

A. The file must exist before you run the ln command.
B. The file must be in the same directory as the new file name.
C. The file must be in the same file system as the new file name.
D. The file must be in a different directory from the new file name.
E. The file must be in a different file system from the new file name.

Answer: A, C



Question 3:

An administrator is trying to make a hard link to an ordinary file but ln returns an error. Which of the following could cause this?

A. The source and the target are on different file systems.
B. The source file is hidden.
C. The source file is read-only.
D. The administrator does not own the source file.
E. The source file is a shell script.

Answer: A



Question 4:

A Linux user wants to create a hard link named file2 in the current directory that points to /usr/var/file. Which of the following commands can be used?

A. ln -h file2 /usr/var/file
B. ln file2 /usr/var/file
C. ln -h /usr/var/file file2
D. ln /usr/var/file file2

Answer: D



Question 5:
A hard link is created so that origfile1 is accessible through linkfile1. The reference to origfile1 is then removed using the rm command. What will happen to linkfile1?

A.The file linkfile1 will be deleted
B. The file linkfile1 will become a "broken link"
C. linkfile1 will still exist
D. Both origfile1 and linkfile1 will still exist

Answer: A

Question 6:
Choose the appropriate missing word.
A ______ link cannot span across different filesystems.

A. hard
B. symbolic

Answer: A

Popular posts from this blog

Python: Free Online Courses

Ever thinking about which programming language to learn first? You can learn Python for free with these online courses.

How to charge your device from USB Port

First of all, check BIOS Settings of your laptop or desktop Dell Look for USB PowerShare BIOS Settings: USB PowerShare Lenovo Look for Always On USB Charge in Off Mode BIOS Settings: Enable Always On USB Charge in Off Mode

Qubes OS: Fedora 30

Create a new Standalone VM based on fedora-29 VM template Extend root partition: run command on dom0 tuyen@dom0:~ $ qvm-volume extend fedora-30:root 12288MB Set qrexec_timeout to 600 seconds tuyen@dom0:~ $ qvm-pref --set fedora-30 qrexec_timeout 600 $ sudo dnf upgrade --refresh $ sudo dnf install dnf-plugin-sytem-upgrade $ sudo dnf system-upgrade download --release=30 Install fedora-30 template Run the following command on dom0 terminal $ sudo qubes-dom0-update qubes-template-fedora-30 Install Adobe Flash Player Adobe Flash Player will not go away soon. So, let's grab the latest version of Adobe Flash Player , then install using yum or dnf command. Verify if Adobe Flash Player is installed and works by visiting https://helpx.adobe.com/flash-player.html [user@fedora-30 ~]$ sudo dnf install Downloads/flash-player-npapi-32.0.0.238-release.x86_64.rpm Last metadata expiration check: 0:37:03 ago on Fri Aug 30 09:18:10 2019. Dependencies resolved. =========...