Legacy Quick Reference: Common Linux Commands

tmux

Create a session

tmux new -s <session_name>

Enter a session

tmux attach -t <session_name>

List existing sessions

tmux ls

Remove a session

tmux kill-session -t <session_name>

Directory operations

Remove a directory and its contents

rm -r <folder_path>

Force-recursive-deletion signature (recognition only)

rm -rf <folder_path>

Force-recursive deletion skips some confirmations and can cause irreversible loss when a variable is empty or a path is miscalculated. This knowledge base does not provide a directly runnable version. First study absolute paths, ownership, symbolic links, and target-boundary checks in File and directory operations.

Compressing and extracting directories

Create a .tar archive

tar -cvf a.tar <folder_path>

Create a .tar.gz archive

tar -czvf <archive_name>.tar.gz <folder_path>

Create a .zip archive

zip -r <archive_name>.zip <folder_path>

Extract a .tar archive

tar -xvf <archive_name>.tar

Extract a .tar.gz archive

tar -xzvf <archive_name>.tar.gz

Extract a .zip archive

unzip <archive_name>.zip

Before extracting an untrusted archive, list its contents and constrain the destination to a newly created empty directory. See Archiving and extraction.

Conda environment management

Show the Conda version

conda --version

List all environments

conda env list

The currently active environment is marked with *.

Create an environment

conda create --name <env_name> python=<python_version>

For example, create myenv with Python 3.11:

conda create --name myenv python=3.11

Activate and leave an environment

conda activate <env_name>
conda deactivate

List packages in an environment

conda list --name <env_name>

Search, install, update, and remove packages

conda search <package_name>
conda install --name <env_name> <package_name>
conda update --name <env_name> <package_name>
conda remove --name <env_name> <package_name>

Install from a named channel:

conda install --name <env_name> --channel conda-forge <package_name>

Clone an environment

conda create --name <new_env_name> --clone <source_env_name>

Export and reproduce an environment

Exporting only the principal manually installed dependencies is usually more suitable for cross-platform reproduction:

conda env export --name <env_name> --from-history > environment.yml

Create or update an environment from an environment file:

conda env create --file environment.yml
conda env update --file environment.yml --prune

Remove an entire environment

conda remove --name <env_name> --all

Before removal, confirm the environment name with conda env list. When you need pip, activate the intended Conda environment first, then run python -m pip ... to avoid installing into the wrong Python environment.