yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
DOFBOT-Ultra📖
1. Get Started Quickly
  • 0.Unboxing Video
  • 1. Get Started Quickly
  • 2. Access the Terminal
  • 3. Calibration offset(Depth Camera)
  • 4. Calibration offset(USB Camera)
2. Assembly Course
  • 1. Installation Steps
  • 2. Calibrate the Robotic Arm
  • 3. Install the Map
3. Remote Control Course
  • 1. Mobile Phone Control
  • 2. USB Handle Control
  • 3. PC Web Page Programming
4. Preparation
  • 1. Manage Web control services
  • 2. Manage JupyterLab services
  • 3. Manage OLED services
5. 2D Visual Tracking Course
  • 1. Color block positioning
  • 2. Color block tracking
  • 3. Face positioning
  • 4. Face tracking
  • 5. Label code positioning
  • 6. Label code tracking
6. 2D Visual Grasping Course
  • 1. Identify grab color block
  • 2. Catch game
  • 3. Color sorting
  • 4. Color stacking
  • 5. Label code sorting
  • 6. Label code stacking
  • 7. Gesture grasping color blocks
  • 8. Gesture stacking color blocks
  • 9. Single garbage sorting
  • 10. Garbage sorting
  • 11. Tracking game
7. 2D Mediapipe Course
  • 1. Hand detection
  • 2. Posture detection
  • 3. Overall detection
  • 4. Facial Detection
  • 5. Face Detection
  • 6. Face effects
  • 7. 3D Object Recognition
  • 8. Paintbrush
  • 9. Finger control
  • 10. Gesture Recognition
  • 11. Gesture control robotic arm action group
  • 12. Arm posture control robotic arm
  • 13. Palm Targeting
  • 14. Robotic arm tracks the palm
  • 15. Fingertip trajectory recognition
  • 16. Fingertip trajectory control robotic arm
  • 17. Gesture Grasp and Release Objects
  • 18. Finger Control Robot Arm
8. AI Large Model Voice Module (Must Read)
  • 1. Introduction to AI Large Model Voice Module
  • 2. Flash the firmware (Must read)
  • 3. Modify the wake-up word and command word
9. 2D Voice Control Course
  • 1. Simple Voice Control
  • 2. Smart Voice Control
  • 3. Voice Action Control
  • 4. Memory Learning Mode
  • 5. Color Recognition with Voice Broadcast
  • 6. Color Recognition and Grasping with Voice Broadcast
  • 7. Color Recognition and Sorting with Voice Broadcast
  • 8. Voice Recognition Target Tracking
  • 9. Voice Control Stacking
  • 10. Voice Control Sorting
  • 11. Garbage Recognition with Voice Broadcast
  • 12. Garbage Sorting with Voice Broadcast
10. 3D Depth Camera Course
  • 1. Dabai_DCW2 camera
  • 2. Deep pseudo-color image
  • 3. Depth camera ranging
  • 4. Color block volume measurement
11. 3D Robotic Arm Control and Inverse Kinematics
  • 1. Robotic arm ROS control
  • 2. Inverse solution
12. 3D Sorting and Grasping Course
  • 1. AprilTag ID sorting
  • 2. AprilTag abnormal height sorting
  • 3. MediaPipe Gesture-AprilTag ID sorting
  • 4. MediaPipe Gesture-AprilTag height sorting
  • 5. MediaPipe Gesture-AprilTag distance sorting
  • 6. Block color sorting
  • 7. Block abnormal height sorting
  • 8. Block different shape sorting
  • 9. Block shape abnormal height sorting
  • 10. Yolov26 garbage sorting
13. 3D Tracking and Grasping Course
  • 1. AprilTag Tracking and Grasping
  • 2. Color Block Tracking and Grasping
  • 3. KCF Object Tracking and Grasping
