Artificial intelligent assistant

Symbolic Link command behavior ln -s If I issue `ln -s source.txt symlink.txt` and `symlink.txt` does not already exist, is a link file automatically created called `symlink.txt` or is the command a noop? If it is a noop, if I just create a blank `symlink.txt` (`touch symlink.txt`) and then run the previous command will the operation works as planned? Thanks for the help

Well, that's easy to test:


$ mkdir test; cd test
test$ ln -s source.txt symlink.txt
test$ ls -l
total 0
lrwxrwxrwx 1 ilkkachu ilkkachu 10 Oct 23 18:24 symlink.txt -> source.txt
test$ cat symlink.txt
cat: symlink.txt: No such file or directory


(Representing that output as text doesn't do justice to GNU ls, and the coloring support it has.)

The `ln -s` commands creates the symlink `symlink.txt` regardless of if `source.txt` exists. Trying to access the file through the symlink doesn't work, though, since the pointed-to file doesn't exist. With output coloring, `ls` would show the link name and target as red (or whatever the setting is, something other than a live link, anyway.)

If `symlink.txt` exists, `ln -s source.txt symlink.txt` gives an error, predictably. Use `ln -sf` to overwrite the target file.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 37bed710a6b56a6efc67985e01ef4fb3