Difference between revisions of "Linux cheat sheet"

From Squared Wave
Jump to: navigation, search
(Run a process beyond an SSH session.)
Line 4: Line 4:
 
Useful for SSH’n into a machine and then starting a process and being able to close the session without killing the job. Also useful for running multiple programs in one ssh session.
 
Useful for SSH’n into a machine and then starting a process and being able to close the session without killing the job. Also useful for running multiple programs in one ssh session.
  
Install screen if you haven’t already
+
Install [https://linux.die.net/man/1/screen screen] if you haven’t already
  
 
sudo apt-get install screen -y
 
sudo apt-get install screen -y
Line 15: Line 15:
  
 
screen -x myjob
 
screen -x myjob
 
  
 
==Run a program on a remote display:==
 
==Run a program on a remote display:==

Revision as of 10:00, 19 April 2019

Most of these tips are useful with the Raspberry Pi.

Run a process beyond an SSH session.

Useful for SSH’n into a machine and then starting a process and being able to close the session without killing the job. Also useful for running multiple programs in one ssh session.

Install screen if you haven’t already

sudo apt-get install screen -y

Run screen on the server and use -S flag to give the session a name.

screen -S myjob

Log in via ssh from the remote machine and use the -x flag to attach to that session

screen -x myjob

Run a program on a remote display:

When you run graphical programs over SSH the server will often throw errors about no screen being present. You need to put the display you want have the program to display to in your environment. You can do this by first runing “w” to see connected displays and then:

Run export to bring the proper display into your environment.

export DISPLAY=:0

Run your program.

python samplepythoncode.py

Quickly determine Pi CPU temperature: Run the following command in terminal.

/opt/vc/bin/vcgencmd measure_temp

Set up wifi on a Pi with simple file:

Create a file called “wpa_supplicant.conf” with the following content and place at root of “boot”

network={

   ssid="SSID Name"
   psk="Password"
   key_mgmt=WPA-PSK

}