I have just installed the latest version of openSuse Tumbleweed and was going through the file system familiarising myself with it when I found a file in /dev/lightnvm called 'control'. I attempted to run cat on the file (cat control) but when I did so I got the following error:cat: control: Invalid argumentI should have all the appropriate permissions to access the file. Any ideas as to why I can't view the contents of the 'control' file?
Cat won't access file in openSuse Tumbleweed ('Invalid argument' error)
filesystems;opensuse;cat
The c in the first column of the ls output means this is a character device file.  It is not a regular file and it doesn't really have contents.When you open and read from a regular file, the kernel runs standard code that fetches the file's data from your hard drive (or similar storage).  But when you access a device file, the kernel runs code (the device driver) that is specific to that device.  Apparently, the authors of the lightnvm device driver designed their code in such a way that it doesn't make sense to read from this particular device, and so their code says that trying to do so should fail with an error.  (Most likely, code that needs to use this device is supposed to write to that file - the name control suggests that you are supposed to write to it to send commands to the device.  It may also be intended to be neither read nor written, but accessed using the ioctl() system call.)It's generally not a good idea to mess with the files in /dev, unless you really know what you are doing.  Writing to arbitrary device files can be very dangerous; for instance, echo hello >/dev/sda would make your system unbootable, and it would be very difficult to recover your files.  Even reading device files can be dangerous in some cases, or at least cause unexpected behavior.