File-System-Commands

 





Linux provides a variety of command-line utilities and tools for interacting with the file system. These commands are essential for tasks such as navigating directories, managing files, checking disk usage, and more. Here are some commonly used Linux file system commands:


1. pwd (Print Working Directory):

   - Displays the current working directory.

   - Example: `pwd`


2. ls (List):

   - Lists files and directories in the current directory.

   - Example: `ls`


3. cd (Change Directory):

   - Allows you to change the current working directory.

   - Example: `cd /path/to/directory`


4. touch:

   - Creates an empty file.

   - Example: `touch filename.txt`


5. mkdir (Make Directory):

   - Creates a new directory.

   - Example: `mkdir new_directory`


6. rmdir (Remove Directory):

   - Removes an empty directory.

   - Example: `rmdir directory_name`


7. rm (Remove):

   - Deletes files or directories.

   - Example: `rm file.txt` (for files), `rm -r directory_name` (for directories and their contents)


8. cp (Copy):

   - Copies files or directories.

   - Example: `cp file.txt new_location/`


9. mv (Move or Rename):

   - Moves files or directories to a new location or renames them.

   - Example: `mv old_name.txt new_name.txt` (rename), `mv file.txt new_location/` (move)


10. find:

    - Searches for files and directories within a specified path.

    - Example: `find /path/to/search -name "filename"`


11. grep (Global Regular Expression Print):

    - Searches for text patterns within files.

    - Example: `grep "pattern" file.txt`


12. cat (Concatenate):

    - Displays the contents of a file.

    - Example: `cat file.txt`


13. more/less:

    - Display the contents of a file one page at a time.

    - Example: `more file.txt`, `less file.txt`


14. head/tail:

    - Display the first/last few lines of a file.

    - Example: `head file.txt`, `tail file.txt`



15. df (Disk Free):

    - Displays disk space usage of file systems.

    - Example: `df -h`


16. du (Disk Usage):

    - Shows the space used by files and directories.

    - Example: `du -sh /path/to/directory`


17. ln (Link):

    - Creates links to files and directories (symbolic and hard links).

    - Example: `ln -s source_file link_name`


18. mount/umount:

    - Mounts/unmounts file systems.

    - Example: `mount /dev/sdX /mnt/mount_point`, `umount /mnt/mount_point`


إرسال تعليق

Post a Comment (0)

أحدث أقدم