Linux operating system notes

File and Directory Operations

  • ls: List files and subdirectories in the current directory
  • cd: change the current working directory
  • pwd: Display the path of the current working directory
  • mkdir: create a new directory
  • rm: Delete files or empty directories
  • cp: Copy a file or the entire directory tree to the specified location
  • mv: move or rename files and directories

text editor

  • nano: Open and edit the text file with the Nano text editor.
    • Example:$ nano filename.txt

File viewing and searching

  • cat: View single or multiple file contents and output them to the terminal.
    • Example:$ cat filename.txt

Note : If you want to view large text files on the terminal, it is recommended to use a pager program such as 'less'.

System Information Query

Note : The following commands require administrator privileges (sudo) to execute.

CPU-related information query:

  1. Query the CPU model:

    $ lscpu | grep "Model name"
    
  2. Query the number of CPU cores:

    $ lscpu | grep "Core(s) per socket"
    
  3. Query the number of CPU threads:

    $ lscpu | grep "Thread(s) per core"
    
  4. Query the total number of logical processors (number of threads * number of cores * number of physical sockets):

    $ lscpu | grep "CPU(s)"
    

Memory-related information query:

  • Query memory usage:
    $ free -h
    

Disk space query:

  • Query disk space usage (by file system):
    $ df -h
    

network operation

  • ping: Send ICMP ECHO_REQUEST packets to the target host to test network connectivity and latency.

    • Example:$ ping example.com
  • ifconfig: View and configure the IP address, subnet mask and other information of the network interface, but it has been discarded in newer versions of Linux. It is recommended to use ipcommands instead.

Guess you like

Origin blog.csdn.net/weixin_44406127/article/details/131522597