14. 3D Voice Control for Grasping Course (Sorting & Tracking)
  • 1. Voice Control AprilTag ID Sorting
  • 2. Voice Control Remove Height Abnormal AprilTag
  • 3. Voice Control Tracking and Grasping AprilTag
  • 4. Voice Control Color Block Sorting
  • 5. Voice Control Remove Height Abnormal Color Block
  • 6. Voice Control Tracking and Grasping Color Block
  • 7. Voice Control Yolov26 Garbage Recognition Sorting
  • 8. Voice Control Object Tracking and Grasping
15. AI Model Basics
  • 1. AI Large Model Types and Principles
  • 2. RAG Retrieval Enhancement and Model Training Samples
  • 3. Embodied Intelligent Robot System Architecture
  • 4. Embodied Intelligent Functions Core Source Code
16. AI Model Development
  • 0. DofbotUltra Large Model Development Quick Start Guide
  • 1. Register a Model Service Provider Account
  • 2. Configure API-KEY
  • 3. Introduction to Dify
  • 4. Basic Dify Features
  • 5. AI Large Model Development - chatbot
  • 6. Deploy the RAG knowledge base
  • 7. RAG knowledge base + chatbot
  • 8. AI agent workflow
17. AI Model – Text Version
  • 1. Semantic understand instruction following
  • 2. Multimodal visual understand
  • 3. Text Large Model + robotic arm control
  • 4. Multimodal Large Model + Video Understanding
  • 5. Multimodal Large Model + Robotic Arm Gripping
  • 6. Multimodal Large Model + Robotic Arm Tracking
  • 7. Multimodal Large Model + Robotic Arm Sorting
  • 8. Multimodal Large Model + Robotic Arm Handling
  • 9. Multimodal Large Model + Color Blocks Back In Place
  • 10. Multimodal Large Model + Intent Prediction + Robotic Arm Gripping
  • 11. Text Large Model + YOLOv26 + Intelligent Garbage Classification
18. AI Model – Voice Version
  • 1. Semantic understand instruction following
  • 2. Multimodal visual understand
  • 3. Text Large Model + robotic arm control
  • 4. Multimodal Large Model + Video Understanding
  • 5. Multimodal Large Model + Robotic Arm Gripping
  • 6. Multimodal Large Model + Robotic Arm Tracking
  • 7. Multimodal Large Model + Robotic Arm Sorting
  • 8. Multimodal Large Model + Robotic Arm Handling
  • 9. Multimodal Large Model + Color Blocks Back In Place
  • 10. Multimodal Large Model + Intent Prediction + Robotic Arm Gripping
  • 11. Text Large Model + YOLOv26 + Intelligent Garbage Classification
19. AI Model – Fun Applications
  • 1. AI Butler-Intent Inference
  • 2. AI Encyclopedia-Arithmetic Master
  • 3. AI Encyclopedia-You asked I Pointed
  • 4. AI Encyclopedia-Nutritional Analysis
  • 5. AI Encyclopedia-Problem Solving Expert
  • 6. AI Encyclopedia-English Spelling
  • 7. AI Butler-Garbage Sorting
  • 8. AI Top Chef
20. MoveIt Course
  • 1. MoveIt Configuration
  • 2. MoveIt Usage
  • 3. MoveIt Drive Real Robot
  • 4. MoveIt Random Movement
  • 5. MoveIt Forward Kinematics Design
  • 6. MoveIt Inverse Kinematics Design
  • 7. MoveIt Cartesian Path
  • 8. MoveIt Scene Design
  • 9. MoveIt Trajectory Planning
  • 10. MoveIt Collision Detection
21. YOLOv11 Development Course
PI 5
  • 1. YOLO Environment Setup
  • 2. CLI Usage
  • 3. Object Detection
  • 4. Instance Segmentation
  • 5. Pose Estimation
  • 6. Image Classification
  • 7. Oriented Bounding Boxes Object Detection
  • 8. Model Conversion
  • 9. Dataset Annotation
  • 10. Model Training and Conversion
  • 11. Model Prediction
