Home  >  Article  >  Computer Tutorials  >  A collection of simple shell commands.

A collection of simple shell commands.

王林
王林forward
2024-02-21 12:36:28975browse

A collection of simple shell commands.

The following are some commonly used Shell commands:

  1. File and directory operations:

    • ls: List files and subdirectories in a directory.
    • cd: Switch to the specified directory.
    • pwd: Display the path of the current working directory.
    • mkdir: Create a new directory.
    • rm: Delete files or directories.
    • cp: Copy files or directories.
    • mv: Move or rename files or directories.
  2. Text file processing:

    • cat: Display file content.
    • grep: Search the file for the specified pattern.
    • sed: Use regular expressions for text replacement and conversion.
    • awk: Text processing tool for extracting and processing text data.
    • sort: Sort the lines of the text file.
    • head: Display the first few lines of the file.
    • tail: Display the last few lines of the file.
  3. System Information and Management:

    • ps: Display currently running processes.
    • top: Display system resource usage in real time.
    • kill: Terminate the running process.
    • uname: Display system information.
    • df: Display disk space usage.
    • free: Display system memory usage.
    • du: Display the disk usage of a directory or file.
  4. Network Tools:

    • ping: Test the connection to the specified host.
    • nslookup: Query the IP address of the domain name.
    • curl: Send HTTP request and display the return result.
    • wget: Download file.
  5. Permissions and user management:

    • chmod: Modify the permissions of a file or directory.
    • chown: Change the owner of a file or directory.
    • chgrp: Change the group to which a file or directory belongs.
    • useradd: Create a new user.
    • usermod: Modify user attributes.
    • passwd: Change user password.

This is just a small selection of commonly used Shell commands, there are many others available for different tasks and operations. You can use the
man command to view the detailed usage and options of the command. For example,
man ls will display the help documentation for the
ls command.

The above is the detailed content of A collection of simple shell commands.. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete