Friday, May 3, 2024
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 16376  / 3 Years ago, sat, november 20, 2021, 10:18:17

I was sued into another user to run screen, but I got the error Cannot open your terminal '/dev/pts/4' - please check.



I found a solution: script /dev/null and after that I can use screen. Why does this work? It creates a new pseudo terminal?


More From » command-line

 Answers
2

On UNIX, this is a virtual-file that can be written to. Data written to this file gets discarded. It is similar to the file call NUL on Windows machines.



Key point; When rooting a machine, intruders will often redirect logging to /dev/null For example, the command ln -s /dev/null .bash_history will cause the system to stop logging bash commands.



In layman's terms, it means much the same thing as black hole. Typical usage: if you don't like what I have to say, please direct your comments to /dev/null.



Think of /dev/null as a "black hole." It is the nearest equivalent to a write-only file. Everything written to it disappears forever. Attempts to read or output from it result in nothing. Nevertheless, /dev/null can be quite useful from both the command line and in scripts.




  • It discards all data written to it but reports that the write
    operation succeeded.

  • It means redirecting both standard output and error to /dev/null

  • It prevents the script from displaying anything. like windows "echo
    off"



script /dev/null prevent any message from appearing on your screen. It supresses the messages, byt directing them to the "black hole."



Also, have a look at Why does redirecting 'script' to /dev/null/ allow 'screen' to work while su'ed as another user?



Source:Linux Dictionary


[#30807] Monday, November 22, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lawain

Total Points: 150
Total Questions: 106
Total Answers: 101

Location: China
Member since Mon, Aug 22, 2022
2 Years ago
;