RDK X5
  • 1. YOLO Environment Setup
  • 2. CLI Usage
  • 3. Object Detection
  • 4. Instance Segmentation
  • 5. Pose Estimation
  • 6. Image Classification
  • 7. Oriented Bounding Boxes Object Detection
  • 8. Model Prediction
  • 9. Model Conversion
22. YOLOv26 Development Course
PI 5
  • 6. Image Classification
  • 1. YOLO Environment Setup
  • 2. CLI Usage
  • 3. Object Detection
  • 4. Instance Segmentation
  • 5. Pose Estimation
  • 6. Image Classification
  • 7. Oriented Bounding Boxes Object Detection
  • 8. Model Conversion
  • 9. Dataset Annotation
  • 10. Model Training and Conversion
  • 11. Model Prediction
RDK X5
  • 1. YOLO Environment Setup
  • 2. CLI Usage
  • 3. Object Detection
  • 4. Instance Segmentation
  • 5. Pose Estimation
  • 7. Oriented Bounding Boxes Object Detection
  • 8. Model Conversion
  • 9. Dataset Annotation
  • 10. Model Training and Conversion
  • 11. Model Prediction
23.Linux Operating System
  • 1.Introduction to Linux system
  • 2.Ubuntu file system
  • 3.Ubuntu common commands
  • 4.Ubuntu common editors
  • 5.Ubuntu software operation commands
  • 6.Virtual machine installation
  • 7.SSH remote control
  • 8.VNC remote control
  • 9.Transfer files remotely
  • 10.Driver library and communication
  • 11.Capacity expansion and resource allocation
  • 12.Bind device ID
  • 13.Capacity expansion and resource allocation
  • 14.Update system software sources
  • 15.Set root user password
  • 16.sudo free password
  • 17.Connect to WiFi network
  • 18.View system version
  • 19.Customized service management
  • 20.Back up system image
24. Basic Control Course
  • 1. Control RGB Light
  • 2. Control Buzzer
  • 3. Control Single Servo
  • 4. Read Servo Angle
  • 5. Control All Servos
  • 6. DOFBOT Up Down Left Right Movement
  • 7. DOFBOT Dancing
  • 8. DOFBOT Memory Actions
  • 9. DOFBOT Grab Blocks
  • 10. Porter
  • 11. Stack Blocks
  • 12. Two DOFBOT Synchronized Actions
25.RDKx5 Board Basic Course
  • 1.Introduction to RDK X5 board
  • 2.Write system file
  • 3.Hardware interface description
  • 4.Install case and other accessories
  • 5.Use 7-inch display
  • 6.SD card expansion
  • 7.Network configuration
  • 8.Remote login
  • 9.Update system
  • 10.srpi-config user guide
  • 11.config. txt configuration file
  • 12.Self-startup setting
  • 13.RDK exclusive command usage
  • 14.Linux command usage
  • 15.GPIO readwrite operation
  • 16.Image classification algorithm
  • 17.Use USB camera
  • 18.Use MIPI camera
  • 19.Binocular camera depth algorithm
26.PI5 Board Basic Course
  • 1.Introduction to Raspberry PI 5
  • 2.Raspberry PI system installation and backup
  • 3.Powering the Raspberry PI 5
  • 4.Startup of Raspberry PI 5
  • 5.Installation and introduction of shell and active radiator
  • 6.GPIO and 40-pin pins
  • 7.Tips for using Raspberry PI 5
  • 8.Raspberry PI PCIe connector
  • 9.MIPI CSI DSI connector
  • 10.UART connector
  • 11.Real-time clock
  • 12.Power over Ethernet (PoE) connector
  • 13.Update and upgrade operating system
  • 14.Introduction to raspi-config tool
  • 15.config.txt file description
  • 16.Network Configuration
  • 17.remote access
  • 18.Transfer files remotely
  • 19.Set display resolution and rotation
  • 20.Set screen to sleep
  • 21.Get real-time temperature of Raspberry Pi
  • 22.Play audio and video
  • 23.Using USB camera
  • 24.Using MIPI camera
