Shell – the usage of < /dev/null & in the command line

command lineio-redirectionlinuxshelltcsh

I tried to run an example java program using the following command line. However, I do not know what is the trailing part < /dev/null & used for?

java   -cp  /home/weka.jar weka.classifiers.trees.J48 –t train_file  >& log < /dev/null &

Best Answer

< /dev/null is used to instantly send EOF to the program, so that it doesn't wait for input (/dev/null, the null device, is a special file that discards all data written to it, but reports that the write operation succeeded, and provides no data to any process that reads from it, yielding EOF immediately). & is a special type of command separator used to background the preceding process.

Without knowing the program being called, I do not directly know why it is required to run it in this way.

Related Question