I need to create test1 and test2 files in /var directory in Linux , and creating Hard link for test1 file and soft link for test2 file in /tmp

  • 4
    Perhaps you could show what you already know (or have learned) and what you tried, and what the results were? – Jeff Schaller Nov 13 '18 at 16:26
touch /var/file1 /var/file2

This will create file1 and file2 in /var directory.

ln /var/file1 /tmp/hard_link_to_file1

This will create hard link to file1 in /tmp directory.

ln -s /var/file2 /tmp/symbolic_link_to_file2

This will create symbolic link to file2 in /tmp directory.

Not the answer you're looking for? Browse other questions tagged or ask your own question.