Directory Operation Commands in Linux (original) (raw)

Last Updated : 18 Dec, 2025

Directory Operations Commands in Linux are used to manage directories within the filesystem, including navigating between directories and organizing folder structures. These commands help users efficiently create, list, search, and remove directories using the terminal.

List of Directory Operation Commands

Below is a list of directory operation commands that help in understanding how directories are created, managed, and navigated in Linux.

directory_operation_commands

1. Cd

The cd command is used to move from one directory to another in Linux. It helps users navigate the file system easily.

**Example:

cd Documents

1--CD-Documents

Here, we have used the following commands:

2. Dir

The dir command is used to display the list of files and directories present in the current directory. It provides a simple view of directory contents.

**Example:

dir -a

Display All Files Including Hidden Files

3. Dirname

The dirname command is used to extract the directory path from a full file path. It removes the file name and shows only the directory location.

**Example:

dirname /Desktop/root/bash.sh

dirname /Desktop/root/bash.sh

4. Dirs

The dirs command displays the list of directories stored in the directory stack. It helps track previously visited directories.

**Example:

dirs

5. Du

The du command is used to show disk usage of directories and files. It helps identify folders that consume more disk space.

**Example:

du -h

6. Find

The find command is used to search for files and directories within a specified location. It can search based on name, type, or other conditions.

**Example:

find ./gfg -name "sample.txt"

file

7. Lsblk

The lsblk command displays information about storage devices and their mount points. It shows disks and partitions in a structured format.

**Example:

lsblk

to-display-block-devices

8. Mkdir

The mkdir command is used to create new directories in Linux. It helps organize files into folders.

**Example:

mkdir jayesh_gfg

Lightbox

9. Mount

The mount command is used to attach a filesystem to a directory. It allows access to storage devices like disks or USB drives.

**Example:

mount /dev/sda1 /mnt

10. Pwd

The pwd command is used to display the current working directory. It shows the full path from the root directory.

**Example:

pwd

Display the Current Working Directory

The output will be the absolute path of your current location in the file system

11. Rmdir

The rmdir command is used to delete empty directories from the system. It cannot remove directories that contain files.

**Example:

rmdir t

file

12. Tree

The tree command displays directories and subdirectories in a tree-like structure. It provides a clear visual view of folder hierarchy.

**Example:

tree -a ./GFG

tree -a ./GFG