Home > System Tutorial > LINUX > Linux common command manual

Linux common command manual

WBOY
Release: 2024-02-18 14:12:23
Original
597 people have browsed it

Comprehensive list of commonly used Linux commands, specific code examples are required

1. Introduction

As a free and open source operating system, Linux has become the platform of choice for many developers and system administrators. Whether in server rental, website building, software development or daily use, familiarity with common Linux commands is essential. This article will introduce some commonly used Linux commands in detail and provide specific code examples.

2. File and directory operations

  1. Create directory (directory name newdir)

    mkdir newdir
    Copy after login
  2. Delete directory (directory name is olddir)

    rmdir olddir
    Copy after login
  3. Enter the directory (the directory name is mydir)

    cd mydir
    Copy after login
  4. Display the current directory

    pwd
    Copy after login
  5. Display all files and directories in the current directory

    ls
    Copy after login
  6. Copy files (copy file file1 to directory dir1)

    cp file1 dir1
    Copy after login
  7. Delete file (delete file file1)

    rm file1
    Copy after login
  8. Move file (move file file1 to directory dir1)

    mv file1 dir1
    Copy after login
  9. Find file (find file File whose name contains test)

    find / -name "test"
    Copy after login

3. File content operation

  1. Display file content (display the content of file file1)

    cat file1
    Copy after login
  2. Display the first n lines of the file (display the first 10 lines of the file file1)

    head -n 10 file1
    Copy after login
  3. Display the last n lines of the file (display the last 10 lines of the file file1 Line)

    tail -n 10 file1
    Copy after login
  4. Find the line containing a certain keyword in the file (find the line containing "hello" in the file file1)

    grep "hello" file1
    Copy after login
  5. Statistics on the number of lines, words and characters of the file (statistics on the number of lines, words and characters of the file file1)

    wc file1
    Copy after login

4. System Management

  1. Shutdown

    shutdown -h now
    Copy after login
  2. Restart

    reboot
    Copy after login
  3. Check the system version

    cat /etc/*-release
    Copy after login
  4. Check the system time

    date
    Copy after login
  5. Check the system load

    uptime
    Copy after login

5. Network operation

  1. View the IP address (View IP address of network interface eth0)

    ifconfig eth0
    Copy after login
  2. Test network connection (test connectivity to target host)

    ping target.com
    Copy after login
  3. Download file (from URL url download file)

    wget url
    Copy after login
  4. Upload file (upload file file1 to the remote host)

    scp file1 remoteuser@remotehost:/path/to/destination
    Copy after login
  5. Port monitoring (view all open files in the system Port)

    netstat -tuln
    Copy after login

6. Permission management

  1. Modify file permissions (modify the owner permissions of file file1 to read and write)

    chmod 600 file1
    Copy after login
  2. Modify the file owner (change the owner of file file1 to user1)

    chown user1 file1
    Copy after login
  3. Modify the group to which the file belongs (change the owner of file file1 Group modified to group1)

    chgrp group1 file1
    Copy after login
  4. View file permissions and owners

    ls -l file1
    Copy after login

7. Process Management

  1. View all processes

    ps -ef
    Copy after login
  2. End the process (end the process with process PID 1234)

    kill 1234
    Copy after login
  3. Run the program in the background (change the program prog1 Put it into the background to run)

    prog1 &
    Copy after login
  4. Check the CPU and memory usage of the process

    top
    Copy after login

The above are some commonly used Linux command examples, I hope they can Help you better master the Linux operating system. Of course, Linux is very powerful, and there are many other commands and usages that can be further explored and learned.

The above is the detailed content of Linux common command manual. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template