Linux Basic Experience

Basic Linux experience, including commonly used file upload and extraction commands.
Network Environment
Applicable to shell commands on Linux Ubuntu.
Unable to Resolve IPv6 DNS
1. Disable systemd-resolved and Fix resolv.conf
# Stop and disable systemd-resolved
systemctl stop systemd-resolved
systemctl disable systemd-resolved
systemctl mask systemd-resolved # Prevent it from being started by other services
# Remove the original resolv.conf symlink
rm /etc/resolv.conf
# Create a new resolv.conf (managed by systemd-networkd)
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
2. Edit the Netplan Configuration File
vim /etc/netplan/50-cloud-init.yaml
Modify it as follows:
network:
version: 2
renderer: networkd
ethernets:
eth0:
optional: true
dhcp4: true
dhcp6: true # Enable IPv6 DHCP
3. Apply Configuration and Restart Services
netplan apply
# Restart the network service
systemctl restart systemd-networkd
4. Test IPv6 DNS
ping6 ipv6.google.com
# or
dig AAAA ipv6.google.com +short
Speed Up External Network Access for the System
If downloading software is slow and you happen to have a suitable network environment, you can use a
proxyto speed up downloads. For example:
export https_proxy=http://10.0.0.50:7890 http_proxy=http://10.0.0.50:7890 all_proxy=socks5://10.0.0.50:7890
Speed Up apt Updates and Installations
If apt get installations are too slow, you can set a proxy specifically for apt get (this only affects apt).
Edit the apt configuration vim /etc/apt/apt.conf.d/90curtin-aptproxy
Acquire::http::Proxy "http://10.0.0.50:7890";
Acquire::https::Proxy "http://10.0.0.50:7890";
Uploading Files with SCP
Upload a Single File
Basic syntax:
scp [local file path] [username]@[remote host IP]:[destination path]
Example:
scp /home/user/test.txt root@192.168.1.100:/www/
Common parameters:
-P [port]: Specify the SSH port (can be omitted if default port 22 is used)
-r: Recursively copy entire directories (used for uploading directories)
-v: Display detailed transfer information
Upload an Entire Directory
Basic syntax:
scp -r [local directory path] [username]@[remote host IP]:[destination path]
Example:
scp -r /home/user/project root@192.168.1.100:/opt/
Important Notes
-
Ensure the SSH service is running on the remote server.
-
You need write permissions for the destination path.
-
The first connection will prompt you to confirm the host key.
-
For large file transfers, using the
-Cparameter to enable compression is recommended.
Graphical SCP Upload Tool - FileZilla
You can use the free FileZilla Client.
Download link:
https://filezilla-project.org/download.php
Extracting Files
Extracting tar.gz
How to extract tar.gz files.
- Extract using the command line (Linux/macOS)
tar -xzvf filename.tar.gz
Parameter Explanation:
-
-x: Extract
-
-z: Use gzip decompression
-
-v: Show extraction process (optional)
-
-f: Specify the filename
- Extract to a specific directory
tar -xzvf filename.tar.gz -C target_directory
Common Issues
-
Error during extraction: Ensure you have sufficient disk space and file permissions.
-
Garbled filenames: Try specifying the encoding, e.g., --use-compress-program='gzip -n'
-
Partial extraction: You can use the --wildcards parameter to extract specific files.
Merging Split Files
Applicable for merging split files like the RV1126 SDK (e.g., .gz00 to .gz05 format split archives).
For example: RV1126 SDK split files like the following multiple parts
rv1126-repo-v20230717-dev.tar.gz00
...
rv1126-repo-v20230717-dev.tar.gz05
-
Ensure all split files are in the same directory.
-
Open the terminal/command line and execute the merge command:
cat rv1126-repo-v20230717-dev.tar.gz* > rv1126-repo-v20230717-dev.tar.gz
Important Notes:
-
You must use the
catcommand. -
The split files must be in sequential order (e.g., from 00 to 05 with no missing parts).
-
Ensure sufficient disk space for the merged complete file.
-
The merged file needs to be extracted again (merging simply concatenates the parts into a complete archive).
-
When operating in a Linux environment, pay attention to file permissions.
Additional Notes:
-
The size of the merged file should be the sum of all split parts.
-
If the merge fails, check:
-
If all split files are complete.
-
If the filenames match exactly.
-
If there is enough storage space.
