top 14 comments

sorted by: hot top controversial new old
[–] 33 points 1 year ago (1 child)

You also need to ln -s /dev/null /dev/nul

  • source
  • hideshow 1 child comment
  • [–] 20 points 1 year ago

    nul is Windows/DOS.

  • source
  • [–] 16 points 1 year ago (1 child)
  • [–] 21 points 1 year ago*

    This is a command that throws a permission denied error while trying to create a symlink to a file that almost certainly does not exist.

    It's like someone turning to you and saying "Knick knack!" then waiting for you to ask "who's there?"

  • source
  • parent
  • [–] 13 points 1 year ago (5 children)

    The ingenuity of this command is that /dev/nul does not exist, the correct path is /dev/null, however the command executes without error and creates a symlink to a non-existing path.
    The only thing missing is sudo.

  • source
  • hideshow 5 child comments
  • [–] 0 points 1 year ago (3 children)

    there are a million cases where sudo is not required.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 1 year ago* (last edited 1 year ago) (2 children)

    My dumbass can only come up with three:

    1. You are already root (ok, fine)
    2. You have made /dev/ writable by non-privileged users
    3. Your non-privileged user already owns the symlink /dev/nul. Which "ok, fine", but also the point of command would have to be to functionally do nothing other than print out the error ln: failed to create symbolic link '/dev/nul': File exists

    I would love to understand the use case behind #2. I am also curious to see even 7 more cases, let alone your figurative million.

    In regards to #3 even if the behaviour of ln was to replace a symlink if it already existed, it'll probably have to unlink() the existing symlink, which I'm pretty sure is gonna get you a permission denied error on any /dev filesystem with sane permissions.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 1 year ago*

    Follow up, tested and confirmed #3:

    [korthrun@host]$ ls -l /dev/korth
    .rw-r--r-- korthrun wheel 0 B Wed Jun 11 17:11:03 2025 /dev/korth
    [korthrun@host]$ rm /dev/korth
    rm: cannot remove '/dev/korth': Permission denied
    
  • source
  • parent
  • [–] 3 points 1 year ago* (last edited 1 year ago) (2 children)

    ln -s /dev/null /dev/theresnodanaonlynull

  • source
  • hideshow 2 child comments