Files
my-docs/Linux/LPIC1/2-directorys.md
2025-05-28 21:44:45 +03:30

2.9 KiB

📁 Linux Directory Structure & Basic Commands

This document provides an overview of important Linux directories, their types, and essential file management commands.


📂 Directory Types

Type Description
Virtual Do not reside on disk; dynamically generated by the system (e.g., /proc, /sys).
Normal Standard directories that store files and data on disk.

🗂️ Common Linux Directories

Directory Type Description
/etc Normal System configuration files
/opt Normal Optional or third-party software packages
/bin Normal Essential binary executables for all users
/sbin Normal System binaries, typically for administrative tasks
/lib Normal Shared libraries and kernel modules
/home Normal User home directories
/proc Virtual Kernel and process information (virtual files)
/srv Normal Data for services provided by the system (e.g., web, FTP)
/sys Virtual Kernel devices and system information
/usr Normal Secondary hierarchy: programs, libraries, and documentation
/var Normal Variable data: logs, mail, print spool, temporary files
/dev Virtual Device files (e.g., disk, USB, terminals)
/mnt Normal Mount point for temporary filesystems
/boot Normal Boot loader files, kernel images

🛠️ Basic File & Directory Commands

Command Description
cd Change directory
ls List directory contents
rm Remove files or directories
mkdir Create a new directory
touch Create an empty file or update timestamp
cp Copy files or directories
mv Move or rename files or directories

📘 Examples

cd /etc           # Navigate to /etc directory
ls -l             # List files in long format
rm file.txt       # Delete file.txt
mkdir new_folder  # Create a directory named 'new_folder'
touch file.txt    # Create a new empty file
cp file1.txt file2.txt  # Copy file1.txt to file2.txt
mv file.txt /home/user/ # Move file.txt to another directory