27. Visual Basics Course
  • 1. Introduction to Open Source CV
  • 2. Image Reading and Display
  • 3. Image Writing
  • 4. Image Quality
  • 5. Pixel Operation
  • 6. Image Zoom
  • 7. Picture Cut
  • 8. Picture Pan
  • 9. Picture Mirroring
  • 10. Affine Transformation
  • 11. Picture Rotation
  • 12. Perspective Transformation
  • 13. Grayscale Processing
  • 14. Binary Image
  • 15. Edge Detection
  • 16. Line Segment Drawing
  • 17. Rectangular Circle Drawing
  • 18. Text and Picture Drawing
28. ROS2 Basic Course
  • 1.Introduction to ROS2
  • 2.ROS2 install Humble
  • 3.ROS2 development environment
  • 4.ROS2 workspace
  • 5.ROS2 function package
  • 6.ROS2 node
  • 7.ROS2 topic communication
  • 8.ROS2 service communication
  • 9.ROS2 action communication
  • 10.ROS2 custom interface message
  • 11.ROS2 parameter service case
  • 12.ROS2 meta-function package
  • 13.ROS2 distributed communication
  • 14.ROS2 DDS
  • 15.ROS2 time related API
  • 16.ROS2 common command tools
  • 17.ROS2 rviz2 use
  • 18.ROS2 rqt toolbox
  • 19.ROS2 Launch startup file configuration
  • 20.ROS2 recording and playback tool
  • 21.ROS2 URDF model
  • 22.ROS2 Gazebo simulation platform
  • 23.ROS2 TF2 coordinate transformation
29. Jupyter Lab Usage Course
  • 1. Read the document before operation
  • 2. Jupyter lab environment construction tutorial
  • 3. Basic tutorial of Jupyter lab
  • 4. Jupyter widgets configuration tutorial
  • 5. Getting Started Tutorial for JupyterWidgets Controls
Download
  • System_File
  • VM_File
  • Instruction Manual
  • Code
  • Software Tools
  • Communication_Protocols
  • Hardware_Info
Download ZIP

Welcome to DOFBOT-Ultra repository

14.Linux command usage

Linux command usage

Linux command usage1. apt2. dmesg3. dpkg-deb4. dpkg5. find6. grep command7. ifconfig8. ip9. mount10. netstat11. nohup12. ps13. route14. rsync15. scp16. ssh17. tar18. topGrammar explanationOption DescriptionTop interaction commandDisplay informationCommon commands19. zip

1. apt

apt (Advanced Packaging Tool) is a shell frontend package manager in Debian and Ubuntu.

apt command provides commands for finding, installing, upgrading, and deleting a single, a group, or even all software packages, and the commands are concise and easy to remember.

The execution of the apt command requires super-administrator privileges (root).

  • Grammar explanation

    xxxxxxxxxx
    apt [options] [command] [package ...]
    • options: Optional, options include - h (Help), - y (When prompted to select all as "yes" during installation), - q (Do not display installation process), and so on.
    • command:The operation to be performed.
    • package: The name of the installed package.
  • Common commands

  • Update the apt software source database:sudo apt update

  • Update installed software packages:sudo apt upgrade

    List upgradable software packages and version information:apt list --upgradeable

    Upgrade software package, delete the package that needs to be updated before upgrading:sudo apt full-upgrade

  • Install the specified software command:sudo apt install <package_name>

    Install multiple software packages:sudo apt install <package_1> <package_2> <package_3>

  • Display specific information about the software package, such as version number, installation size, dependencies, etc:sudo apt show <package_name>

  • Delete package command:sudo apt remove <package_name>

  • Clean up dependencies and library files that are no longer in use: sudo apt autoremove

  • Remove software packages and configuration files: sudo apt purge <package_name>

  • Find software package command: sudo apt search <package_name>

  • List all installed packages:apt list --installed

  • List the version information of all installed packages:apt list --all-versions

