מאגר מידע

What are some of the most common Linux Shell commands?

Linux shell commands are used to interact with the Linux operating system through the command-line interface (CLI). They allow you to perform various tasks, manage files and directories, configure system settings, and more. Here's an explanation of some common Linux shell commands:

  1. ls (List):

    • Used to list files and directories in the current directory.
    • Example: ls, ls -l (long format), ls -a (include hidden files), ls /path/to/directory (list a specific directory).
  2. cd (Change Directory):

    • Used to change the current working directory.
    • Example: cd /path/to/directory, cd .. (move up one directory), cd ~ (go to the user's home directory).
  3. pwd (Print Working Directory):

    • Displays the current working directory's path.
    • Example: pwd.
  4. touch (Create Empty File):

    • Creates an empty file with the specified name.
    • Example: touch filename.txt.
  5. mkdir (Make Directory):

    • Creates a new directory with the specified name.
    • Example: mkdir directory_name.
  6. rmdir (Remove Directory):

    • Deletes an empty directory.
    • Example: rmdir directory_name.
  7. rm (Remove):

    • Used to delete files and directories.
    • Be cautious when using rm with the -r flag, as it can delete directories and their contents recursively.
    • Example: rm filename.txt, rm -r directory_name.
  8. cp (Copy):

    • Copies files or directories from one location to another.
    • Example: cp file1.txt /path/to/destination, cp -r dir1/ dir2/ (recursively copy directories).
  9. mv (Move/Rename):

    • Moves files or directories to a different location or renames them.
    • Example: mv file1.txt /path/to/destination, mv old_name new_name.
  10. cat (Concatenate and Display):

    • Used to display the contents of a file.
    • Example: cat filename.txt.
  11. less and more (File Viewing):

    • Display the contents of a file one screen at a time, allowing you to navigate through it.
    • Example: less filename.txt, more filename.txt.
  12. head and tail (View Top/Bottom of a File):

    • Display the first (head) or last (tail) lines of a file.
    • Example: head -n 10 filename.txt (display the first 10 lines), tail -n 20 filename.txt (display the last 20 lines).
  13. grep (Global Regular Expression Print):

    • Searches for patterns or text within files.
    • Example: grep "pattern" filename.txt.
  14. chmod (Change File Permissions):

    • Modifies file permissions to control who can read, write, and execute the file.
    • Example: chmod 644 filename.txt (read-write for owner, read-only for group and others).
  15. chown (Change Owner):

    • Changes the owner of a file or directory.
    • Example: chown new_owner:group filename.txt.
  16. ps (Process Status):

    • Displays a list of currently running processes.
    • Example: ps aux.
  17. kill (Terminate a Process):

    • Used to send signals to processes to stop or restart them.
    • Example: kill process_id.
  18. df (Disk Free):

    • Shows information about disk space usage on mounted filesystems.
    • Example: df -h (human-readable output).
  19. du (Disk Usage):

    • Displays the disk usage of files and directories.
    • Example: du -sh /path/to/directory (summarize usage in a human-readable format).
  20. history (Command History):

    • Lists the previously executed shell commands.
    • Example: history, history | grep keyword (search command history).

These are just a few common Linux shell commands, and there are many more available for various tasks and system administration purposes. Learning how to use these commands effectively can greatly enhance your ability to work with Linux systems. Additionally, you can use the man command (e.g., man ls) to access the manual pages for specific commands and learn more about their options and usage.

  • 0 משתמשים שמצאו מאמר זה מועיל
?האם התשובה שקיבלתם הייתה מועילה