ENSF 461 MIDTERM UPDATED FINAL PAPER
2026 COMPLETE QUESTIONS AND ANSWERS
◉ ls -1. Answer: displays the output in a single column
◉ grep. Answer: searches for lines containing whatever input you
give it in the specified file
◉ wc -l. Answer: counts the number of lines in the output or file
◉ wc. Answer: returns the number of lines, words and bytes in the
file
◉ standard output. Answer: output stream printed on the terminal
◉ standard error. Answer: basically standard output, just used for
error messages
◉ standard input. Answer: input stream, receiving input from
terminal
, ◉ write(int fd, const char* buf, size_t count). Answer: writes data to
a file
parameters: (int fd: 1 for standard output, 2 for standard error,
const char* buf: a pointer to the data you want to write,
size_t count: the number of bytes you want to write from the 'buf' to
the file)
◉ read(int fd, const char* buf, size_t count). Answer: reads data from
a file
parameters: (int fd: 0 for standard input, const char* buf: the pointer
to the buffer that the data you read will be stored, size_t count: the
maximum you can read into buf)
◉ command > filename. Answer: save standard output to a new file
"filename"
Use >> for append to avoid deleting content
example ls > listOfFiles.txt
◉ command 2> filename. Answer: save standard error to a new file
"filename"
2026 COMPLETE QUESTIONS AND ANSWERS
◉ ls -1. Answer: displays the output in a single column
◉ grep. Answer: searches for lines containing whatever input you
give it in the specified file
◉ wc -l. Answer: counts the number of lines in the output or file
◉ wc. Answer: returns the number of lines, words and bytes in the
file
◉ standard output. Answer: output stream printed on the terminal
◉ standard error. Answer: basically standard output, just used for
error messages
◉ standard input. Answer: input stream, receiving input from
terminal
, ◉ write(int fd, const char* buf, size_t count). Answer: writes data to
a file
parameters: (int fd: 1 for standard output, 2 for standard error,
const char* buf: a pointer to the data you want to write,
size_t count: the number of bytes you want to write from the 'buf' to
the file)
◉ read(int fd, const char* buf, size_t count). Answer: reads data from
a file
parameters: (int fd: 0 for standard input, const char* buf: the pointer
to the buffer that the data you read will be stored, size_t count: the
maximum you can read into buf)
◉ command > filename. Answer: save standard output to a new file
"filename"
Use >> for append to avoid deleting content
example ls > listOfFiles.txt
◉ command 2> filename. Answer: save standard error to a new file
"filename"