How to use the Ubuntu
How to use the Ubuntu
Introduction
As far as I have noted, I will force myself to write all my blogs in English. So, if you are lucky or unlucky, you have read this blog, and I hope it can be helpful to you. Reading an English document can be a tricky task, as well as writing a blog in English.
In this blog, I will record all the problems that I encountered and the possible feasible solutions to them (you know, no model of solution is universal), including my train of thought.
And I'll avoid any unnecessary usage of images because the official document always has no images.
I'll write the references at the end of this article, if you are interested in them, just visit them. And I also will mention some of them in the relevant part of the article.
And, as I'm still a beginner at coding, and my mother tongue is not English, but Chinese, if there are any problems, point them out and try to let me know.
Emm, as this blog is so long I might have no mood to overwrite it in Chinese again.
Using English can prevent the fool from copying others' blogs without any needed illustrations and make the readers think more about it(as time goes by, you will have to take tea with the projects or documents that are written in English, you could just regard my article as the first step for you to adapt the environment of English, and I'll try my best to make my blog be friendly to read, using the words that human can realize not like those using words just like the alien), at least in the world of our Chinese, just in my own opinion.
This blog needs to be updated in the future, I just hope that I'll have the time and mood to do so.
Note:
- My system is
Ubuntu 24.04 LTS. - I chose English as the default language option when I installed the Ubuntu system.
- All the references I will list at the end of this blog, are named
References. - References don't mean that I use them in this blog, maybe I add them just because of that I regard them as supplementary material to the related part.
Catalog
- How to use the Ubuntu
- Introduction
- Catalog
- Why my apt doesn't work
- Emm, how can I run the
AppImage? - How about install the rime(or Chinese Input Method by step 3 and step 4)
- How to use the grub
- Why the time of my Windows and Linux are different from each other, and the interval is always 8 hours?
- How to use the dictionary on Ubuntu
- How to play the music on Ubuntu
- How to code on Ubuntu
- References
Why my apt doesn't work
sudo apt update, fail to connect.
Just like what we have done to Python, we should change the source of the Ubuntu to avoid such a kind of problem.
Visit https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/, and follow the guide, and then it works.
cd /etc/apt/sources.list.d/
sudo cp ubuntu.sources ubuntu.sources.bak
sudo vim ubuntu.sources(My system isUbuntu 24.04 LTS, apply the format of DEB822)Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# Types: deb-src
# URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
# Suites: noble noble-updates noble-backports
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # Types: deb-src
# URIs: http://security.ubuntu.com/ubuntu/
# Suites: noble-security
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # Types: deb
# URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports
# Suites: noble-security
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # Types: deb-src
# URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports
# Suites: noble-security
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # 预发布软件源,不建议启用 # Types: deb
# URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
# Suites: noble-proposed
# Components: main restricted universe multiverse
# Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg # # Types: deb-src
# # URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
# # Suites: noble-proposed
# # Components: main restricted universe multiverse
# # Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
sudo apt update
You may encounter this question fcitx-team-ubuntu-nightly-noble not found 404.
Don't worry, just need to run this command sudo mv /etc/apt/sources.list.d/fcitx-team-ubuntu-nightly-noble.sources /etc/apt/sources.list.d/fcitx-team-ubuntu-nightly-noble.sources.bak.
It works.
Emm, how can I run the AppImage?
Problems I encountered
Sometimes, you can install the application by using the App Center, and it is practicable for basic usage. But, if the software that you want to install is not accessible by the App Center, you might turn to the website or other channel to access it.
Then, you may be confused about the things that I list below(e.g. https://b3log.org/siyuan/en/download.html):
-
AppImagex86_64arm64 -
debx86_64arm64 -
tar.gzx86_64arm64 -
Source
As the recommended option is AppImage, I will focus on it(If I need to introduce other options in the future, like deb or tar.gz, maybe I will make the supplement for it).
So, I installed it and didn't know how to run it. I clicked it like I have done in the Windows system, but it didn't work.
I realized it was time for me to STFW, and I did it(if you are interested in it or just want to explore it in hand, you can click here).
AppImages require FUSE version 2 to run. Filesystem in Userspace (FUSE) is a system that lets non-root users mount filesystems.
So, if you want to run the AppImage, you need to install the FUSE. (For more details, just visit the https://github.com/AppImage/AppImageKit/wiki/FUSE)
Ubuntu>=24.04
sudo add-apt-repository universe
sudo apt install libfuse2t64
Ubuntu>=22.04
sudo add-apt-repository universe
sudo apt install libfuse2
Why do we use the AppImage
AppImage provides a way for upstream developers to provide “native” binaries for Linux users just the same way they could do for other operating systems.
It allow packaging applications for any common Linux based operating system, e.g., Ubuntu, Debian, openSUSE, RHEL, CentOS, Fedora etc.
AppImages come with all dependencies that cannot be assumed to be part of each target system in a recent enough version and will run on most Linux distributions without further modifications.
In conclusion, you can regard the AppImage as a universal format of applications that can be run in any common Linux.
In general, It is not installed on your system, so if you want to uninstall it, just remove it.
If it is automatically integrated with your desktop, you may need to remove the desktop files manually.
AppImage features:
- Distribution agnostic: Can run on various different Linux distributions
- No need of installing and compiling software: Just click and play
- No need for root permission: System files are not touched
- Portability: Can be run anywhere including live disks
- Apps are in read-only mode
- Software is removed just by deleting the AppImage file
- Applications packaged in AppImage are not sandboxed by default.
How to run the AppImage
You exactly have three methods to run an AppImage, by GUI, terminal, or desktop.
GUI
- Open your file manager and browse to the location of the AppImage
- Right-click on the AppImage and click the ‘Properties’ entry
- Switch to the Permissions tab and
- Click the ‘Allow executing file as program’ checkbox if you are using a Nautilus-based file manager (Files, Nemo, Caja), or click the ‘Is executable’ checkbox if you are using Dolphin, or change the ‘Execute’ drop down list to ‘Anyone’ if you are using PCManFM
- Close the dialog
- Double-click on the AppImage file to run
I think the guide from the official document is enough, and it did work when I had a try.
Terminal
Use the command chmod a+x <AppImage File>, then you can double-click it to run it.
But if you want to run it by using ./<AppImage File>, it can be a tricky task(maybe not, not every AppImage will cause such a kind of problem).
You can see that the error message may be shown like this:
[51026:0926/080644.846932:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /tmp/.mount_SiYuanBgR0wT/chrome-sandbox is owned by root and has mode 4755.
Trace/breakpoint trap (core dumped)
You might want to solve it in this way:
sudo chown root /tmp/.mount_SiYuanBgR0wT/chrome-sandbox-
sudo chmod 4755 /tmp/.mount_SiYuanBgR0wT/chrome-sandbox
But it didn't work(It might work in some AppImage).
chown: cannot access '/tmp/.mount_SiYuanBgR0wT/chrome-sandbox': No such file or directory
You may not encounter this kind of problem in other AppImage files, but I'm not lucky enough.
But at least, I can double-click it to run it.
OK, may this command work. sudo ./SiYuan.AppImage
[0926/082147.923059:FATAL:electron_main_delegate.cc(295)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
Trace/breakpoint trap
sudo ./SiYuan.AppImage --no-sandbox
Many errors, and it didn't work. STFW again, this time, I turn to askubuntu.com for help.
Try this command ./SiYuan.AppImage --no-sandbox.
It works, but it's not safe.
Someone provides a safe solution. But it didn't work for me.
SiYuan.AppImage --appimage-extract
SiYuan.AppImage: command not found
Now, go to the official document for possible help.
OK, it still didn't work for me, just put it aside.
Desktop
You might want to use the AppImage as how you use the Firefox, but how can it be searched in Show Apps, and be added to the Dock?
The answer is: .desktop.
[sudo] vim
<AppImage file>.desktop file(if you directly edit it on the location that I listed below, you may needsudo)Edit it like this
[Desktop Entry]
Encoding=UTF-8
Type=Application
#Name of the Application
Name=LANDrop
#The path of the Application icon
Icon=/home/user/图片/APP.svg
#Whether open the terminal when starting it
Terminal=false
#The path of the AppImage
Exec=/home/user/APP/APP.AppImage
#The categories of the AppImage
Categories=Utility;
After editing the
.desktop file, you canmv it to the location listed below(based on your request):
/usr/share/applications/ - System Area, Showed to All users, Managed by System Package Manager.
/usr/local/share/applications/ - System Area, Showed to All users, Manually managed or installed.
~/.local/share/applications/ - Only Shown to the current user, Manually managed or installed.
Then you can use this command to make it able to execute
sudo chmod a+x <AppImage file>.desktop(if the owner is root)- Also, you can use the
chown to change the owner of this file.
- Also, you can use the
sudo chmod u+x <AppImage file>.desktop
After that, you can find it in your
Show Apps, use it, or add it to theDock.
Note: If you want to run SiYuan, you may have to add the option --no-sandbox to the Exec.
How about creating the .desktop file automatic
If every time we have to write all of this manually, it is repetitive. So, how about writing a function in bash?
[Desktop Entry]
Encoding=UTF-8
Type=Application
#Name of the Application
Name=LANDrop
#The path of the Application icon
Icon=/home/user/图片/APP.svg
#Whether open the terminal when starting it
Terminal=false
#The path of the AppImage
Exec=/home/user/APP/APP.AppImage
#The categories of the AppImage
Categories=Utility;
Assume that I always put the AppImage file in the path like ~/Applications/<AppImage file dir>/<AppImage file>.
We may only want to type the name of the application, and set the default value for the Encoding, Type, Terminal, Exec, and Categories.
Remember this?
/usr/local/share/applications/
- System Area, Showed to All users, Mannually managed or installed
~/.local/share/applications/
- Only Showed to the current user, Mannually managed or installed
We can write the .sh to achieve it.
For
~/.local/share/applications/ (In general, recommending to use this path)
UInAppImage.sh Used for init the AppImage to your desktop#!/bin/bash # Function to initialize an AppImage for the current user
UInAppImage() {
local app_dir
local app_name_base
local app_icon
local use_default_icon_extension
local use_default_icon_path
local exec_options="" # Get the base directory where all AppImages are stored
local appimage_base_dir=~/Applications # Check if the base directory for AppImages exists
if [[ ! -d "$appimage_base_dir" ]]; then
read -p "The directory $appimage_base_dir does not exist. Do you want to create it? (y/n): " create_dir
if [[ "$create_dir" == "y" || "$create_dir" == "Y" ]]; then
mkdir -p "$appimage_base_dir"
if [[ $? -ne 0 ]]; then
echo "Failed to create directory $appimage_base_dir."
return 1
fi
else
read -p "Enter the full path for the AppImage directory: " appimage_base_dir
if [[ ! -d "$appimage_base_dir" ]]; then
echo "The specified directory does not exist."
return 0
fi
fi
fi # Prompt the user for the AppImage file directory
read -p "Enter the AppImage file directory (relative to $appimage_base_dir): " app_dir # Create the directory if it does not exist
mkdir -p "$appimage_base_dir/$app_dir" # Validate if the AppImage directory was created successfully
if [[ ! -d "$appimage_base_dir/$app_dir" ]]; then
echo "Error: Failed to create AppImage directory."
return 1
fi # Prompt the user for the base application's name (without .AppImage)
read -p "Enter the base name of the application (do not include '.AppImage'): " app_name_base # Validate application base name
if [[ -z "$app_name_base" ]]; then
echo "Error: Application base name cannot be empty."
return 1
fi # Construct the full application name with .AppImage
local app_name="${app_name_base}.AppImage"
local app_exec="$appimage_base_dir/$app_dir/$app_name" # Check if the AppImage file exists and add execute permissions if necessary
if [[ -f "$app_exec" ]]; then
echo "AppImage file found. Adding execute permissions..."
chmod +x "$app_exec"
else
echo "Error: AppImage file does not exist."
return 1
fi # Determine if the user wants to use the default .png extension for the icon
read -p "Would you like to use the default .png extension for the icon? (y/n): " use_default_icon_extension
if [[ "$use_default_icon_extension" == "y" || "$use_default_icon_extension" == "Y" ]]; then
# Offer to use the default icon path
read -p "Would you like to use the default icon path ($appimage_base_dir/$app_dir/)? (y/n): " use_default_icon_path
if [[ "$use_default_icon_path" == "y" || "$use_default_icon_path" == "Y" ]]; then
# Use default icon path
app_icon="$appimage_base_dir/$app_dir/${app_name_base}.png"
else
# User wants to specify the icon path
read -p "Enter the full path of the application icon: " app_icon
fi
else
# Offer to use the default icon path without default extension
read -p "Would you like to use the default icon path ($appimage_base_dir/$app_dir/) without default extension? (y/n): " use_default_icon_path
if [[ "$use_default_icon_path" == "y" || "$use_default_icon_path" == "Y" ]]; then
# Use default icon path without default extension
app_icon="$appimage_base_dir/$app_dir/${app_name_base}"
else
# User wants to specify the icon path and extension
read -p "Enter the full path of the application icon: " app_icon
fi
fi # Validate icon path
if [[ ! -f "$app_icon" ]]; then
echo "Error: Icon file does not exist."
return 1
fi # Check if ~/.local/share/applications directory exists, create if not
local desktop_dir="$HOME/.local/share/applications"
if [[ ! -d "$desktop_dir" ]]; then
echo "Creating $desktop_dir directory..."
mkdir -p "$desktop_dir"
fi # Create the .desktop file path
local desktop_file_path="$desktop_dir/${app_name_base}.desktop" # Check if .desktop file already exists
if [[ -e "$desktop_file_path" ]]; then
read -p "A .desktop file already exists. Do you want to replace it? (y/n): " replace_desktop
if [[ "$replace_desktop" != "y" && "$replace_desktop" != "Y" ]]; then
echo "Operation canceled. The .desktop file was not replaced."
return 0
fi
# Remove the existing .desktop file
rm "$desktop_file_path"
fi # Prompt for adding --no-sandbox option to Exec
read -p "Do you want to add --no-sandbox option to Exec? (y/n): " use_sandbox
if [[ "$use_sandbox" == "y" ]]; then
exec_options="--no-sandbox"
fi # Create the .desktop file
cat > "${app_name_base}.desktop" << EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=$app_name_base
Icon=$app_icon
Terminal=false
Exec="$app_exec" $exec_options
Categories=Utility;
EOF # Make the .desktop file executable
chmod +x "${app_name_base}.desktop" # Move the .desktop file to the applications directory
mv "${app_name_base}.desktop" "$desktop_file_path" # Inform the user of the created .desktop file
echo "The .desktop file has been created at: $desktop_file_path"
} # Call the function to initialize the AppImage for the current user
UInAppImage
UUnAppImage.sh Used for uninstall the AppImage(but may have some requirements to your construction of directories)#!/bin/bash # Function to uninstall an AppImage for the current user
UUnAppImage() {
local app_dir
local app_name_base
local app_exec
local desktop_file_path
local icon_file_path
local appimage_base_dir=~/Applications # Base directory where all AppImages are stored # Prompt the user for the AppImage file directory
read -p "Enter the AppImage file directory (relative to $appimage_base_dir): " app_dir # Prompt the user for the base application's name (without .AppImage)
read -p "Enter the base name of the application (do not include '.AppImage'): " app_name_base # Construct the full application name with .AppImage
app_exec="$appimage_base_dir/$app_dir/$app_name_base.AppImage" # Ask if the user wants to remove the AppImage file
read -p "Do you want to remove the AppImage file? [y/N]: " remove_appimage
if [[ "$remove_appimage" =~ ^[Yy]$ ]]; then
if [[ -f "$app_exec" ]]; then
echo "Removing AppImage: $app_exec"
rm "$app_exec" # Check if the removal was successful
if [[ $? -eq 0 ]]; then
echo "AppImage removed successfully."
else
echo "Failed to remove AppImage."
return 1
fi
else
echo "AppImage does not exist."
return 1
fi
else
echo "Skipping removal of AppImage."
fi # Ask if the user wants to remove the .desktop file
read -p "Do you want to remove the .desktop file? [y/N]: " remove_desktop
if [[ "$remove_desktop" =~ ^[Yy]$ ]]; then
desktop_file_path="$HOME/.local/share/applications/$app_name_base.desktop"
if [[ -f "$desktop_file_path" ]]; then
echo "Removing .desktop file: $desktop_file_path"
rm "$desktop_file_path"
if [[ $? -eq 0 ]]; then
echo ".desktop file removed successfully."
else
echo "Failed to remove .desktop file."
fi
else
echo ".desktop file does not exist."
fi
else
echo "Skipping removal of .desktop file."
fi # Ask if the user wants to remove the application icon
read -p "Do you want to remove the application icon? [y/N]: " remove_icon
if [[ "$remove_icon" =~ ^[Yy]$ ]]; then
icon_file_path="$appimage_base_dir/$app_dir/${app_name_base}.png"
if [[ -f "$icon_file_path" ]]; then
echo "Removing icon file: $icon_file_path"
rm "$icon_file_path"
if [[ $? -eq 0 ]]; then
echo "Icon file removed successfully."
else
echo "Failed to remove icon file."
fi
else
echo "Icon file does not exist."
fi
else
echo "Skipping removal of icon file."
fi # Ask if the user wants to remove the AppImage directory
read -p "Do you want to remove the AppImage directory ($app_dir)? [y/N]: " remove_app_dir
if [[ "$remove_app_dir" =~ ^[Yy]$ ]]; then
app_dir_path="$appimage_base_dir/$app_dir"
if [[ -d "$app_dir_path" ]]; then
echo "Removing AppImage directory: $app_dir_path"
rm -r "$app_dir_path"
if [[ $? -eq 0 ]]; then
echo "AppImage directory removed successfully."
else
echo "Failed to remove AppImage directory."
fi
else
echo "AppImage directory does not exist."
fi
else
echo "Skipping removal of AppImage directory."
fi echo "Uninstallation process completed."
} # Call the function to uninstall the AppImage for the current user
UUnAppImage
For
/usr/local/share/applications/
AUInAppImage.sh Used for init the AppImage#!/bin/bash # Function to initialize an AppImage for all users
AUInAppImage() {
local app_dir
local app_name_base
local app_icon
local use_default_icon_extension
local use_default_icon_path
local exec_options=""
local desktop_file_path # Get the base directory where all AppImages are stored
local appimage_base_dir=~/Applications # Check if the base directory for AppImages exists
if [[ ! -d "$appimage_base_dir" ]]; then
read -p "The directory $appimage_base_dir does not exist. Do you want to create it? (y/n): " create_dir
if [[ "$create_dir" == "y" || "$create_dir" == "Y" ]]; then
mkdir -p "$appimage_base_dir"
if [[ $? -ne 0 ]]; then
echo "Failed to create directory $appimage_base_dir."
return 1
fi
else
read -p "Enter the full path for the AppImage directory: " appimage_base_dir
if [[ ! -d "$appimage_base_dir" ]]; then
echo "The specified directory does not exist."
return 0
fi
fi
fi # Prompt the user for the AppImage file directory
read -p "Enter the AppImage file directory (relative to $appimage_base_dir): " app_dir # Create the directory if it does not exist
mkdir -p "$appimage_base_dir/$app_dir" # Validate if the AppImage directory was created successfully
if [[ ! -d "$appimage_base_dir/$app_dir" ]]; then
echo "Error: Failed to create AppImage directory."
return 1
fi # Prompt the user for the base application's name (without .AppImage)
read -p "Enter the base name of the application (do not include '.AppImage'): " app_name_base # Validate application base name
if [[ -z "$app_name_base" ]]; then
echo "Error: Application base name cannot be empty."
return 1
fi # Construct the full application name with .AppImage
local app_name="${app_name_base}.AppImage"
local app_exec="$appimage_base_dir/$app_dir/$app_name" # Check if the AppImage file exists and add execute permissions if necessary
if [[ -f "$app_exec" ]]; then
echo "AppImage file found. Adding execute permissions..."
chmod +x "$app_exec"
else
echo "Error: AppImage file does not exist."
return 1
fi # Determine if the user wants to use the default .png extension for the icon
read -p "Would you like to use the default .png extension for the icon? (y/n): " use_default_icon_extension
if [[ "$use_default_icon_extension" == "y" || "$use_default_icon_extension" == "Y" ]]; then
# Offer to use the default icon path
read -p "Would you like to use the default icon path ($appimage_base_dir/$app_dir/)? (y/n): " use_default_icon_path
if [[ "$use_default_icon_path" == "y" || "$use_default_icon_path" == "Y" ]]; then
# Use default icon path
app_icon="$appimage_base_dir/$app_dir/${app_name_base}.png"
else
# User wants to specify the icon path
read -p "Enter the full path of the application icon: " app_icon
fi
else
# Offer to use the default icon path without default extension
read -p "Would you like to use the default icon path ($appimage_base_dir/$app_dir/) without specifying the extension? (y/n): " use_default_icon_path
if [[ "$use_default_icon_path" == "y" || "$use_default_icon_path" == "Y" ]]; then
# Use default icon path without specifying the extension
app_icon="$appimage_base_dir/$app_dir/${app_name_base}"
else
# User wants to specify the icon path and extension
read -p "Enter the full path of the application icon: " app_icon
fi
fi # Validate icon path
if [[ ! -f "$app_icon" ]]; then
echo "Error: Icon file does not exist."
return 1
fi # Check if /usr/local/share/applications directory exists, create if not
local desktop_dir="/usr/local/share/applications"
if [[ ! -d "$desktop_dir" ]]; then
echo "Creating $desktop_dir directory..."
mkdir -p "$desktop_dir"
fi # Create the .desktop file path
desktop_file_path="$desktop_dir/${app_name_base}.desktop" # Check if .desktop file already exists
if [[ -e "$desktop_file_path" ]]; then
read -p "A .desktop file already exists. Do you want to replace it? (y/n): " replace_desktop
if [[ "$replace_desktop" != "y" && "$replace_desktop" != "Y" ]]; then
echo "Operation canceled. The .desktop file was not replaced."
return 0
fi
# Remove the existing .desktop file
rm "$desktop_file_path"
fi # Prompt for adding --no-sandbox option to Exec
read -p "Do you want to add --no-sandbox option to Exec? (y/n): " use_sandbox
if [[ "$use_sandbox" == "y" ]]; then
exec_options="--no-sandbox"
fi # Create the .desktop file
cat > "${app_name_base}.desktop" << EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=$app_name_base
Icon=$app_icon
Terminal=false
Exec="$app_exec" $exec_options
Categories=Utility;
EOF # Make the .desktop file executable
chmod +x "${app_name_base}.desktop" # Check if the user is root to determine if sudo is needed
if [[ $EUID -ne 0 ]]; then
echo "This action requires sudo privileges."
sudo mv "${app_name_base}.desktop" "$desktop_file_path"
if [[ $? -ne 0 ]]; then
echo "Failed to move .desktop file. Please check your permissions."
return 1
fi
else
mv "${app_name_base}.desktop" "$desktop_file_path"
fi # Inform the user of the created .desktop file
echo "The .desktop file has been created at: $desktop_file_path"
} # Call the function to initialize the AppImage for all users
AUInAppImage
AUUnAppImage.sh Used for uninit the AppImage#!/bin/bash # Function to uninstall an AppImage for all users
AUUnAppImage() {
local app_dir
local app_name_base
local app_exec
local desktop_file_path
local icon_file_path
local appimage_base_dir=~/Applications # Base directory where all AppImages are stored
local use_default_icon_path # Check if the base directory for AppImages exists
if [[ ! -d "$appimage_base_dir" ]]; then
echo "The directory $appimage_base_dir does not exist."
return 0
fi # Prompt the user for the AppImage file directory
read -p "Enter the AppImage file directory (relative to $appimage_base_dir or absolute path): " app_dir # Construct the full application name with .AppImage
read -p "Enter the base name of the application (including any non-default extension, do not include '.AppImage'): " app_name_base
local app_name="${app_name_base}.AppImage"
app_exec="$appimage_base_dir/$app_dir/$app_name" # Ask if the user wants to remove the AppImage file
read -p "Do you want to remove the AppImage file? [y/N]: " remove_appimage
if [[ "$remove_appimage" =~ ^[Yy]$ ]]; then
if [[ -f "$app_exec" ]]; then
echo "Removing AppImage: $app_exec"
rm "$app_exec"
if [[ $? -eq 0 ]]; then
echo "AppImage removed successfully."
else
echo "Failed to remove AppImage."
return 1
fi
else
echo "AppImage does not exist."
return 1
fi
fi # Determine if the user wants to use the default icon path
read -p "Would you like to use the default icon path ($appimage_base_dir/$app_dir/)? (y/n): " use_default_icon_path
if [[ "$use_default_icon_path" == "y" || "$use_default_icon_path" == "Y" ]]; then
app_icon="$appimage_base_dir/$app_dir/${app_name_base}.png"
else
read -p "Enter the full path of the application icon: " app_icon
fi # Ask if the user wants to remove the application icon
if [[ -f "$app_icon" ]]; then
read -p "Do you want to remove the application icon? [y/N]: " remove_icon
if [[ "$remove_icon" =~ ^[Yy]$ ]]; then
echo "Removing icon file: $app_icon"
rm "$app_icon"
if [[ $? -eq 0 ]]; then
echo "Icon file removed successfully."
else
echo "Failed to remove icon file."
fi
fi
else
echo "Icon file does not exist."
fi # Construct the .desktop file path
desktop_file_path="/usr/local/share/applications/${app_name_base}.desktop"
if [[ -f "$desktop_file_path" ]]; then
read -p "Do you want to remove the .desktop file? [y/N]: " remove_desktop
if [[ "$remove_desktop" =~ ^[Yy]$ ]]; then
echo "Removing .desktop file: $desktop_file_path"
if [[ $EUID -ne 0 ]]; then
echo "This action requires sudo privileges."
sudo rm "$desktop_file_path"
else
rm "$desktop_file_path"
fi
if [[ $? -eq 0 ]]; then
echo ".desktop file removed successfully."
else
echo "Failed to remove .desktop file."
fi
fi
fi # Ask if the user wants to remove the AppImage directory
read -p "Do you want to remove the AppImage directory ($app_dir)? [y/N]: " remove_app_dir
if [[ "$remove_app_dir" =~ ^[Yy]$ ]]; then
app_dir_path="$appimage_base_dir/$app_dir"
if [[ -d "$app_dir_path" ]]; then
echo "Removing AppImage directory: $app_dir_path"
rm -r "$app_dir_path"
if [[ $? -eq 0 ]]; then
echo "AppImage directory removed successfully."
else
echo "Failed to remove AppImage directory."
fi
else
echo "AppImage directory does not exist."
fi
fi echo "Uninstallation process completed."
} # Call the function to uninstall the AppImage for all users
AUUnAppImage
OK, it works, though it's just a simple example and may not be friendly enough for everyone to use, as I can only make sure it works for myself with some simple test.
Maybe, one day I'll try to write the AppImage manager based on them. I hope that I'll be in the mood for it.
How about install the rime(or Chinese Input Method by step 3 and step 4)
Why I use the rime
Now, I can't type any Chinese on my System. As I had used the rime in my Windows System, I chose to use the rime as my Input Method Engine.
It's free, open, with no advertisements, and does not collect your data in secret.
Just my own opinion, habit, and preference.
Note: Through the step 3 and the similar operation of step 4 that I mentioned below, it seems like that you can choose the suitable Chinese Input Method Engine for the Ubuntu 24.04 LTS. So, if you don't want to install the rime, just do step 3 and step 4(the operations of it are almost similar), then it will work.
Install the rime
Visit https://github.com/rime/home/wiki/RimeWithIBus and https://github.com/rime/home/wiki/RimeWithSchemata.
Rime 是跨平臺的輸入法軟件,Rime 輸入方案可通用於以下發行版:
- 【中州韻】 ibus-rime → Linux
- 【小狼毫】 Weasel → Windows
- 【鼠鬚管】 Squirrel → Mac OS X
So, for my System, I need to install the ibus-rime.
sudo apt-get install ibus-rimeInstall the different input schema (optional)
-
sudo apt-get install librime-data-double-pinyin -
sudo apt-get install librime-data-terra-pinyin librime-data-bopomofo
-
Settings->System->Region & Language->System->Manage Installed languages->Install/Remove Languages->Chinese(simplified)
Settings->Keyboard->Input Sources->Add Input Source->type Chinese, and choose
other option->add theChinese(Rime)Restart your system, you can use this command
sudo shutdown -r now
Then, you can use the rime.
Note: For step 3 and step 4, I have simplified some details like where are they, so, you might need to make it by STFW, if you meet some problems during the process. But I promise that it will not be a tricky task.
Edit the rime for your personal preference
Rime is just a frame of Input Method, so, it allows you to set many personal configurations.
It's a little bit complicated, just to do it step by step.
Though the official document has given information for our configuration, it's still not very friendly for a primary user of it(especially for the user on Linux).
I write this part to record how I edit the configuration for myself, and hope it will be helpful to others who want to use the Rime as their Input Method on Linux.
Just some basic settings.
To start it
Visit https://github.com/rime/home/wiki/RimeWithSchemata.
- SharedData:
/usr/share/rime-data/ (do not edit it manually) - UserData:
~/.config/ibus/rime (always edit this)
Note:
Do not edit the
*.yaml directly(When the Rime update, all the*.yaml will be overwritten, though you can choose not to update it).The recommended way to edit the schema is to create and edit
*.custom.yaml instead.Use the
patch to write the new settings or use the new value of the setting to replace the original one.Everytime you do any changes to the
*.yaml, you need to run ibus restart to deploy the Rime.
Change the Candidate words:
vim ~/.config/ibus/rime/default.custom.yamlWrite the content below.
patch:
"menu/page_size": 9
Then
ibus restart, works.
Note: The valid arrangement of it is [1,9], some release versions of the Rime can support 10 candidate words.
Vertical or horizontal:
vim ~/.config/ibus/rime/ibus_rime.custom.yamlWrite the content below.
patch:
"style/horizontal": true
Then
ibus restart, works.
Chinese(tradition) and Chinese(simplified):
- Type "ctrl+`"
- Select “朙月拼音.简化字”, it works.
How to use the grub
To start it
Well, I installed the Ubuntu first and installed the Windows secondly, now, I can't see the interface of the grub and don't know how to start the Windows.
In the past, I installed Windows first. After that, if you install the Ubuntu, it will offer you the option to install the Ubuntu for your Windows, as this process is automatically processed by the installer, I don't need to do anything manually. Except editing the grub file to allow me to select which system to start.
Now, as it may be a tricky task, just prepare yourself for it.
Start it with the grub file itself
Before any edit to the grub, we are supposed to know where are they and what the function of them at least.
Configuration file:
/etc/default/grubIf you change this file, run 'update-grub' afterwards to update
/boot/grub/grub.cfg.For full documentation of the options in this file, see:
info -f grub -n 'Simple configuration'Executable files' directory:
/etc/grub.dAll executable files in this directory are processed in shell expansion order.
00_*: Reserved for 00_header.
10_*: Native boot entries.
20_*: Third party apps (e.g. memtest86+).
The number namespace in-between is configurable by system installer and/or
administrator. For example, you can add an entry to boot another OS as
01_otheros, 11_otheros, etc, depending on the position you want it to occupy in
the menu; and then adjust the default setting via /etc/default/grub.Automatically generated file:
/boot/grub/grub.cfg(Do not edit it directly)It is automatically generated by grub-mkconfig using templates
from /etc/grub.d and settings from /etc/default/grub
Based on the illustration above, we should turn to know more about the configuration file first.
Know more about the Configuration file of the grub
info -f grub -n 'Simple configuration'
vim /etc/default/grubRead it but only focus on the information that you may need
Quote the value containing spaces or other special characters
GRUB_DEFAULT
- The default menu entry.
- value: number | the title of a menu entry | the special string 'saved'
GRUB_TIMEOUT
- Boot the default entry this many seconds after the menu is displayed unless a key is pressed.
-
0 : boot immediately without displaying the menu -
-1: wait indefinitely -
number not in {0,-1} : seconds the menu is displayed - Note: If the GRUB_TIMEOUT_STYLE is set to ‘countdown’ or ‘hidden’, the timeout is instead counted before the menu is displayed
GRUB_TIMEOUT_STYLE
Influence the behavior of the menu
{countdown, hidden} : Before displaying the menu, GRUB will wait for the timeout set by ‘GRUB_TIMEOUT’ to expire- If <ESC> or <F4> are pressed, or <SHIFT> is held down during that time, it will display the menu and wait for input.
- If a hotkey associated with a menu entry is pressed, it will boot the associated menu entry immediately.
- If the timeout expires before either of these happens, it will boot the default entry.
- In the ‘countdown’ case, it will show a one-line indication of the remaining time.
Analyse-it
- So, if you find that your
GRUB_TIMEOUT=0, you can't see the menu of grub, because it will boot the default entry immediately without displaying the menu. - If you can find that your
GRUB_TIMEOUT_STYLE=hidden, without typing the{<ESC>, <F4>, <SHIFT>}, you can't see the menu. - Besides, when the
GRUB_TIMEOUT_STYLE={countdown, hidden}, if your value of timeout is low, as GRUB will wait for the timeout before displaying the menu, you still can't see the menu while typing the key{<ESC>, <F4>, <SHIFT>}.
- So, if you find that your
Make the changes based on your requirements.
Don't forget to run sudo update-grub, after any changes to the /etc/default/grub.
Add the menu entry of my Windows to it
After the operations that we have done, we can see the grub menu now, but, we still can't find the menu entry of my Windows system.
Remeber the /etc/grub.d ?
For example, you can add an entry to boot another OS as
01_otheros, 11_otheros, etc, depending on the position you want it to occupy in
the menu; and then adjust the default setting via /etc/default/grub.
We need to add an entry to boot another OS, but how?
By STFW, I have tried the methods listed below.
os-prober (X) Not work for me
Visit https://cn.linux-console.net/?p=10556.
sudo os-prober/dev/nvme0n1p5:Windows 10:Windows:chain
sudo update-grubSourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.0-45-generic
Found initrd image: /boot/initrd.img-6.8.0-45-generic
Found linux image: /boot/vmlinuz-6.8.0-31-generic
Found initrd image: /boot/initrd.img-6.8.0-31-generic
Found memtest86+x64 image: /boot/memtest86+x64.bin
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
doneOK, check the
/etc/default/grubIf your computer has multiple operating systems installed, then you
probably want to run os-prober. However, if your computer is a host
for guest OSes installed via LVM or raw disk devices, running
os-prober can cause damage to those guest OSes as it mounts
filesystems to look for things.
#GRUB\_DISABLE\_OS\_PROBER\=falseJustice do I have the guest OSes? No.
GRUB_DISABLE_OS_PROBER=true thensudo update-grub- Host Machine: This is the physical computer that runs the hypervisor. It provides the underlying hardware resources for the virtual machines.
- Hypervisor: Also known as a virtual machine monitor (VMM), it is software that runs on the host machine's hardware and allows multiple operating systems to run on the host at the same time. The hypervisor presents hardware resources to the guest operating systems.
- Guest OS: This is the operating system installed within a virtual machine. It believes it is running directly on the hardware, but in reality, it is being managed by the hypervisor.
- Virtual Machine (VM) : A software implementation of a physical machine that runs an operating system. Each VM acts like a separate computer and can run its own operating system and applications.
Not work,
info -f grub -n 'Simple configuration'‘GRUB_DISABLE_OS_PROBER’
The ‘grub-mkconfig’ has a feature to use the external ‘os-prober’
program to discover other operating systems installed on the same
machine and generate appropriate menu entries for them. It is
disabled by default since automatic and silent execution of
‘os-prober’ , and creating boot entries based on that data, is a
potential attack vector. Set this option to ‘false’ to enable this
feature in the ‘grub-mkconfig’ command.OK, set
GRUB_DISABLE_OS_PROBER=false, still doesn't work at all, with the same error message above. Turn to the next method.
Boot-Repair tool (?) May work for me
Hmm, I don't wanna try this, for that I don't want to install too many unusual used software for my system, and I don't want to do the repetitive install and uninstall jobs, either.
But if you are interested in it, visit the https://help.ubuntu.com/community/Boot-Repair for detailed information.
info grub for help (X) Not work for me
Now, it's time for us to read the document of the grub to find the possible solution to the tricky task.
info grub and scan it for the information that we needTurn to "Booting"
How to boot different operating systems
Loading an operating system directly
Using kexec from userspace
Chainloading another bootloader
GRUB cannot boot DOS or Windows directly, so you must chain-load them.
For a Windows system on the first partition of the first hard disk:
menuentry "Windows" {
insmod chain
insmod ntfs
set root=(hd0,1)
chainloader +1
}
Turn to "Filesystem syntax and semantics"
device syntax:
(DEVICE[,PARTMAP-NAME1PART-NUM1[,PARTMAP-NAME2PART-NUM2[,...]]])- ‘[]’ means the parameter is optional.
- BIOS and EFI disks use either ‘fd’ or ‘hd’ followed by a digit, like ‘fd0’, or ‘cd’.
- AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
- Memdisk and host are limited to one disk so it's referred just by driver name.
- RAID (md), ofdisk (ieee1275 and nand), LVM (lvm), LDM, virtio (vdsk), and arcdisk (arc) use intrinsic name of disk prefixed by driver name.
- Hostdisk: [fhc]d[0-9]* or hostdisk/
- crypto and RAID (md): uuid/
- LVM: lvmid//
The syntax ‘(hd0)’ represents using the entire disk (or the MBR when installing GRUB), while the syntax ‘(hd0,1)’ represents using the first partition of the disk (or the boot sector of the partition when installing GRUB).
To start the grub command line to define the position of my Windows System
- Restart your system
- On the grub menu, type
c to get into the grub command line -
ls to see all the disks and their partitions -
ls one by one to define which one is my Windows System - I find it on my
(hd0,msdos5)
Another way is to use
sudo fdisk -l and observe the information to define it (It needs you to know clearly about step 3)Know the UUID of the Windows System
sudo blkid /dev/nvme0n1p5/dev/nvme0n1p5: BLOCK_SIZE="512" UUID="7EF6B725F6B6DD19" TYPE="ntfs" PARTUUID="10d919dd-05"
UUID: 7EF6B725F6B6DD19
Type: ntfs
sudo vim /etc/grub.d/11_otherosWrite the content below.
#!/bin/sh
menuentry "Windows 10" {
insmod ntfs
insmod chain
search --fs-uuid --no-floppy --set=root 7EF6B725F6B6DD19
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
}
sudo chmod +x 11_otheros
sudo update-grubDidn't work! Errors occur.
OK, I don't know how to handle it anymore.
Install the Windows first, then install the Ubuntu (y) work for me
Yes, I just chose the old workable way to solve it.
But maybe I can learn how to boot my Windows by learning the /etc/grub.d.
more 30_os-prober OK, I don't know what it's talking about.
sudo more /boot/grub/grub.cfg As I have installed the system again, it's no wonder why there are some differences from the past information.### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 8 (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id
_option 'osprober-chain-12B062A8B06291D1' {
insmod part_msdos
insmod ntfs
search --no-floppy --fs-uuid --set=root 12B062A8B06291D1
parttool ${root} hidden-
drivemap -s (hd0) ${root}
chainloader +1
}
### END /etc/grub.d/30_os-prober ###
Then explanation from the AI
menuentry 'Windows 8 (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id-
menuentry: Defines a boot menu entry. -
'Windows 8 (on /dev/nvme0n1p1)': This is the name displayed in the boot menu, indicating that this option is for booting Windows 8 from the partition located at/dev/nvme0n1p1. -
--class windows: A classification option that tags the menu item as a Windows system. -
--class os: Another classification option, indicating that this is an operating system. -
$menuentry_id: This is a variable typically used to provide a unique identifier for the menu entry.
-
_option 'osprober-chain-12B062A8B06291D1' {-
_option: Defines a configuration option block, often used to store configurations related to the boot entry. -
'osprober-chain-12B062A8B06291D1': This is the name of the options block, usually related toosprober (a tool for automatically detecting other operating systems).
-
insmod part_msdos-
insmod: Stands for "insert module," used to load modules for GRUB2. -
part_msdos: A module that is used to recognize MS-DOS partition tables.
-
insmod ntfs-
ntfs: Another module that provides support for the NTFS file system, which is commonly used by Windows operating systems.
-
search --no-floppy --fs-uuid --set=root 12B062A8B06291D1-
search: Used to search for bootable devices. -
--no-floppy: Tells GRUB not to search on floppy drives. -
--fs-uuid: Specifies to search for a device based on the file system UUID. -
--set=root: Sets the found device as the root device, which is used for subsequent booting processes. -
12B062A8B06291D1: The file system UUID.
-
parttool ${root} hidden--
parttool: A tool used to manipulate partitions. -
${root}: The root device variable set by the previoussearch command. -
hidden-: The exact purpose of this parameter is unclear; it might be used to hide a partition.
-
drivemap -s (hd0) ${root}-
drivemap: Used to map drives. -
-s (hd0): Specifies the source drive to map,(hd0) typically represents the first SCSI/IDE hard drive. -
${root}: Maps to the previously found root device.
-
chainloader +1-
chainloader: Used to load another boot loader. -
+1: Indicates that GRUB2 should load the boot loader from the next sector after the current location, which is usually the Windows boot sector.
-
Analyse-it
I need to boot a Windows System, so I need to use
--class windows to tag this menu entry as a Windows System.This menu entry will boot an OS, so
--class os is needed to tag it as an OS.I need to provide a unique identifier for the menu entry, so I use the
$menuentry_id.My hard disk use the format of MBR, so it's needed to use
insmod part_msdos.My Windows System use the NTFS file system, so I use the
insmod ntfs.I need to search the bootable devices, so I use the
search-
--no-floppy: not to search on floppy drives -
--fs-uuid: use file system UUID to search the bootable devices, we can usesudo blkid /where/os/is to get it. -
--set=root: Sets the found device as the root device
-
After searching the bootable devices......
parttool ${root} hidden-This line is intended to interact with the partition table of the device identified by
${root}. Here's a breakdown:-
parttool: This is a command in GRUB2 used for partition manipulation. It's typically used to perform operations on partitions that are not directly accessible due to BIOS or EFI constraints, or to handle certain types of partitions that GRUB2's standard commands can't interact with. -
${root} : This is a variable that represents the root device as determined by a previoussearch command. It's used to refer to the device or partition where the boot process should proceed. -
hidden- : This is indeed a bit ambiguous without more context. In GRUB2, theparttool command is used to mark a partition as hidden or to change its bootable flag. However, thehidden- option does not correspond to any standard GRUB2parttool operation. It's possible that this is a typo or a custom modification. The correct operation might behidden followed by a partition number to hide a specific partition, orbootable followed by a partition number to set its bootable flag.
-
drivemap -s (hd0) ${root}This line is used to map a drive for the purpose of the boot process:
-
drivemap: This command in GRUB2 is used to map a BIOS drive to a GRUB device. This mapping is necessary because GRUB uses its own naming scheme for drives that may not correspond to the BIOS's drive numbering. -
-s (hd0) : The-s option specifies the source drive for the mapping.(hd0) is a GRUB device reference that typically denotes the first hard disk drive detected by GRUB. The notation in parentheses is a legacy way of referring to drives and might be used for compatibility reasons. -
${root} : As mentioned before, this variable holds the device specification set by a previoussearch command. In the context ofdrivemap,${root} is used to define the target of the mapping, meaning that(hd0) in the BIOS is mapped to whatever device${root} refers to within GRUB.
-
OK,
info grub for more help.parttool: Make various modifications to partition table entries.
If GRUB “hides” a DOS (or Windows) partition (*note parttool:, DOS
(or Windows) will ignore the partition. If GRUB “unhides” a DOS (or
Windows) partition, DOS (or Windows) will detect the partition.Each COMMAND is either a boolean option, in which case it must be
followed with ‘+’ or ‘-’ (with no intervening space) to enable or
disable that option, or else it takes a value in the form
‘COMMAND=VALUE’.‘hidden’ (boolean)
When enabled, this hides the selected partition by setting the
“hidden” bit in its partition type code; when disabled,
unhides the selected partition by clearing this bit. This is
useful only when booting DOS or Windows and multiple primary
FAT partitions exist in one disk.- So,
parttool ${root} hidden- means disable the hidden option, making DOS (or Windows) will detect the partition${root}, the root device as determined by a previoussearch command.
drivemap:
Command: drivemap -l|-r|[-s] from_drive to_drive
Without options, map the drive FROM_DRIVE to the drive TO_DRIVE.
This is necessary when you chain-load some operating systems, such
as DOS, if such an OS resides at a non-first drive. For
convenience, any partition suffix on the drive is ignored, so you
can safely use ${root} as a drive specification.With the ‘-s’ option, perform the reverse mapping as well, swapping
the two drives. With the ‘-l’ option, list the current mappings. With the ‘-r’ option, reset all mappings to the default values.
drivemap -s (hd0) ${root}, means swap the(hd0) and${root}, now we can make sure that(hd0) in the BIOS is mapped to whatever device${root} refers to within GRUB.
chainloader +1: load the boot loader from the next sector after the current location, which is usually the Windows boot sector.
Let's make a conclusion
Write the name for the menu entry and classify it
menuentry 'Windows 8 (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id
_option 'osprober-chain-12B062A8B06291D1'
insmod the needed modules for GRUBinsmod part_msdos # My hard disk uses the MBR(Master Boot Record) partition
insmod ntfs # The filesystem of my Windows System
search the correct partition based on the UUID, and set the searched device as the root device, ignoring the floppy devices.search --no-floppy --fs-uuid --set=root 12B062A8B06291D1 # The UUID of my Windows System
parttool to make the DOS (or Windows) detect the partition${root}parttool ${root} hidden-
drivemap to make sure that(hd0) in the BIOS is mapped to whatever device${root} refers to within GRUB.drivemap -s (hd0) $
chainloader +1, loading the boot loader from the next sector after the current location, which is usually the Windows boot sector.chainloader +1
However, I still can't write the 21_Windows file in the /etc/grub.d, and for that, the grammar is not equal to the things that I analyzed above.
Maybe I will try it in the future, but not now.
Why the time of my Windows and Linux are different from each other, and the interval is always 8 hours?
You can visit https://wiki.archlinux.org/title/System_time or https://wiki.archlinuxcn.org/wiki/%E7%B3%BB%E7%BB%9F%E6%97%B6%E9%97%B4#Windows_%E7%B3%BB%E7%BB%9F%E4%BD%BF%E7%94%A8_UTC for the answer.
In an operating system, the time (clock) is determined by three parts:
- time value, whether it is local time or UTC or something else,
- time zone
- Daylight Saving Time (DST) if applicable.
Two clocks are present on systems: a hardware clock and a system clock.
Time standard
localtime
It is dependent on the current time zone
Windows use it.
Coordinated Universal Time(UTC)
It is the global time standard and is independent of time zone values
macOs use it.
Other UNIX and UNIX-like systems vary.
An OS that uses the UTC standard will generally consider the hardware clock as UTC and make an adjustment to it to set the OS time at boot according to the time zone.
What causes the difference?
Run
timedatectl on your terminalLocal time: Thu 2024-10-03 11:15:19 CST
Universal time: Thu 2024-10-03 03:15:19 UTC
RTC time: Thu 2024-10-03 03:15:19
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: noThen you may discover that the interval between Local time and Univarsal time is 8 hours, but Windows uses the localtime, why Linux can show time correctly while the windows will show the time 8 hours late?
If multiple operating systems are installed on a machine, they will all derive the current time from the same hardware clock.
Remember? An OS that uses the UTC standard will generally consider the hardware clock as UTC and make an adjustment to it to set the OS time at boot according to the time zone.
So, your Linux will consider the hardware clock as UTC and then make an adjustment to it to set the OS time at boot according to the time zone(like plus 8 hours). While your windows derive the current time from the same hardware clock, without the adjustment of the OS time according to the time zone, which causes the difference.
How to handle it?
Of course, we have to make a choice, let the Linux use the localtime or the Windows use the UTC.
Linux uses the localtime
timedatectl set-local-rtc 1Then, run
timedatectl, warning will occurWarning: The system is configured to read the RTC time in the local time zone.
This mode cannot be fully supported. It will create various problems
with time zone changes and daylight saving time adjustments. The RTC
time is never updated, it relies on external facilities to maintain it.
If at all possible, use RTC in UTC by calling
'timedatectl set-local-rtc 0'.If you don't want to do so, run
timedatectl set-local-rtc 0
Windows uses the UTC
Method1: Open
regedit and add aDWORD value with hexadecimal value1 to the registryHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversalMethod2: From an Administrator Command Prompt running
C:\>reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_DWORD /fMethod3: create a
*.reg file (on the desktop) with the following content and double-click it to import it into the registryWindows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
Should Windows ask to update the clock due to DST changes, let it. It will leave the clock in UTC as expected, only correcting the displayed time.
The #Hardware clock and #System clock time may need to be updated after setting this value.
If you are having issues with the offset of the time, try reinstalling tzdata and then setting your time zone again:
timedatectl set-timezone America/Los_Angeles
At last, I choose to let Windows use the UTC and use the Method2 that I mentioned above, and it works.
How to use the dictionary on Ubuntu
You know, using English to write is not easy, so I have to query the dictionary online again and again.
But, if I can't connect to the Internet, or I just want to do this whole on my own PC, what should I do?
I choose to use the GoldenDict, for some known reasons, we can't use some resources without the usage of scientific Internet. So, let's go straight to the topic.
A simple method to open your software without the use of a mouse
- Press
<Super(win)> - Type the name of the software(But it should be integrated to your desktop, in short, it should have the relative
.desktop file) - Use the left
<left> and<right> to choose the target software - Type
<Enter>, it will works.
Just to do it
At first, I managed to write a blog to introduce how to use the GoldenDict, but I'm glad to see that someone has done it very well.
So, I recommend you to visit the https://www.cnblogs.com/keatonlao/p/12702571.html.
Here, I will record how I follow it, step by step.
sudo apt install goldendict -y, install the goldendict.Download the dictionary from the link https://pan.baidu.com/s/1qlV-JB8VU1NkWz76na8nBQ?pwd=5mgk (I'm not happy that I can't connect with the http://download.huzheng.org/)
mv them to the location that you want them to be.Import the dictionaries by the step
Edit->Dictionaries->Sources->Files->Add...(the path to the directory of the dictionaries)->Recursive->Rescan now->Apply->OKGroup the dictionaries by the step
Edit->Dictionaries->Groups->Add group->set the shortcut->drag the dictionary to the relative group(or select the dictionary and press the>in the middle to add it to the group)->Apply->OKSelect the words that you want to query, and press the hotkey
<ctrl>+<c>+<c> to make it. (You can edit the hotkeys by the stepEdit->Preferences->Hotkeys->edit the "Use the following hotkey to translate a word from clipboard")We can use the wildcard to make the Fuzzy matching
As there is a lack of the query on our local dictionary, we can add the online dictionary for it
Follow this step
Edit->Dictionaries->Sources->Websites->Add the link that you want to->Enable the specific link->Group->Add the online dictionary to the group# 欧路-英汉(En-中)
https://dict.eudic.net/dicts/en/%GDWORD% # 有道词典 / 词典-英汉汉英(En-中中-En)
https://dict.youdao.com/result?word=%GDWORD%&lang=en # Collins Online Dictionary-英英(En-En)
https://www.collinsdictionary.com/dictionary/english/%GDWORD% # Longman Dictionary-英英(En-En)
https://www.ldoceonline.com/dictionary/%GDWORD% # Cambridge Dictionary-英英(En-En)
https://dictionary.cambridge.org/dictionary/english/%GDWORD% # Cambridge Dictionary-英汉(En-中)
https://dictionary.cambridge.org/dictionary/english-chinese-simplified/%GDWORD% # Vocabulary-英英(En-En)
https://www.vocabulary.com/dictionary/%GDWORD% # merriam-webster-英英(En-En)
https://www.merriam-webster.com/dictionary/%GDWORD% # merriam-webster-thesaurus-英英(En-En)
https://www.merriam-webster.com/thesaurus/%GDWORD% # 汉典-汉语(Chinese)
https://www.zdic.net/hans/%GDWORD%
We can also add the search engine to it with the same step
# Bing 中国:
http://cn.bing.com/search?q=%GDWORD% # Bing 美国:
http://www.bing.com/search?q=%GDWORD% # 搜狗
http://www.sogou.com/web?query=%GDWORD% # 百度搜索
http://www.baidu.com/s?wd=%GDWORD% # Google
https://google.com/search?q=%GDWORD%
It's just the basic configuration of the goldendic, which is enough for me to use.
How to play the music on Ubuntu
As I haven't learned the usage of the docker, maybe the best choice for me is the cmus.
If possible, maybe when I can use the docker, I'll update this part and introduce more music players for everyone.
But now, let's focus on the cmus.
You can also visit the relative blogs at the References part of this article.
Recommand to visit https://man.archlinux.org/man/cmus-tutorial.7 and https://www.cnblogs.com/brt2/p/13258775.html.
Install it and know about it
sudo apt install cmus, then you can install it.
cmus --help but does not help me very much.
man cmus, read the documents, so you will know how to use it- Considering the Cognitive processes of people, I'll not introduce it directly.
Note: I'll only introduce the part that I am interested in, if you want more detalis, explore it by yourself.
Start to use it and know how to use it
Type and run
cmus, then you can see it.You can see that we have no music on the library view, so we press
<5> to switch to the Browser view where we can add the music from the filesystem to the library.You can use
<j> and<k> or<up> and<down> to highlight a file or folder.- You can press
<Enter> to navigate into the highlighted folder and press<Backspace> to back to the parent directory. - You can press
<g> to go the top of the
- You can press
You can press
<a> to copy tracks to the library.When you press a cmus will move you to the next line down (so that it is easy to add a bunch of files/folders in a row) and start adding the file/folder you pressed a on to your library. This can take a while if you added a folder with a lot in it.
Note: cmus does not move, duplicate, or change your files. It just remembers where they are and caches the metadata (duration, artist, etc.)
Then you want to play it, so you press
<1>(Library view) or<2>(sorted Library view).Library view (1)
Displays all tracks in the library. Tracks are sorted and displayed in a tree grouped by artist/album. Artist sorting is done alphabetically. Albums are sorted by year.Sorted library view (2)
Displays the same content as view 1, but as a simple list automatically sorted by user criteria.
Also, You can use
<j> and<k> or<up> and<down> to highlight the single music file, just press<Enter>, and then the highlighted music will be played.About play
- You can press
<c> to pause/unpause. - Press
<left> |<j> or<right> |<k> to seek by 10 seconds. - Press
< or> to seek by 1 minute - Press
<z> to play the previous track, and<b> to play the next track - Press
<v> to stop playback
- You can press
Then you may want to play the music
- Press
<r> -> Repeat - Press
<s> -> Shuffle - Press
<f> -> Follow - Press
<shift>+<c> -> Continue
- Press
When you are on View 2, you may want to play music {all from library, artist from library, album from library}, you can press
<m> to cycle through the different options for this setting.Now you are listening to a song, you want to see the queue of the songs to know what will be played next, so you press
<4> to switch to the Play Queue view. But before that, you should go to the song that you want to hear next, and press<e> to add it to the queue, or you can see nothing in the Play Queue view. (Note: The queue will not be affected by the Shuffle)You may want to add songs to the playlists, so you can play the playlists instead of playing all the songs in the library. So you press
<3> to switch to the Playlist view.But how to add the songs to the playlist? Press
<2> and press<y> to add the highlighted song to the marked playlist(highlighted). Press<3>, and you can see the added songs in the highlighted playlist.If you want to play the music in the playlist without interrupting the currently playing song, you can press
<shift>+<m>.If you want to remove the songs from the library or the songs from the playlist or the playlist (because you can't play this music or you just don't like it), you can press the
<D> or<delete> to make it.Specially, if you want to delete the songs in the playlist, you should press
<Tab> to switch to the right column, after the operations, you can press<Tab> again to go back to the left column.If you want to change the order of the tracks
- Pressing
p moves marked tracks to the position immediately after the selected track. -
P moves them to the position immediately before the selected track.
- Pressing
Sometimes, we just want to search for the specific song to play, so, you press
<2>, then press/, and type a word or two from the track you're looking for.Press
<Enter> to get the keyboard out of the search command, or<n> to find the next match.Now we know about Views 1-5 and their basic usage, but how about 6 and 7?
Filters view (6)
Lists user-defined filters. Settings view (7)
Lists keybindings, unbound commands and options. Remove bindings
with D or del, change bindings and variables with enter, and
toggle variables with space.
Now, you feel tired and want to sleep, so you press
:q to quit the cmus.You can do all the work above by the command line,
man cmus for more details.
Write a .desktop for cmus
Though you can just simply type the cmus on your terminal to start it, I just to prefer regarding it as the application that I used to use, which makes me write a .desktop for it.
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=cmus
Icon=/home/lbc/Applications/cmus/cmus.png
Terminal=true
Exec="cmus"
Categories=Music;
How to code on Ubuntu
When you generally apply the Ubuntu as a part of your daily life, you may turn to code on it.
As I have made the essential environment on Windows System, now, it's time for me to do it on Linux!
Note:
- I'll use the Visual Studio Code, if it does not need me to use another editor.
C/C++
You can visit the https://code.visualstudio.com/docs/cpp/config-linux.
Run
sudo apt-get update, and update the Ubuntu package lists.Run
sudo apt-get install build-essential gdb, install the GNU compiler tools and the GDB debuggerType
gcc -v, you can see it has been installed.Run
code (if you have downloaded it, you can download the.dep from the official website or just simply through the App Center)Install the C/C++ Extension Pack.
Input the content below:
#include<iostream> int main()
{
std::cout<<"hello world!"<<std::endl;
return 0;
}
Choose the "C/C++: g++ build and debug active file" or "C/C++: g++-13 build and debug active file".
Run it, and it will work.
Python
It's not the first time for me to create the environment for Python, but only on Windows.
Before I do that on Linux, I turn to solve the questions that have confused me for a period.
Why do we need the virtual environment for Python?
What are the differences between miniconda, anaconda, and virtualenv?
Why do we need the virtual environment for Python?
Borrow the explanation from virtualenv.
The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version
1 ofLibFoo, but another application requires version2. How can you use both these libraries? If you install everything into your host python (e.g.python3.8) it’s easy to end up in a situation where two packages have conflicting requirements.Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application. Also, what if you can’t install packages into the global
site-packages directory, due to not having permissions to change the host python environment?
So, there are four reasons for us to use the virtual environment:
- Dependency Isolation: Prevents conflicts by allowing each project to have its own set of libraries. It allows for package installation without altering the global Python environment.
- Version Management: Ensures that applications work consistently by locking down library versions.
- Permissions: Enables package management without needing system-wide installation rights.
- Reproducibility and Portability: Makes it easy to share and replicate the development environment across different systems.
A simple explanation of the differences between miniconda, anaconda, and virtualenv
virtualenv
virtualenv is a tool to create isolated Python environments.It creates an environment that has its own installation directories, that doesn’t share libraries with other virtualenv environments (and optionally doesn’t access the globally installed libraries either).
- It is more lightweight compared to Anaconda and is suitable for general Python development.
Anaconda
Register to get everything you need to get started on your workstation including Cloud Notebooks, Navigator, AI Assistant, Learning and more.
- Easily search and install thousands of data science, machine learning, and AI packages
- Manage packages and environments from a desktop application or work from the command line
- Deploy across hardware and software platforms
- Distribution installation on Windows, MacOS, or Linux
Miniconda
Miniconda is a free minimal installer for conda. It is a small bootstrap version of Anaconda that includes only conda, Python, the packages they both depend on, and a small number of other useful packages (like pip, zlib, and a few others).
So, you can simply conduct it like this
- virtualenv provides the basic functions of the virtual environment, and it is very light but without Python.
- Anaconda not only provides the functions of the virtual environment, but also the easy management of packages and environment, default abundant packages for data science, machine learning, AI, and other programs.
- Miniconda is a small bootstrap version of Anaconda, lighter than Anaconda, allowing you to install all the needed packages based on your own needs.
Based on my own needs, I'll choose the Miniconda.
How to install the Miniconda on Linux
Visit the https://docs.anaconda.com/miniconda/.
I choose the
Miniconda3 Linux 64-bit to install it. (I am not familiar with the other option)Open the terminal,
chmod +x Miniconda3-latest-Linux-x86_64.sh (You know where the downloaded files are)
./Miniconda3-latest-Linux-x86_64.shFollow the guide of the
.shYou can change the install location of the miniconda
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
You can choose not to automatically initialize conda or yes
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,
run the following command when conda is activated:conda config --set auto_activate_base false
You can undo this by running
conda init --reverse $SHELL? [yes|no]
[no] >>>
Finish the installation of the Miniconda.
I choose all the default options.
Also, you can install it only by the usage of the command line.
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh
To start using it in the vscode
Visit the https://code.visualstudio.com/docs/python/python-quick-start.
Open the vscode, you can do it just by running
code on your terminalInstall the python extension
Use
Ctrl+shift+p, type thePython: Create Environment, and select the conda environment (you can also just click the button at the lower right corner, like3.12.3 64-bit to switch your environment)Choose a folder as your workspace
Create a file named
hello.py, and input the content belowinput("hello world!")
Run it, and it works.
How to install packages for the virtual environment and how to manage them
Type
conda init in the terminal of your vscode(if it does not works, relaunch your terminal)Close and re-open your current shell (I just added a new terminal on my vscode)
Now, I wanna create four virtual environments, the first one is named "MathMode" that used for the race of Mathematical Modeling,the second one is named "DigitalImage" that used for the digital image process, the third one is named "DataDig" that used for data dig, and the last one is named "AIMode" that used for constructing the mode of AI.
How? Visit the https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html for more details.
Create the conda environment
conda create --no-default-packages -n MathMode python=3.10 numpy pandas scipy matplotlib scikit-learn
conda create --no-default-packages -n DigitalImage python=3.10 numpy scipy Pillow scikit-image matplotlib
conda create --no-default-packages -n DataDig python=3.10 numpy pandas scipy matplotlib scikit-learn scrapy matplotlib
conda create --no-default-packages -n AIMode python=3.10 numpy pandas scipy matplotlib scikit-learn sympy
If you want to install the PyTorch or opencv for your conda environment, you need to make it a little differently.
PyTorch
Visit the https://pytorch.org/get-started/locally/
What's the Compute Platform?
You may see CUDA 11.8, CUDA 12.1, CUDA12.4, ROCm6.1, and CPU, so, what's the meaning of them?
- The number means the version, so there is no need to explain it.
- CUDA: CUDA is a general parallel computing architecture and programming model developed by NVIDIA for its graphics cards (GPUs).
- ROCm: ROCm is an open-source software platform optimized to extract HPC and AI workload performance from AMD Instinct accelerators and AMD Radeon GPUs while maintaining compatibility with industry software frameworks.
- CPU: No need to explain it.
My computer uses NVIDIA, so, now I need to check the version of my CUDA
-
sudo apt install nvidia-cuda-toolkit -
nvidia-smi - Oh, the version is 12.2, so, I choose to install the CUDA 12.1.
-
conda install --name MathMode pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
conda install --name AIMode pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidiaCreate the
helloPyTorch.py and input the content belowimport torch # Check if CUDA is available
cuda_available = torch.cuda.is_available() # Get the version of CUDA used by PyTorch
cuda_version = torch.version.cuda # Print the PyTorch version
print("PyTorch version:", torch.__version__) # Print the CUDA version used by PyTorch
if cuda_available:
print("CUDA version used by PyTorch:", cuda_version)
else:
print("CUDA is not available. PyTorch is running on CPU.") # Get the CUDA version installed on the system
if cuda_available:
try:
# Running the command to get the CUDA version from the system
import subprocess
subprocess.run(["nvcc", "--version"], check=True, stdout=subprocess.PIPE)
print("CUDA is available and PyTorch is using it.")
except subprocess.CalledProcessError:
print("CUDA is not properly installed or configured on your system.") # Simple usage of torch
# Create a tensor
x_data = [[1, 2], [3, 4]]
x_tensor = torch.tensor(x_data, dtype=torch.float) # Print the tensor
print("Tensor x:", x_tensor) # Perform a simple operation, e.g., matrix multiplication
y_tensor = torch.tensor([[2, 0], [0, 2]], dtype=torch.float)
z_tensor = torch.mm(x_tensor, y_tensor) # Print the result of the operation
print("Result of matrix multiplication:")
print(z_tensor) # Verify CUDA usage
if cuda_available:
# Move tensors to GPU
x_tensor = x_tensor.cuda()
y_tensor = y_tensor.cuda() # Perform the operation on GPU
z_tensor_gpu = torch.mm(x_tensor, y_tensor) # Print the result of the GPU operation
print("Result of matrix multiplication on GPU:")
print(z_tensor_gpu)
If you can see the result of the output has been shown below, it works
PyTorch version: 2.4.1
CUDA version used by PyTorch: 12.1
CUDA is available and PyTorch is using it.
Tensor x: tensor([[1., 2.],
[3., 4.]])
Result of matrix multiplication:
tensor([[2., 4.],
[6., 8.]])
Result of matrix multiplication on GPU:
tensor([[2., 4.],
[6., 8.]], device='cuda:0')
opencv
Visit the https://opencv.org/
conda install -n DigitalImage -c conda-forge opencvCreate the
helloOpenCV and input the content belowfrom skimage import data
import cv2 # Load the coffee image from skimage's dataset
coffee_image = data.coffee() # Convert the image to the format required by OpenCV
# skimage images are typically loaded as float64 with values in [0, 1],
# while OpenCV works with uint8 in the range [0, 255].
coffee_image_opencv = (coffee_image * 255).astype('uint8') # Display the image using OpenCV
cv2.imshow('Coffee Image', coffee_image_opencv) # Wait for a key press and then close all windows
cv2.waitKey(0)
cv2.destroyAllWindows()
If you can see the processed image of the coffee, it works.
Type
conda env list, you can see all of them.Visit https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html#installing-packages for more details.
References
apt
- 清华大学开源软件镜像站: https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
AppImage
- Using AppImage in Linux [Complete Guide]: https://itsfoss.com/use-appimage-linux/
- Docs of AppImage: https://docs.appimage.org/introduction/index.html
- Obsidian AppImage - The SUID sandbox helper binary was found, but is not configured correctly: https://askubuntu.com/questions/1512287/obsidian-appimage-the-suid-sandbox-helper-binary-was-found-but-is-not-configu
- FUSE: https://github.com/AppImage/AppImageKit/wiki/FUSE
- 如何在 Linux 中使用 AppImage [完整指南]: https://www.cnblogs.com/pipci/p/16109756.html
rime
- RimeWithIBus: https://github.com/rime/home/wiki/RimeWithIBus
- plum: https://github.com/rime/plum
- UserGuide: https://github.com/rime/home/wiki/UserGuide
- CustomizationGuide: https://github.com/rime/home/wiki/CustomizationGuide
- RimeWithSchemata: https://github.com/rime/home/wiki/RimeWithSchemata
- Rime: https://rime.im/
- Rime_description.md: https://github.com/LEOYoon-Tsaw/Rime_collections/blob/master/Rime_description.md
Grub
How to add Windows 10 to grub boot loader: https://superuser.com/questions/1392316/how-to-add-windows-10-to-grub-boot-loader
Add Windows 10 to GRUB OS list: https://askubuntu.com/questions/661947/add-windows-10-to-grub-os-list/661954#661954
Boot-Repair: https://help.ubuntu.com/community/Boot-Repair
Offical docs of grub: https://www.gnu.org/software/grub/manual/grub/grub.html
Red Hat document:
English:
Grub:
MBR vs GPT: What's the Difference Between an MBR Partition and a GPT Partition? [Solved]: https://www.freecodecamp.org/news/mbr-vs-gpt-whats-the-difference-between-an-mbr-partition-and-a-gpt-partition-solved/
怎样修复grub开机引导(grub rescue): https://www.cnblogs.com/jins-note/p/9513335.html
将 Windows 添加到 GRUB 启动菜单: https://cn.linux-console.net/?p=10556
使用GRUB 添加新的启动项 (menu entry): https://www.cnblogs.com/longwaytogo/p/5679583.html
Time difference between Linux and Windows
- System time: https://wiki.archlinux.org/title/System_time
- 系统时间: https://wiki.archlinuxcn.org/wiki/%E7%B3%BB%E7%BB%9F%E6%97%B6%E9%97%B4#Windows_%E7%B3%BB%E7%BB%9F%E4%BD%BF%E7%94%A8_UTC
Dictionary
- 安装使用 GoldenDict 查词神器 (Windows/Mac/Linux): https://www.cnblogs.com/keatonlao/p/12702571.html
- goldendict: http://www.goldendict.org/
- 宇宙最全在线词典网站导航:https://github.com/Dictionaryphile/All_Dictionaries
- GoldenDict++OCR「划词翻译」: https://github.com/nonwill/GoldenDict-OCR
Music
cmus-C* Music Player tutorial: https://man.archlinux.org/man/cmus-tutorial.7
cmus doc: https://github.com/cmus/cmus/blob/master/Doc/cmus.txt
How to listen to music from the console using the cmus player on Linux: https://linuxconfig.org/how-to-listen-to-music-from-the-console-using-the-cmus-player-on-linux
如何在 Linux 上使用 cmus 播放器从控制台听音乐: https://cn.linux-console.net/?p=10731
cmus:Linux 终端爱好者的终极音乐播放器: https://cn.linux-console.net/?p=19018
Linux终端音乐播放器: cmus: https://www.cnblogs.com/brt2/p/13258775.html
Code
C/C++
- Visual Studio Code Docs: https://code.visualstudio.com/docs
- GCC, the GNU Compiler Collection: https://gcc.gnu.org/
Python
virtualenv: https://virtualenv.pypa.io/en/latest/
Miniconda: https://docs.anaconda.com/miniconda/
Anaconda: https://www.anaconda.com/download
Offical website of python: https://www.python.org/
Pytorch: https://pytorch.org/index.html
CUDA: https://developer.nvidia.com/cuda-toolkit
- How to Check CUDA Version Easily: https://varhowto.com/check-cuda-version/
- Upgrade the current version of CUDA: https://forums.developer.nvidia.com/t/upgrade-the-current-version-of-cuda/154814/1
- NVIDIA CUDA Installation Guide for Linux: https://docs.nvidia.com/cuda/archive/10.2/cuda-installation-guide-linux/index.html
- How to Install CUDA Toolkit on Ubuntu 24.04, 22.04 or 20.04: https://linuxcapable.com/how-to-install-cuda-on-ubuntu-linux/#:~:text=To%20do%20this%2C%20run%20the%20following%20command%3A%20sudo,configured%20repositories%2C%20including%20the%20newly%20added%20NVIDIA%20repository.
pytorch安装: cuda、cudatoolkit、torch版本对照: https://www.cnblogs.com/jacexu016/p/18409959
Installing previous versions of PyTorch: https://pytorch.org/get-started/previous-versions/
opencv: https://opencv.org/
- About opencv: https://opencv.org/about/
- How to Install OpenCV with Anaconda: A Comprehensive Guide: https://www.opencvhelp.org/tutorials/introduction/how-to-install-open-cv-anaconda/
How to use the Ubuntu的更多相关文章
- 关于ubuntu实机与虚机互相copy
我的开发环境是在ubuntu上的,但是ubuntu上没有官方支持的QQ,有些不太方便,所以在上面虚了一个Win7(先是win10,但是win10最新版本太坑了,不说了),不过经常会出现复制文件,或者文 ...
- 在Ubuntu下搭建ASP.NET 5开发环境
在Ubuntu下搭建ASP.NET 5开发环境 0x00 写在前面的废话 年底这段时间实在太忙了,各种事情都凑在这个时候,没时间去学习自己感兴趣的东西,所以博客也好就没写了.最近工作上有个小功能要做成 ...
- Ubuntu 14.04中Elasticsearch集群配置
Ubuntu 14.04中Elasticsearch集群配置 前言:本文可用于elasticsearch集群搭建参考.细分为elasticsearch.yml配置和系统配置 达到的目的:各台机器配置成 ...
- 在Ubuntu 16.10 安装 git 并上传代码至 git.oschina.net
1. 注册一个账号和创建项目 先在git.oschina.net上注册一个账号和新建一个project ,如project name 是"myTest". 2.安装git sudo ...
- 在Ubuntu 16.10安装mysql workbench报未安装软件包 libpng12-0错误
1.安装mysql workbench,提示未安装软件包 libpng12-0 下载了MySQL Workbench 6.3.8 在安装的时候报错: -1ubu1604-amd64.deb 提示: ...
- Ubuntu 16.10 安装KolourPaint 4画图工具
KolourPaint 4画图工具简单实用,可以绘画.视频处理和图标编辑: • 绘画:绘制图表和“手绘” • 视频处理:编辑截图和照片;应用特效 • 图标编辑:绘画剪贴和标识透明化 1.在Ubuntu ...
- 使用ubuntu作为web开发环境的一些感受
从ms-dos,win95,win98,winMe,winXp,vista,win7,win10我都有使用的经历,我使用时间最长的应属winxp,其次是win7,说实话,我觉得这两个系统是微软做的最好 ...
- ubuntu系统下如何修改host
Ubuntu系统的Hosts只需修改/etc/hosts文件,在目录中还有一个hosts.conf文件,刚开始还以为只需要修改这个就可以了,结果发现是需要修改hosts.修改完之后要重启网络.具体过程 ...
- Mac OS、Ubuntu 安装及使用 Consul
Consul 概念(摘录): Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分布式服务注册与发现的方案,比如 Airbnb 的 SmartStac ...
- 使用SecureCRT连接虚拟机(ubuntu)配置记录
这种配置方法,可以非常方便的操作虚拟机里的Linux系统,且让VMware在后台运行,因为有时候我直接在虚拟机里操作会稍微卡顿,或者切换速度不理想,使用该方法亲测本机效果确实ok,特此记录. Secu ...
随机推荐
- jQuery ajax - serializeArray() 方法 实例表单提交
serializeArray()在ajax表单提交时候非常方便获取元素 定义和用法 serializeArray() 方法通过序列化表单值来创建对象数组(名称和值). 您可以选择一个或多个表单元素(比 ...
- .NET 在 Visual Studio 中的高效编程技巧集
前言 本文大姚将为你介绍一些Visual Studio的使用技巧和建议,旨在帮助.NET开发者更加高效地利用Visual Studio进行编程工作.无论你是.NET初学者还是经验丰富的.NET开发者, ...
- Qt音视频开发48-通用通道管理
一.前言 把通用的视频控件搞定以后,后期增加新的内核方便多了,不需要在好多个文件复制粘贴之类的,接下来就是需要一个统一的类来管理视频监控系统中的16个通道或者32个通道,甚至64个通道也有可能,当然, ...
- 导出 wireshark 网络包二进制数据的三种方法
Wireshark 是一款很好用的 UI 抓包工具,在 Windows.macOS 上都可以使用.最近开发的一个统计日志上报功能,发送的网络请求明明可以收到 server 正确的响应,但却捞取不到相关 ...
- 安装Visual Studio2015后找不到C++项目模板解决办法
安装Visual Studio2015后找不到C++项目模板解决办法: 方法1:您可以通过修改Visual Studio来完成此操作,并且可以使用以下步骤完成此操作:1.转到"添加或删除程序 ...
- 不为人知的网络编程(十一):从底层入手,深度分析TCP连接耗时的秘密
本文作者张彦飞,原题"聊聊TCP连接耗时的那些事儿",有少许改动. 1.引言 对于基于互联网的通信应用(比如IM聊天.推送系统),数据传递时使用TCP协议相对较多.这是因为在TCP ...
- Playwright自动化登录JD
import base64 import random import re import time from playwright.sync_api import sync_playwright im ...
- jQuery---操作指南
功能代码(1)---通过Jquery来处理复选框 实现以下功能: 1:选中第一个复选框,那么下面所有的复选框都选中,去除选中第一个复选框,下面的都不选中 2:当点击全选按钮,上面足球.篮球.游泳.唱歌 ...
- C# Caching---Cache 缓存
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 usin ...
- Bottleup pg walkthrough Intermediate
一开始看到page=view/.html的时候就想到目录穿越了尝试../../../../../../../../../../../etc/passwd 发现不行 找半天其他可能存在漏洞的地方又找不到 ...