2. dmesg

The dmesg command is used to view or control the kernel ring buffer.

The kernel will store the kernel startup log in the ring buffer. If you don't have time to view the information when turning on the computer, you can use dmesg to check.

  • Grammar explanation

    ​x
    dmesg [options]
    
    
           dmesg -C / dmesg --clear
           dmesg -c / dmesg --read-clear [options]
    • Option description
    • -c, --read-clear After displaying the information, clear the contents of the ring buffer.
    • -C, --clear Clear the contents of the ring buffer.
  • Common commands

    • Display the kernel log contents of all ring buffers

      xxxxxxxxxx
      dmesg
    • Save kernel logs to a file

      xxxxxxxxxx
      dmesg > kernel.log
    • Clearing cache logs can reduce log content during driver debugging

      xxxxxxxxxx
      dmesg -C

3. dpkg-deb

dpkg deb command is a package management tool under Debian Linux, which can perform packaging and unpacking operations on software packages and provide package information.

  • Grammar explanation

xxxxxxxxxx
  dpkg-deb [<option> ...] <command>
  • Command description

    dpkg-deb command not only has options to set, but also requires commands to perform different functions.

    • -b:Create a debian software package;
    • -c:Display the file list in the software package;
    • -e:Decompress the main control information;
    • -f:Print the field content to standard output;
    • -x:Release the files in the software package to the specified directory;
    • -X:Release the files in the software package to the specified directory and display the detailed process of releasing the files;
    • -w:Display information about software packages;
    • -l:Display detailed information of the software package;
    • -R:Extract control information and archive inventory files;
    • -b: Create a debian package.
    • -c: Display the file list in the software package.
    • -e: Decompress the main control information.
    • -f: Print the field content to standard output.
    • -x: Release files from the software package to the specified directory.
    • -X: Release the files in the software package to the specified directory and display the detailed process of releasing the files.
    • -w: Display information about the software package.
    • -l: Display detailed information of the software package.
    • -R: Extract control information and archive inventory files.
  • Option description

    • -v, --verbose:Enable detailed output.

    • -D, --debug:Enable debugging output.

      • --showformat=<format>:Use alternative formats for --show。
      • --deb-format=<format>:Select the archive format. The allowed values are 0.939000 and 2.0 (default values).
      • --nocheck:Prohibit controlling file checks (building malicious software packages).
      • --root-owner-group:Force the owner and group of the file to be root.
      • --[no-]uniform-compression:Use compression parameters on all members. If specified, uniform compression parameters will be used.
    • -z#:Set the compression level during construction.

    • -Z<type>:Set the compression type used during construction. The allowed types are gzip, xz, zstd, and none.

    • -S<strategy>:Set compression strategy during construction. The allowed values are none, extreme (xz), filtered, Huffman, rle, fixed (gzip).

  • Common commands

    • Extract program files

      xxxxxxxxxx
      dpkg-deb -x hobot-configs_2.2.0-20231030133209_arm64.deb
    • Extract control file

      xxxxxxxxxx
      dpkg-deb -e hobot-configs_2.2.0-20231030133209_arm64.deb hobot-configs/DEBIAN
    • Query the file contents in the deb package

      xxxxxxxxxx
      dpkg-deb -c hobot-configs_2.2.0-20231030133209_arm64.deb

4. dpkg

Install, create, and manage software packages on a Debian Linux system.

