It's not dangerous.
echo command is used to send output to
stdout. This is usually your terminal but can be redirected to other things.
> redirection operator will redirect output from
stdout to a file of your choosing.
- Files in
/dev are usually a special type of file that send output to a device driver instead of storage.
Under modern Unix systems, these "special" files are made and dynamically maintained by a hardware detection process -
systemd under Linux, for example. But it is possible to have a completely static system where these are manually made (via
mknod is one way) if the hardware in the system does not change - before the prevalence of Plug-and-Play interfaces (e.g. various Unices in the 70's, 80's and early 90's), this was common.
/dev/null is a standard Unix device driver that simply throws away what it receives. It's often used to throw away unwanted output or for testing.
If you are running this under Windows' Linux Subsystem for Windows, I'm not sure how it makes these files, but the LXSS is probably presenting a virtual version of them to programs that run under the subsystem for compatibility. (Windows has a "Null" device driver if you look in
devmgmt.msc under "Non Plug-and-Play Devices" - the LXSS is probably doing things behind the scenes to make
/dev/null really use that Windows driver.) Cygwin, another software that presents a Linux subsystem, does this too.
"" is a null string, meaning nothing, but
echo adds a newline unless the
-n switch is specified, so
echo "" outputs a newline to
stdout (redirected to
/dev/null in the example).