1
ENSF 461 MIDTERM EXAM LATEST VERSION -2025/2026- 100+
QUESTIONS AND VERIFIED ANSWERS ALL THE BEST
standard output
output stream printed on the terminal
standard error
basically standard output, just used for error messages
standard input
input stream, receiving input from terminal
write(int fd, const char* buf, size_t count)
writes data to a file
Piping ( | )
pass the output of the command on the left as input of the command on the right.
ls -1
displays the output in a single column
grep
searches for lines containing whatever input you give it in the specified file
wc -l
counts the number of lines in the output or file
wc
returns the number of lines, words and bytes in the file
parameters: (int fd: 1 for standard output, 2 for standard error,
const char* buf: a pointer to the data you want to write,
, 2
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)
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
save standard output to a new file "filename"
Use >> for append to avoid deleting content
example ls > listOfFiles.txt
command 2> filename
save standard error to a new file "filename"
Use >> for append to avoid deleting content
command 2>&1 > output.txt
redirects standard error to standard output, then redirects standard output to a
file named "output.txt"
grep options
- i: case insensitive
- v: all non instances
- l: all files where it appears
- c: number of matching lines per file
- *: wildcard finds all instances in all files in the cd
ENSF 461 MIDTERM EXAM LATEST VERSION -2025/2026- 100+
QUESTIONS AND VERIFIED ANSWERS ALL THE BEST
standard output
output stream printed on the terminal
standard error
basically standard output, just used for error messages
standard input
input stream, receiving input from terminal
write(int fd, const char* buf, size_t count)
writes data to a file
Piping ( | )
pass the output of the command on the left as input of the command on the right.
ls -1
displays the output in a single column
grep
searches for lines containing whatever input you give it in the specified file
wc -l
counts the number of lines in the output or file
wc
returns the number of lines, words and bytes in the file
parameters: (int fd: 1 for standard output, 2 for standard error,
const char* buf: a pointer to the data you want to write,
, 2
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)
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
save standard output to a new file "filename"
Use >> for append to avoid deleting content
example ls > listOfFiles.txt
command 2> filename
save standard error to a new file "filename"
Use >> for append to avoid deleting content
command 2>&1 > output.txt
redirects standard error to standard output, then redirects standard output to a
file named "output.txt"
grep options
- i: case insensitive
- v: all non instances
- l: all files where it appears
- c: number of matching lines per file
- *: wildcard finds all instances in all files in the cd