"tmp" stands for "temporary."
- The
/tmpdirectory contains temporary files created during the current session. - It is used for files needed only temporarily and is automatically cleared upon system shutdown.
- Note: Not recommended for storing permanent files.
-
Creating and Editing a Temporary File
gedit demo.txt
- Open
demo.txtand add content.
- Open
-
Viewing Content in
demo.txtcat demo.txt
- Displays the content of
demo.txt:add some content here add more extra content here
- Displays the content of
-
Checking File Permissions
ls -l demo.txt
- Example Output:
-rw-rw-r-- 1 akshay akshay 49 Sep 4 16:20 demo.txt
- Example Output:
-
Modifying File Permissions
chmod u-rw demo.txt
- Removes read and write permissions for the user, resulting in permission denial when trying to read:
cat demo.txt # Output: cat: demo.txt: Permission denied
- Removes read and write permissions for the user, resulting in permission denial when trying to read:
-
Restoring Permissions
chmod u+rw demo.txt
- Grants read and write permissions back to the user.
-
Appending Content
cat >> demo.txt added last line by akshay- Use
Ctrl + Dto save and exit.
- Use
"dev" stands for "device."
- In Linux, all devices are represented as files.
- The
/devdirectory contains special files used to interact with devices.
- tty: Terminal-related file.
- fd: Floppy drive-related file.
- hd: Hard disk-related file.
- ram: RAM-related file.
- stdin: Standard input (keyboard).
- stdout: Standard output (terminal/monitor).
- stderr: Standard error output (terminal/monitor).
"mnt" stands for "mount."
- The
/mntdirectory is used for attaching external file systems to the Linux file system (e.g., pen drives, CDs, external hard disks). - Mounting: Process of attaching external file systems. Older OS versions required manual mounting; recent OS versions do this automatically.
- This directory is used for automatically mounted devices (e.g., USB drives, external hard drives, CD/DVD drives).
- Difference from
/mnt:/mnt: Contains manually mounted files./media: Contains automatically mounted files.
"opt" stands for "optional."
- Contains installation files for third-party software not included in the default system installation.
- Examples:
- Google Chrome
- Oracle products
- Other manually installed applications
- The
/libdirectory stores essential shared libraries and kernel modules required by the Linux OS, commands, and applications.
"var" stands for "variable data."
- Stores data that frequently changes, like system logs, mail spools, and print spools.
- Example: Log files are commonly stored here.
- Each user has a unique directory within
/hometo store personal files. - Example:
/home/durgasoftcontains folders likeDesktop,Downloads,Movies,Pictures.
"proc" stands for "processes."
-
Contains information about all running processes.
-
Each process has a directory named after its Process ID (PID) to store specific process data.
-
Note: Use
pscommand to view running processes.ps -ef
- Displays all processes in full format.
The home directory for the superuser.
-
Located at
/rootin the filesystem. -
Not to be confused with
/(root directory for the entire filesystem)./home/durgasoft- User Home Directory fordurgasoft/root- Super User Home Directory
/is the topmost directory in the Linux file system./rootis a subdirectory of/, serving as the home directory for the superuser.
- Contains files required to boot the Linux operating system, such as the kernel, initial RAM disk, and bootloader configuration.
"usr" stands for "user."
- Contains user-related software and applications.
- Subdirectories:
/usr/bin: User commands./usr/sbin: System administration commands./usr/lib: Libraries./usr/share: Architecture-independent data.
- Note: Historically, "usr" stood for "Unix System Resources," though it is now commonly interpreted as "user."
- Main Advantage: The Linux file system structure allows the OS to easily locate files.
- File System Naming:
- Linux Examples: ext2, ext3, ext4, XFS
- Windows Examples: NTFS, FAT