3

I am pretty new to the Rasperry Pi (and linux in general). I am currently using it as an irc bouncer. I have set a cron entry to make it check to see if znc is running every 10 mins.

*/10 * * * *  /usr/bin/znc >/dev/null 2>&1

Everything seems to be working fine. But I noticed that there is no null folder in dev. Does this need to be created?

  • What OS distribution are you using? – goldilocks May 25 '15 at 16:29
3

I noticed that there is no null folder in dev

Because you are looking at the partition while the system is not running. /dev contains device nodes created by the kernel, mostly during boot. They are not real files in the sense of being a sequence of bytes stored somewhere, which is why they usually appear to be of 0 size.

When the system is not running, /dev should be empty. When it is running, a special file system of type devtmpfs is mounted there. It is unmounted at shutdown or will otherwise cease to exist if the system stops since it exists only in memory.

Should I create it?

No. Anything put into /dev when the system is down will be hidden under the mount point anyway. Also, /dev/null, as implied, is not a normal file.

| improve this answer | |
  • 2
    After reading your comment, I decided to look further. I was figured null was a folder and tried to navigate there, unsuccessfully. After going to the parent folder, I can see it there. Feel a little silly now, but I guess is all in the learning process. – Mike May 25 '15 at 16:32
  • 1
    Ah, you tried something like cd /dev/null -- that wouldn't work. The purpose of /dev/null is to provide a sort of drain for unwanted output. Anything written to it is just discarded. It's sometimes important for a backgrounded process to not have its output channels cut-off (which is what would happen if they aren't redirected). So 2>&1 redirects the standard error channel to the standard output one, and > /dev/null directs that to oblivion; the output isn't cut-off, but it is discarded. – goldilocks May 25 '15 at 16:39
0

The /dev/null is a special file, not a directory. If you accidentally removed it you can re-create it with this command

mknod /dev/null c 1 3

| improve this answer | |
  • 3
    Again, do not bother doing this unless the system is running -- in which case /dev/null will already exist (presuming you haven't intentionally done something odd). – goldilocks May 25 '15 at 16:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.