dpkg command is a utility used by Debian Linux systems to install, create, and manage software packages.

  • Grammar explanation

    xxxxxxxxxx
    dpkg [<option> ...] <command>
  • Command description

    dpkg command not only has options to set, but also requires commands to perform different functions.

    • -i:Install software packages.
    • -r:Delete software packages.
    • -P:Delete software packages while deleting their configuration files.
    • -L:List files belonging to the specified software package.
    • -l:Briefly list the status of the software package.
    • -S:Search for software packages containing specified files.
    • --unpack: Unpack the software package.
    • -c:Display the file list within the software package.
    • --confiugre: Configure software packages.
  • Option description

    • --admindir=Useinstead of/var/lib/dpkg.
    • --root=Install to another root directory.
    • -- instdir=Change the installation directory while keeping the management directory unchanged.
    • -- path exclude=Do not install paths that match Shell expressions.
    • --path include=After excluding a pattern, include another pattern.
    • -O | -- selected only ignores software packages that have not been selected for installation or upgrade.
    • -E | -- skip same version ignores packages with the same version as the installed software version.
    • -G | -- reuse downgrade ignores packages with versions earlier than the installed software version.
    • -B | -- Auto configure needs to be installed even if it affects other software packages.
    • --[no-]triggers Skip or force trigger handling that occurs with it.
    • -- verify format=Check the output format ('rpm 'is supported).
    • --no-debsig does not attempt to verify the signature of the software package.
    • -D | -- debug=Enable debugging (see - DHelp or -- debug=help).
    • --status logger=sends status updates to the standard input of.
    • --log=Update status and operation information to.
    • --ignore pending= Ignore all dependencies related to.
    • --force-... Ignore the problems encountered (see -- force help).
    • --no-force-...|-- Pause when encountering problems.
    • --abort-after encounteringerrors cumulatively.

 

  • Common commands

    • Installation package
    xxxxxxxxxx
    dpkg -i package.deb
    • Delete package
    xxxxxxxxxx
    dpkg -r package
    • Delete packages (including configuration files)
    xxxxxxxxxx
    dpkg -P package
    • List the files associated with the package
    xxxxxxxxxx
    dpkg -L package
    • Display the version of the package
    xxxxxxxxxx
    dpkg -l package
    • Unzip the contents of the deb package
    xxxxxxxxxx
    dpkg --unpack package.deb
    • Search for the content of the package to which it belongs
    xxxxxxxxxx
    dpkg -S keyword
    • List the currently installed packages
    xxxxxxxxxx
    dpkg -l
    • List the contents of the deb package
    xxxxxxxxxx
    dpkg -c package.deb
    • Configuration package
    xxxxxxxxxx
    dpkg --configure package

5. find

The find command is used to search for files and directories in a specified directory.

