Skip to content

Common commands

file directory operations

# View the current directory location
 pwd
/root

# go to another directory
 cd /hy-nas

/hy-nas# pwd
/hy-nas

# create an empty file
 touch emptyfile

# View files in the current directory
 ls
emptyfile

# Create a directory in the current directory
 mkdir directory

 cd directory
~/directory# pwd
/root/directory

# Delete Files
 rm emptyfile

# delete folder
 rm -rf directory

System software installation

# This command must be executed before the installation is performed to update the metadata of the remote warehouse to the local
 apt update

# install or upgrade packages
 apt install pigz

Python package installation

# List installed packages
 pip list

# Install PIP package, it is recommended to add --no-cache parameter to disable local cache
 pip install flask --no-cache

# uninstall pip package
 pip uninstall flask

Compress and decompress files

# Extract the .tar.gz file to the current directory
 tar -xf compress.tar.gz

# Extract the .tar.gz file to the /hy-nas directory
 tar -C /hy-nas -xf compress.tar.gz

# Compress files and folders into .tar.gz files
 tar -zcf compress.tar.gz file directory


# Unzip zip or rar It is recommended to use 7z command, use apt to install
 apt-get update
 apt-get install p7zip-full -y

# Unzip the .zip file to the current directory
 unzip -q compress.zip

# If the zip exceeds 1GB, it is recommended to use the 7z command to decompress, and directly add the decompression path after -o
 7z x compress.zip -o/hy-nas

# Compress files and folders into .zip files
 zip -q -r compress.zip file directory

# Extract the .rar file to the current directory
 7z x compress.rar

system commands

# View process information
 ps -efw

# View graphics card information, this method cannot see the process
 nvidia-smi

# Another way to view graphics card information, you can see if there is a process occupying the graphics card
 py3smi