Loading

Linux基本命令

  1. ls: Lists files and directories.

    • Usage: ls, ls -l (long format), ls -a (including hidden files)
  2. cd: Changes the current directory.

    • Usage: cd [directory], cd .. (parent directory), cd (home directory)
  3. pwd: Displays the path of the current working directory.

    • Usage: pwd
  4. cp: Copies files and directories.

    • Usage: cp [source] [destination], cp -r [source_directory] [destination_directory] (recursive copy)
  5. mv: Moves or renames files and directories.

    • Usage: mv [source] [destination], mv [old_name] [new_name]
  6. rm: Removes files and directories.

    • Usage: rm [file], rm -r [directory] (recursive remove)
  7. mkdir: Creates new directories.

    • Usage: mkdir [directory_name]
  8. touch: Creates a new empty file or updates the timestamp of an existing file.

    • Usage: touch [file_name]
  9. cat: Concatenates and displays the content of files.

    • Usage: cat [file], cat [file1] [file2] > [new_combined_file]
  10. grep: Searches for a specific pattern in files or input.

    • Usage: grep '[pattern]' [file], cat [file] | grep '[pattern]'
  11. find: Searches for files and directories based on various criteria.

    • Usage: find [directory] -name '[pattern]', find [directory] -type f (files only)
  12. sudo: Executes commands with superuser privileges.

    • Usage: sudo [command]
  13. chmod: Changes the permissions of files or directories.

    • Usage: chmod [permissions] [file]
  14. chown: Changes the owner and group of files or directories.

    • Usage: chown [user]:[group] [file]
  15. df: Displays disk space usage.

    • Usage: df, df -h (human-readable format)
  16. du: Displays the disk usage of files and directories.

    • Usage: du, du -h (human-readable format)
  17. ps: Shows information about active processes.

    • Usage: ps, ps -aux
  18. kill: Terminates processes.

    • Usage: kill [process_id], kill -9 [process_id] (force kill)
  19. nano, vi, emacs: Text editors for editing files.

    • Usage: nano [file], vi [file], emacs [file]
  20. man: Displays the manual page for other commands.

    • Usage: man [command]
posted @ 2023-12-04 13:25  马路野狼  阅读(23)  评论(0)    收藏  举报