- Open a terminal on your Linux machine.
- Copy a file from Windows to Linux:
scp /path/to/local/file username@linux_host:/path/to/remote/directory
/path/to/local/file– path to the file on Windowsusername– your Linux userlinux_host– IP or hostname of the Linux machine/path/to/remote/directory– destination folder on Linux
-
Open a terminal.
-
Install the venv package (if needed):
sudo apt install python3-venv
-
Navigate to your project directory.
-
Create the virtual environment:
python3 -m venv myenv
Change
myenvto whatever name you like. -
Activate it:
source myenv/bin/activate
-
Open a terminal.
-
Navigate to your project directory.
-
Activate your virtual environment if you have one:
source myenv/bin/activateReplace
myenvwith your virtual environment name. -
Run the following command to create a requirements.txt file:
pip freeze > requirements.txtThis will list all installed packages and their versions in the current environment.
-
Open a terminal.
-
Navigate to your project directory.
-
Activate your virtual environment if you have one:
source myenv/bin/activateReplace
myenvwith your virtual environment name. -
Ensure you have a
requirements.txtfile in your project directory.If you don't have one, you can create it using the previous section's instructions.
-
Run the following command:
pip install -r requirements.txt
-
Open a terminal.
Ensure you have activated your virtual environment if you are using one.
-
Navigate to the directory containing your script.
-
Run the script using Python 3:
python3 script_name.py
Replace
script_name.pywith the name of your Python script.
-
Open a terminal.
Ensure you have activated your virtual environment if you are using one.
-
Navigate to the directory containing your script.
-
Run the script in the background:
nohup python3 script_name.py &Replace
script_name.pywith your script's name.
-
Open a terminal.
-
Navigate to the directory where you ran the script.
-
Check the output file:
cat nohup.out
This file contains the output of your script.
-
If you want to see the output in real-time, you can use:
tail -f nohup.out
-
Open a terminal.
-
List running processes:
ps aux
-
Locate your process and note its PID (second column).
-
Or search directly:
pgrep process_name
Replace
process_namewith the process you’re looking for.
-
Open a terminal.
-
Use the
killcommand with the PID:kill PIDReplace
PIDwith the actual process ID.
- Move Line Up/Down:
Alt + Up/Down Arrow - Add multiple cursors:
Ctrl + Alt + ClickorCtrl + Alt + Up/Down Arrow - Delete Line:
Ctrl + Shift + K - Comment/Uncomment Line:
Ctrl + / - Select current line:
Ctrl + L - Navigate to a specific line:
Ctrl + G - Go to Definition:
F12 - Select all occurrences of a operation:
Ctrl + F2 - Trim Trailing Whitespace:
Ctrl + KthenCtrl + X - Copy Line Up/Down:
Shift + Alt + Up/Down Arrow - Open Command Palette:
Ctrl + Shift + P - Open Markdown Preview:
Ctrl + Shift + V