Print command output to file

I am using the latest console debian version in 410c board.
much of the time i run commands that have many outputs that the screen will automatically scroll down and I can never show what is in the top of the screen as far as I know. Therefore, the common method to print the outputs of commands into a file is:

command > output.txt

However, this method never prints the outputs of the command to output.txt. it only creates an empty output.txt file.
I have also tried the append option and it didn’t worked.
I tried it with sudo option also it didn’t work too.

Do you have RWX permission where you are trying to write the file?
Is the program writing output to stdout or stderr? If its writing to stderr, then you need to direct THAT into the file, like “command 2>output.txt” or “command 2>&1 >output.txt” the second of which redirects stderr to stdout, and then stdout to the file.

As for scrolling, have you looked at the “screen” command?

$ screen
$ command
Ctrl-A, ESC
<up>/<down>/<pgup>/<pgdown>
ESC
$

You can also use less e.g:

anycmd | less