How To Install / Use Linux Screen
Hello Again, I have decided to make this How To because I was searching a lot until I found this command/function. Without this utility I was forced to leave open the ssh session because if I was closing the session my miner wasn't running anymore.
I use my Raspberry Pi to mine cryptocurrency, if you want to know how check this link https://steemit.com/bitcoin/@dury10/miner-how-to-start-mining-verium-on-raspberry-pi-3-step-by-step-for-noobs
On my Raspberry Pi3 I use Pi64 OS, if you want to know more about this and how to install it, check this link https://steemit.com/raspberry/@dury10/how-to-install-64-bit-os-on-a-raspberry-pi-3-step-by-step-for-newbies
What its Linux Screen? Linux Screen allows you to:
Use multiple shell windows from a single SSH session.
Keep a shell active even through network disruptions.
Disconnect and re-connect to a shell sessions from multiple locations.
Run a long running process without maintaining an active shell session.
If you want to know more about ssh and how to install it on linux check this link https://steemit.com/raspberry/@dury10/how-to-install-use-ssh-on-a-raspberry-pi-3-step-by-step-for-noobs
So let's get started:
Start a SSH session log in to your Pi
Let's install screen. I use pi64 os and screen it is not native so we need to install it.
To install screen you just need to type this command :
sudo apt-get install screen
How to use Screen
Les say you want to open in background your miner or whatever you want.
First you need to type
screenand pres enter, it will show you a screen with the names of the developers and the history of screen. You need to press enter and it will start like a new command line. Now you are in the same place (directory) you was when you executed the screen command.
To start the mine we need to go to the miner folder, in our case "veriumMiner" so we need to type this command :
And now to start the miner type the specify command
./cpuminer -n 1048576 -o stratum+tcp://eu.vrm.mining-pool.ovh:3032 -u Weblogin.WorkerName -p WorkerPassword
Now because you used screen if you close your session the miner will still work in background
To see if you have any session open type this command
it will show you something like this
[email protected]:~$ screen -ls There is a screen on: ` 987.pts-0.raspberrypi (12/22/17 21:09:52) (Detached) 1 Socket in /run/screen/S-pi. [email protected]i:~$
This means you have a screen process ruining in background
To reattach to a opened session you have to type this command
screen -r [session #of the process or the name of the process]in our case
screen -r 987or
screen -r pts
To detach from a screen session you need to use the
You can also detach by closing the putty window and the process it will remain open
To close / kill a screen process you need to type this command
screen -X -S [session # you want to kill] kill
in our case it will be
screen -X -S 987 kill
"kill" will only kill one screen window. To "kill" the complete session, use quit.
screen -X -S [session # you want to kill] quit
To close a screen session where all tasks are finished you can type
Now let's create another screen session by typing.
A new, blank screen session opens
Changing sessions, now you can browse your two screen sessions by running
Ctrl a p
For more info you can type
screen -help and it will show you all the Options that you have for screen function.
For even more detailed info you can run this command
If you found this How to useful give it a Vote if you don't leave a comment why and do not forget to follow me for more how to's!
Feel free to use and improve this little tutorial