Skip to main content

Common Commands

Common pip Commands​

By default, the GPUGEEK platform installs the pip command using miniconda3. You can check the pip installation directory with the following pip -V command.

Check the pip installation directory

pip -V

Check the location of the pip executable

command -V pip

Check the current pip version

pip --version

List all installed packages

pip list 

Install the latest version of the numpy library

pip install numpy

Uninstall a specified library

pip uninstall numpy

Install a specified package version

pip install numpy==1.26.1

Search all available versions of a package

pip install numpy==
# Or visit https://pypi.org/ to search for a package and view its release history

Install a package from a specified source (useful if the default source is slow)

pip install numpy -i https://pypi.doubanio.com/simple/ 

Install multiple packages from a requirements.txt file

pip install -r requirements.txt

Uninstall multiple packages from a requirements.txt file

pip uninstall -r requirements.txt

Download a package to a specified directory without installing

pip download numpy -d /gz-data/

Install a package from a downloaded or cloned file

pip install ./gz-data/numpy-1.26.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Check the compatibility of a specified package

pip check numpy

Show detailed info of an installed package

pip show numpy

List all outdated packages

pip list --outdated

Upgrade a specified package

pip install --upgrade numpy

Upgrade pip itself

pip install --upgrade pip

View current pip configuration

pip config list

Permanently change pip source

pip config set global.index-url --site https://pypi.tuna.tsinghua.edu.cn/simple

View the default path of pip-installed packages

python3 -m site

Common conda Commands​

Check conda version

conda --version

Show conda information

conda info

Update conda itself (and other packages)

conda update conda

Update a specified package (example: zlib)

conda update zlib

List all environments

conda env list
conda info -e

Create a virtual environment with Python 3.8.10

conda create -n GPUGEEK python==3.8.10

Activate environment named GPUGEEK

conda activate GPUGEEK

Deactivate current environment

conda deactivate

Delete a specified environment

conda remove --name GPUGEEK --all

List installed packages

conda list

Create environment in a specified directory

conda create -p /gz-data/myenv python=3.8.10

Install numpy in the current environment

conda install numpy

Install a package in a specified environment

conda install --name GPUGEEK numpy

Remove a package from the current environment

conda remove numpy

Remove a package from a specified environment

conda remove --name GPUGEEK numpy

Search all available numpy versions

conda search numpy

Search numpy versions greater than or equal to 1.24

conda search 'numpy>=1.24'

Check conda cache size

du -sh /root/.cache/conda/

Clean conda cache

conda clean --all

Clone an environment

conda create --name gm --clone GPUGEEK

Export packages in an environment

conda env export --name gm > gm.yml

Delete a specified environment

conda env remove --name gm

Compression and Decompression Commands​

Common commands: tar, zip, unzip, gzip, gunzip, 7z, bzip2, bunzip2, xz, unxz, rar, unrar.

tar​

# Compress file_or_directory into archive.tar
tar -cvf archive.tar file_or_directory

# Compress multiple files or directories into archive.tar
tar -cvf archive.tar file1 file2 directory1 directory2

# Extract archive.tar
tar -xvf archive.tar

# Extract archive.tar to /gz-data/
tar -xvf archive.tar -C /gz-data/

zip & unzip​

zip -r archive.zip file_or_directory
zip -r archive.zip file1 file2 directory1 directory2
unzip archive.zip
unzip archive.zip -d /gz-data/

gzip & gunzip​

gzip file
gunzip file.gz

7z​

7z a archive.7z file_or_directory
7z a archive.7z file1 file2 directory1 directory2
7z x archive.7z
7z x archive.7z -o/gz-data/

bzip2 & bunzip2​

bzip2 file
bunzip2 file.bz2

xz & unxz​

xz file
unxz file.bz2

rar & unrar​

rar a archive.rar file_or_directory
rar a archive.rar file1 file2 directory1 directory2
unrar x archive.rar
unrar x archive.rar /gz-data/

apt Install and Remove Commands​

Update package list

sudo apt-get update -y

Install a package

sudo apt-get install busybox -y

Remove a package but keep config

sudo apt-get remove busybox -y

Remove package and config

sudo apt-get purge busybox

Upgrade all packages

apt-get upgrade

Search for a package

apt-cache search busybox

File Operation Commands​

ls

ls
ls -a
ls -l
ls -R

cd

cd /gz-data/
cd ..
cd

pwd

pwd

mkdir

mkdir new_directory
mkdir dir1 dir2 dir3
mkdir -p /path/to/dir1/dir2

touch

touch newfile.txt
touch existingfile.txt

cp

cp source.txt destination.txt
cp -r source_directory destination_directory

mv

mv source.txt /path/to/destination
mv oldname.txt newname.txt

Process Management Commands​

ps -ef
ps aux
ps -u root
ps -ef | grep python
ps aux | grep python
top
kill PID
kill -9 PID
pkill process_name
killall process_name
lsof
lsof -u username
lsof -i :port_number
nohup command &
jobs
fg %job_number
bg %job_number

nvidia-smi
nvidia-smi -l 1
watch -n 1 nvidia-smi
nvidia-smi -i 0
nvidia-smi --query-gpu=temperature.gpu,utilization.gpu --format=csv
py3smi
nvitop
nvidia-smi --query-gpu=memory.used,memory.total --format=csv
nvidia-smi -a
nvidia-smi --query-gpu=utilization.gpu,utilization.memory --format=csv