Viewing Rec SDK Torch Installation and Uninstallation Records

Rec SDK Torch is presented as a .wheel package. Its installation and uninstallation logs are recorded in the system history.

Viewing Historical Installation and Uninstallation Records

When you log out of the system or exit a container (Rec SDK Torch is usually installed and running in a container), the historical command records are saved to the ~/.bash_history file. Therefore, you can directly view the .bash_history file to find the Rec SDK Torch installation and uninstallation records.

Changing the Number of Historical Records

In Linux, the history command saves the latest 1,000 commands by default. To change the number of saved commands, for example, to retain only 200 historical commands, modify the HISTSIZE environment variable in the /etc/profile file. The modification methods are as follows:
  • Use an editor, such as the vim editor.
  • Run the sed command. For example:

    sed -i 's/^HISTSIZE=number/HISTSIZE=newNumber/' /etc/profile, where number indicates the number of commands before modification and newNumber indicates the number of commands after modification. For example, to change the number of saved commands from 1,000 to 200, run the following command:

    1
    sed -i 's/^HISTSIZE=1000/HISTSIZE=200/' /etc/profile
    

After the modification, run the source /etc/profile command for the environment variables to take effect.

Changing the Timestamp of a Historical Command File

If you want to have timestamp records in a historical command file, add the following configuration to the /etc/profile file:

HISTTIMEFORMAT='%F %T '

After the modification, run the source /etc/profile command for the environment variables to take effect. After the timestamp is added, the history command output is as follows:

1
2
3
4
2025-08-18 10:01:57 pip3 install XXX-none-linux_x86_64.whl --force-reinstall
2025-08-18 10:01:57 pip3 install XXX-none-linux_x86_64.whl --force-reinstall
2025-08-18 10:04:37 history | grep "pip3 install"
2025-08-18 10:10:17 history | grep "pip3 install"

In addition, if you need to record historical commands in a user-defined file, set the HISTFILE environment variable in /etc/profile and run the source /etc/profile command for the environment variable to take effect. For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
HISTDIR=~/log/RecSDK_Torch   # Configure the file for storing historical command records.
HISTFILE="$HISTDIR/RecSDK.log"
mkdir -p $HISTDIR
chmod 750 $HISTDIR
touch $HISTFILE
chmod 640 $HISTFILE
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
if [ -z $USER_IP ]
then
  USER_IP=`hostname`
fi
export HISTTIMEFORMAT="%F %T $USER_IP:`whoami` "    # history command output format: time, IP address, user name, and command execution
PROMPT_COMMAND=' { date "+%Y-%m-%d %T - $(history 1 | { read x cmd; echo "$cmd"; })"; } >> $HISTFILE'    # Write the history command to the configured file in real time.

The log file path is ~/log/RecSDK_Torch. Ensure that the drive space is sufficient and the permission on the log file is 640.