call the top command in non-interactive mode through other programs or scripts, often appear :
top: failed tty get error
solution: add the -b option to either
-b: Batch mode operation
Starts top in < A1> < AF> Batch mode< A1> < AF> You< which could be useful for sending output from top to other programs or to a file. In this mode, top will not accept input and runs until the iterations limit you< A1> < AF> ve set with the < A1> < AF> -n< A1> < AF> command-line option or until killed.
for example: top-bn 1
nohup top-b | grep init > > top.log & (Top. Log content is displayed slowly)
nohup /usr/bin/top -b | grep init > > top.log & (top. Log content appears fast)
Read More:
- Nohup command in Linux: nohup: assigning input and attaching output to‘ nohup.out ’
- The remote port occupation of Linux startup jar package script reports an error
- Java jar close startup script
- How to solve oserror: [errno 98] address already in use and kill the python3 process
- (20200912Solved) nohup: ignoring input and appending output to ‘nohup.out‘
- Encounter the situation of convergence warning
- Running Python 3.7 web.py Runtimeerror: generator raised stopiteration exception occurred during test
- Convergence warning: lbfgs failed to converge (status=1): Stop: total no. of iterations reached L
- Causes and solutions of black frame flashback after debugging visual studio 2017
- Mac reports an error zsh: fork failed: resource temporarily unavailable (reasons and solutions)
- Common linux commands — find command’s Exec
- The solution of “error in NLS loop more than 50” in R language
- Package pdftex.def Error: PDF mode expected, but DVI mode detected!_ mdpi_ Templatex compilation error in winedt
- self._handle = _dlopen(self._name, mode) OSError: [WinError126] The specified module could not found
- FTP 550 Failed to change directory
- C + + uses system (“pause”) to pause black windows
- Raspberry pie 4B uses adafruit_ Pca9685 report error ioerror: [errno 121] remote I / O error solution
- How to clean up the disk space of Linux server
- FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
- chatbot error: [E941] Can‘t find model ‘en‘