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 lsRemove 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>.tarExtract a .tar.gz archive
tar -xzvf <archive_name>.tar.gzExtract a .zip archive
unzip <archive_name>.zipBefore 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 --versionList all environments
conda env listThe 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.11Activate and leave an environment
conda activate <env_name>
conda deactivateList 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.ymlCreate or update an environment from an environment file:
conda env create --file environment.yml
conda env update --file environment.yml --pruneRemove an entire environment
conda remove --name <env_name> --allBefore 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.