File System Administration
list of commands related to file system administration, managing files and directories, understanding file permissions and ownership, using basic file manipulation commands, and managing hard and symbolic links in Red Hat Enterprise Linux (RHEL).
File System Administration
Mounting and Unmounting File Systems
mount [options] device directory
: Mount a file system.umount [options] directory|device
: Unmount a file system.df [options]
: Report file system disk space usage.du [options] [path]
: Estimate file space usage.
Creating and Managing File Systems
mkfs [options] device
: Create a file system.mkfs.ext4 device
: Create an ext4 file system.tune2fs [options] device
: Adjust tunable file system parameters.
File System Checking and Repair
fsck [options] device
: File system consistency check and repair.e2fsck [options] device
: Check an ext2/ext3/ext4 file system.
Monitoring File System Usage
df -h
: Display disk space usage in human-readable format.du -sh [path]
: Display total disk space usage for a directory.
Managing Files and Directories
Listing Files and Directories
ls [options] [path]
: List directory contents.ls -l
: List with detailed information.ls -a
: List all files including hidden files.ls -lh
: List with human-readable file sizes.
Copying Files and Directories
cp [options] source destination
: Copy files or directories.cp -r source destination
: Copy directories recursively.
Moving and Renaming Files and Directories
mv [options] source destination
: Move or rename files or directories.
Removing Files and Directories
rm [options] file
: Remove files.rm -r directory
: Remove directories recursively.
Creating Directories
mkdir [options] directory
: Create directories.mkdir -p directory
: Create nested directories.
Removing Directories
rmdir directory
: Remove empty directories.
Understanding File Permissions and Ownership
Viewing File Permissions
ls -l [path]
: List files with permissions.
Changing File Permissions
chmod [options] mode file
: Change file permissions.chmod u+x file
: Add execute permission for the user.chmod g-w file
: Remove write permission for the group.chmod o=r file
: Set read-only permission for others.chmod 755 file
: Set file permissions using numeric mode.
Changing File Ownership
chown [options] owner:group file
: Change file owner and group.chown user file
: Change file owner.chgrp group file
: Change file group.
Using Basic File Manipulation Commands
Listing Files and Directories
ls [options] [path]
: List directory contents.
Copying Files
cp [options] source destination
: Copy files.
Moving and Renaming Files
mv [options] source destination
: Move or rename files.
Removing Files
rm [options] file
: Remove files.
Creating Directories
mkdir [options] directory
: Create directories.
Removing Directories
rmdir directory
: Remove empty directories.
Managing Hard and Symbolic Links
Creating Hard Links
ln [options] target link
: Create a hard link.
Creating Symbolic (Soft) Links
ln -s [options] target link
: Create a symbolic link.
Viewing Links
ls -l [path]
: List files with link information.
Removing Links
rm [options] link
: Remove links.
Here's a summary of the commonly used commands:
shellCopy code# File System Administration
mount /dev/sda1 /mnt # Mount file system
umount /mnt # Unmount file system
df -h # Display disk space usage
du -sh /path/to/dir # Estimate directory space usage
# Managing Files and Directories
ls -l # List directory contents with details
cp file1 file2 # Copy file1 to file2
cp -r dir1 dir2 # Copy directory dir1 to dir2
mv file1 file2 # Move or rename file1 to file2
rm file # Remove file
rm -r dir # Remove directory dir recursively
mkdir newdir # Create new directory
rmdir emptydir # Remove empty directory
# Understanding File Permissions and Ownership
ls -l file # View file permissions
chmod u+x file # Add execute permission for user
chmod 755 file # Change file permissions using numeric mode
chown user:group file # Change file owner and group
chgrp group file # Change file group
# Managing Links
ln target link # Create hard link
ln -s target link # Create symbolic link
ls -l link # View link information
rm link # Remove link
Subscribe to my newsletter
Read articles from Infraboy directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Infraboy
Infraboy
We will provide all kinds of the note which is related to IT infra courses like : Networking , Cloud Computing , AWS , CEH , Cyber Security