I have just found out that /dev/null is a file and not a directory.
I'm just wondering if it has an actual file size.
/dev/null is not really a file. It's a character device!
$ ls -l /dev/null crw-rw-rw- 1 root root 1, 3 Apr 10 09:53 /dev/null The first letter c of the permissions string (crw-rw-rw-) indicates this. For regular files, it would be a - instead.
So in easy words: /dev/null is not a file but a virtual device mapped to this path in the file system, which has the only purpose to swallow and vanish data - like a black hole.
It can also be used as input though, then it acts like an empty file (size 0) and immediately returns an EOF (End Of File).
Therefore you can not really say that /dev/null has a specific file size, as it's not a regular file on any storage medium.
/dev/null is a special kind of file called "device file".
Device files act as a interface to some kernel functions. They just occupy the space that is needed for a directory entry ("inode") but don't have any real content and don't have an actual file size.
Other device files are e.g. /dev/sda (generally a HDD or SSD), /dev/zero (a file that generates zero's when read), or /dev/random (a file that generates random data when read). Actually about all files in /dev/ are either device files or links pointing to device files.
mknod to create device files anywhere you want). For virtual file systems like /dev/ the inode doesn't occupy disc space but some memory. ls and du to report the size of a character special device like /dev/null or /dev/random yields 0.