version 20250715, by AG, reformatted by Google Gemini 2.5 Pro
Commands for managing Python versions with pyenv and handling virtual environments.
# List all available python versions
pyenv versions
# Install a specific python version
pyenv install 3.9.13
# Set a specific python version for the current directory
pyenv local 3.10.6Note: You can use a Python version installed via pyenv as the interpreter for projects in IDEs like PyCharm.
First, ensure you've set your desired Python version using pyenv.
# Create a virtual environment in a folder named .venv
python3 -m venv .venv
# Activate the virtual environment
source .venv/bin/activate
# Deactivate the virtual environment
deactivateCommands for Git, SSH, SCP, and running processes on remote servers.
To discard all local changes and sync with the remote repository:
# Reset local repository to the last commit (discards all local changes)
git reset --hard
# Fetch the latest changes from the remote 'origin'
git fetch origin
# Pull the changes for a specific branch
git pull origin <branch_name># Connect to a remote server via SSH
ssh [email protected]
# Copy a local file to a directory on a remote server
scp platform_info.py [email protected]:~/working_dir
# Copy a directory from a remote server to the current local directory (-r for recursive)
scp -r [email protected]:~/remote_dir/ ./my_local_dirTo run a script in the background on a remote server, ensuring it continues even after you log out:
# Run a python script on CPU cores 1 and 2 in the background
nohup taskset -c 1,2 python measure_script.py &To run a script in the background on a remote server, ensuring it continues even after you log out:
sudo openconnect --servercert=<certwillbeissuedbyserveronconnectionattempt> --protocol=nc https://udun.site.cas.cz --authgroup="department" --user=username
- Connect to your server via SSH:
- On the server, activate the correct environment (e.g., conda) and start JupyterLab on a specific port:
# Example for conda conda activate my_custom_env # Start jupyter on port 8888, accessible from any IP on the server jupyter lab --no-browser --port=8888 --ip=0.0.0.0
- In a new local terminal window, create an SSH tunnel that forwards the server's port to your local machine:
ssh -L 8888:localhost:8888 [email protected]
- Open the JupyterLab URL (provided in the server's terminal output) in your local web browser. It will look something like
http://127.0.0.1:8888/lab?token=....
Commands to inspect system hardware, storage devices, and power status.
# Display a detailed tree of all hardware (device manager alternative)
sudo lshw
# List all PCI devices
lspci
# List all USB devices
lsusbsudo cpupower frequency-set -g performance # to set different governor
cpupower frequency-info # to check info and available governors# List all NVMe SSDs
sudo nvme list
# Get a detailed SMART log for a specific NVMe drive
sudo nvme smart-log /dev/nvmeXXX
# Show detailed info and wear for a drive using smartmontools
sudo smartctl -a /dev/nvme0n1
# Manually trigger the TRIM command on an SSD to clean unused blocks
sudo fstrim -v /Your primary camera is typically /dev/video0 and the IR camera might be /dev/video2.
# Enable the IR camera to activate when requested by an application
# Requires chicony-ir-toggle: [https://github.com/PetePriority/chicony-ir-toggle](https://github.com/PetePriority/chicony-ir-toggle)
chicony-ir-toggle -d /dev/video2 onTo find the keycode for a specific key press:
# Listens for key presses and prints their codes
acpi_listenFor a detailed guide, see the Gentoo Wiki on ThinkPad Special Buttons.
# Check the current power profile status
powerprofilesctlAlternatively this can be used:
sudo cpufreq-set -g performance
sudo cpufreq-set -g powersavewhere -g specifies the governor on CPU (available ones can be listed by cpufreq-info)
Commands for package management, desktop environment tweaks, and other utilities.
# Upgrade all installed Python packages using pip
pip install --upgrade $(pip freeze | awk '{split($0, a, "=="); print a[1]}')If the XFCE panel is broken, this command chain will reset it to its default configuration.
xfce4-panel --quit ; pkill xfconfd ; rm -rf ~/.config/xfce4/panel ; rm -rf ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml ; xfce4-panelMore details can be found on the Linux Mint Forums.
setxkbmap -option grp:shift_caps_toggle
# Scan a single file
clamscan MyFile.txt
# Scan an entire directory
clamscan suspiciousdirA powerful command-line tool for converting between formats like LaTeX, Word, Markdown, HTML, and more. See Pandoc Demos.
# Convert a LaTeX file to a .docx Word document
pandoc -s DP_AG.tex -o example2.docx
# Convert a .docx Word document to a LaTeX file
pandoc -s Layout_AG.docx -o example3.texA lightweight option for running virtual machines on Linux.
# Install the core QEMU system
sudo apt install qemu-system
# Install Virt-Manager, a GUI for managing QEMU/KVM virtual machines
sudo apt install virt-manager