It can use different options to filter and restrict the search results. Any string before the parameter will be considered as the directory name to be searched for. If no parameters are set when using this command, the find command will search for subdirectories and files in the current directory. And display all the subdirectories and files found.

  • Grammar explanation

    xxxxxxxxxx
      find [-H] [-L] [-P] [-Olevel] [-D debugopts] [path...] [expression]
  • Option description

    path The directory path to be searched can be a single directory or file name, or multiple paths separated by spaces. If no path is specified, it defaults to the current directory.

    expression It is an optional parameter used to specify the search criteria, which can include file name, file type, file size, and so on.

    There are many options available in the expression, and the most commonly used ones are listed below.

    • -name pattern:Search by file name, supporting the use of wildcard characters*and?.
    • -iname pattern:The effect of this parameter is similar to specifying the - name parameter, but ignores the difference in character case;
    • -type type:Search by file type, which can be f(regular file),d(directory),l(symbolic link), etc.
    • -size [+-]size[cwbkMG]:Search by file size, supporting the use of + or - to indicate larger or smaller than a specified size. The units can be c (bytes), w (word count), b (block count), k(KB), M(MB), or G(GB).
    • -mtime days:Search by modification time, supports using + or - to indicate before or after a specified number of days, days is an integer representing the number of days.
    • -user username:Search by file owner.
    • -group groupname:Search by file group.

    The parameters used for time in the find command are as follows.

    • -amin n:Search for files that have been accessed within n minutes.
    • -atime n:Search for files that have been accessed within n*24 hours.
    • -cmin n:Search for files with status changes (such as permissions) within n minutes.
    • -ctime n:Search for files with status changes (such as permissions) within n*24 hours.
    • -mmin n:Search for files that have been modified within n minutes.
    • -mtime n:Search for files that have been modified within n*24 hours.

    Among these parameters, n can be a positive, negative, or zero number.

    Positive numbers indicate files that have been modified or accessed within a specified time.

    Negative numbers indicate files that have been modified or accessed before the specified time.

    Zero indicates files that have been modified or accessed at the current time point.

     

    For example, - mtime 0 indicates searching for files modified today, and - mtime -7indicates searching for files modified a week ago.

    Explanation on the parameter of time n:

    • +n:Search for files or directories that are older than n days ago.
    • -n:Search for files or directories that have changed their properties within n days.
    • n:Find files or directories whose properties have been changed n days ago (specify the day).

 

  • Common commands

    List all files and folders in the current directory and subdirectories

    xxxxxxxxxx
    find .

    Search for a file named 'file. txt' in the current directory

    xxxxxxxxxx
    find . -name file.txt

    List all files with the suffix . c in the current directory and its subdirectories

    xxxxxxxxxx
    find . -name "*.c"

    Same as above, but ignoring capitalization

    xxxxxxxxxx
    find . -iname "*.c"

    List all files in the current directory and its subdirectories

    xxxxxxxxxx
    find . -type f

    Search for files larger than 1MB in the/home directory

    xxxxxxxxxx
    find . -size +1M

    Search for files smaller than 10KB

    xxxxxxxxxx
    find . -type f -size -10k

    Search for files equal to 10KB

    xxxxxxxxxx
    find . -type f -size 10k
    • File size unit:

      • b —— Block (512 bytes)
      • c —— Byte
      • w —— Word(2 bytes)
      • k —— kilobyte
      • M —— megabyte
      • G —— Gigabyte

    Search for files in/var/log directory that were modified 7 days ago.

    xxxxxxxxxx
    find /var/log -mtime +7

    List all files in the current directory and its subdirectories that have been updated in the last 20 days.

    xxxxxxxxxx
    find . -ctime  20

    List all files updated 20 days ago or earlier in the previous directory and its subdirectories.

    xxxxxxxxxx
    find . -ctime  +20

    List all files updated within the last 20 days in the current directory and its subdirectories.

    xxxxxxxxxx
    find . -ctime  20

    Search for regular files in the/var/log directory that have been changed before the 7th, and ask them before deleting them.

    xxxxxxxxxx
    find /var/log -type f -mtime +7 -ok rm {} \;

    Find files in the current directory that belong to the owner with read and write permissions, and whose group users and other users have read permissions.

    xxxxxxxxxx
    find . -type f -perm 644 -exec ls -l {} \;

    Find all regular files with a length of 0 in the system and list their complete paths.

    xxxxxxxxxx
    find / -type f -size 0 -exec ls -l {} \;

    Search for all files ending in. txt and. pdf in the current directory and subdirectories.

    xxxxxxxxxx
    find . \( -name "*.txt" -o -name "*.pdf" \)
    Or 
    find . -name "*.txt" -o -name "*.pdf"

    Match file path or file.

    xxxxxxxxxx
    find /usr/ -path "*local*"

    Matching file paths based on regular expressions.

    xxxxxxxxxx
    find . -regex ".*\(\.txt\|\.pdf\)$"

    Same as above, but ignoring capitalization.

    xxxxxxxxxx
    find . -iregex ".*\(\.txt\|\.pdf\)$"

    Negative parameter, find files under/home that do not end in. txt.

    xxxxxxxxxx
    find /home ! -name "*.txt"

    Search by file type.

    xxxxxxxxxx
    find . -type Type parameter
    • Type parameter list

      • f Regular file
      • l Symbol connection
      • d Directory
      • c Character device
      • b Block device
      • s Socket
      • p Fifo

     

    Based on directory depth search, the maximum downward depth limit is 3

    xxxxxxxxxx
    find . -maxdepth 3 -type f

    Search for all files with a depth distance of at least 2 subdirectories from the current directory

    xxxxxxxxxx
    find . -mindepth 2 -type f

    Delete all .logfiles in the current directory.

    xxxxxxxxxx
    find . -type f -name "*.log" -delete

    Search for a file with permission 777 in the current directory

    xxxxxxxxxx
    find . -type f -perm 777

    Find the . conf file in the current directory with permissions other than 644

    xxxxxxxxxx
    find . -type f -name "*.conf" ! -perm 644

    Find all files owned by the current directory user sunrise

    xxxxxxxxxx
    find . -type f -user sunrise

    Find all files owned by the current directory user group sunrise

    xxxxxxxxxx
    find . -type f -group sunrise

    Find all root files in the current directory and change the ownership to user sunrise

    xxxxxxxxxx
    find .-type f -user root -exec chown sunrise {} \;

    In the example above, {} is used in combination with the -exec option to match all files, which are then replaced with the appropriate file name.

    Find all the .txtfiles in thehomedirectory and delete them.

    xxxxxxxxxx
    find $HOME/. -name "*.txt" -ok rm {} \;

     

    In the above example, the behavior of - ok and - executive is the same, but it will give a prompt whether to perform the corresponding operation.

    Search for all . txt files in the current directory and concatenate them to write them into the all. txtfile

    xxxxxxxxxx
    find . -type f -name "*.txt" -exec cat {} \;> /all.txt

    Search for all. txt files in the current directory or subdirectories, but skip subdirectories sk

    xxxxxxxxxx
    find . -path "./sk" -prune -o -name "*.txt" -print

    ⚠️ ./sk cannot be written as./sk/; otherwise, it has no effect.

    Ignore two directories

    xxxxxxxxxx
    find . \( -path ./sk -o  -path ./st \) -prune -o -name "*.txt" -print

    ⚠️ If writing relative path must add ./

    To list all files of zero length.

    xxxxxxxxxx
    find . -empty

    Count lines of code

    xxxxxxxxxx
    find . -name "*.c"|xargs cat|grep -v ^$|wc -l # Code line count, excluding empty lines

