read (Unix)
Appearance
![]() | The topic of this article may not meet Wikipedia's notability guidelines for products and services. (July 2016) |
Operating system | Unix, Unix-like, Inferno |
---|---|
Type | Command |
read
is a command found on Unix and Unix-like operating systems such as Linux. It reads a line of input from standard input or a file passed as an argument to its -u
flag, and assigns it to a variable.
In Unix shells, like Bash, it is present as a shell built in function, and not as a separate executable file.[1]
Detail
#include <unistd.h> ssize_t read(int fd, void* buffer, size_t count);
read() reads upto count bytes of data from file descriptor fd to buffer. On success number of bytes read is returned and file position is advanced by this number. It's possible that the number of bytes read is less than the count value.