SYS: Create hard and soft links.

Share this link

Note: This is an RHCSA 7 exam objective.

Hard and Soft Links

To create a hard link pointing to a existing file (here /path/file1) (both locations have to be in the same file system), type:

# ln /path1/file1 /path2/file2

Note1: It is not possible to create a hard link pointing to a directory.
Note2: In RHEL 7, only the owner of a file can create a hard link pointing to it. To get the RHEL 6 behavior back, add fs.protected_hardlinks = 0 in the /etc/sysctl.conf file and execute the command sysctl -p.

To create a soft link pointing to a existing file or directory (here /path/file1), type:

# ln -s /path1/file1 /path2/file2

Check the result:

# ls -i /path2/file2

Additional Resources

Sander van Vugt provides a video about Understanding Links in the Linux File System (3min/2016).

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

Leave a Reply

Be the First to Comment!

Notify of
wpDiscuz

RHCSA7: Task of the day

Allowed time: 5 minutes.
Create two users "tom" and "engine". "tom" has the UID/GID 3000 and "engine" the UID/GID 4000. "engine" doesn't have an interactive shell.

RHCE7: Task of the day

Allowed time: 5 minutes.
Set up time synchronization with default configuration.

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...

Recent Comments