6. grep command

Powerful text search tool.

Grep (global search regular expression (RE) and print out the line) is a powerful text search tool that can use regular expressions to search for text and print out matching lines. Specific characters used for filtering/searching. Regular expressions can be used in conjunction with various commands, making them very flexible to use.

Similar commands include egrep, fgrep, and rgrep.

  • Grammar specification

    xxxxxxxxxx
      grep [OPTION]... PATTERNS [FILE]...
      grep [OPTION...] PATTERNS [FILE...]
      grep [OPTION...] -e PATTERNS ... [FILE...]
      grep [OPTION...] -f PATTERN_FILE ... [FILE...]
    • PATTERNS - Indicates the string or regular expression to look for.
    • FILE - Indicates the FILE name to be searched. Multiple files can be searched at the same time. If the 'file' parameter is omitted, the data is read from the standard input by default.

 

  • Option description

    Common options description:

    • -i:Ignore case for matching.
    • -v:Reverse lookup, printing only rows that do not match.
    • -n:Displays the line number of the matching row.
    • -r:Find files in subdirectories recursively.
    • -l:Only matching filenames are printed.
    • -c:Only the number of matching lines is printed.

    More Parameter Description

    • -a or -- text : Do not ignore binary data.
    • -Aor -- after context= : In addition to displaying the column that conforms to the template style, display the content after that row.
    • - b or -- byte off set : Before displaying the line that conforms to the style, indicate the number of the first character of that line.
    • -Bor -- before content= : Display the content before the line, in addition to the line that matches the style.
    • -c or -- count: Calculate the number of columns that match the style.
    • -Cor -- context=or -: In addition to displaying the line that conforms to the style, display the content before and after that line.
    • -dor -- directories= : This parameter must be used when specifying that the search is for a directory rather than a file, otherwise the grep directive will report information and stop the action.
    • -e