Celeb Glow
news | April 03, 2026

why device files do not open with vim or nano

root@heena:/dev/disk/by-label# ls
PENDRIVE System\x20Reserved

now when I open PENDRIVE using vim or nano, I get an empty file.

but I understand that everything is file in linux including pendrive.

Question is why nano or vim is unable to open and show the real content of the file, if even devices are considered as file in linux?

1 Answer

You are right, everything is file in Linux. But vim or nano can not handle those types of files. So when you open them they shows empty. Actually they contain info in a manner that is not human readable.

If you try to open with emacs like

sudo emacs <file>

You get the message,

File exists, but can not be read.

If you wish to see what is inside try,

sudo cat /dev/disk/by-level/<file>

You could see different random characters.

Note:

The file at /dev/disk/by-level/<file> is actually a softlink to /dev/sdbx. You can see using this in terminal,

$ ls -l /dev/disk/by-level/<file>
lrwxrwxrwx 1 root root 10 Jan 7 17:33 /dev/disk/by-label/<file> -> ../../sdbx

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy