• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
DefenceDev
No Result
View All Result
Home Linux Tutorials Commands

Linux Directory Navigation and Creation with cd, pwd, and mkdir

by neo
November 28, 2025
in Commands
0
0
SHARES
26
VIEWS
Share on FacebookShare on LinkedIn
Table of Contents
  • Linux Directory Navigation and Creation
  • Directories Navigation: pwd / cd
  • List of Files and Directories: ls
  • Directory Creation: mkdir (make directory)
    • Basic Usage
    • Useful Options with mkdir
  • rm directory (remove directory)
    • Basic Usage
    • Useful options with rm

Linux Directory Navigation and Creation

Navigating and managing directories in Linux are fundamental skills for any user. Whether you’re a beginner or looking to brush up on the basics, understanding how to move between directories, check your current location, and create new directories is crucial for efficient command-line use.

In the world of Linux, navigating the filesystem and managing directories is very imporant skill. In this tutorial, we’ll cover three essential Linux commands: cd, pwd, and mkdir. These commands form the foundation of directory navigation and organization in a Linux environment, and mastering them will help you become more comfortable working with the terminal. Let’s dive into how each command works and how you can use them effectively.

Directories Navigation: pwd / cd

To print current directory:

pwd

To navigate directories and change the current working directory:

cd directory_name

List of Files and Directories: ls

List content fo directories:

ls

Output:

appl  bin  boot  dev  etc  home  install  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

Long listing:

ls -l

Output:

root@nginx:/# ls -l
total 2097236
lrwxrwxrwx   1 root root          7 Apr 22  2024 bin -> usr/bin
drwxr-xr-x   2 root root       4096 Feb 26  2024 bin.usr-is-merged
drwxr-xr-x   4 root root       4096 Jan 15 13:21 boot
dr-xr-xr-x   2 root root       4096 Apr 23  2024 cdrom
drwxr-xr-x  20 root root       4100 Jan 16 13:19 dev
drwxr-xr-x 113 root root       4096 Jan 15 13:20 etc
drwxr-xr-x   3 root root       4096 Aug  8 09:05 home
lrwxrwxrwx   1 root root          7 Apr 22  2024 lib -> usr/lib
lrwxrwxrwx   1 root root          9 Apr 22  2024 lib64 -> usr/lib64
drwxr-xr-x   2 root root       4096 Feb 26  2024 lib.usr-is-merged
drwx------   2 root root      16384 Aug  8 07:14 lost+found
drwxr-xr-x   2 root root       4096 Apr 23  2024 media
drwxr-xr-x   2 root root       4096 Apr 23  2024 mnt
drwxr-xr-x   2 root root       4096 Apr 23  2024 opt
dr-xr-xr-x 220 root root          0 Jan 16 13:19 proc
drwx------   4 root root       4096 Sep 13 12:37 root
drwxr-xr-x  27 root root        860 Jan 16 13:20 run
lrwxrwxrwx   1 root root          8 Apr 22  2024 sbin -> usr/sbin
drwxr-xr-x   2 root root       4096 Apr  3  2024 sbin.usr-is-merged
drwxr-xr-x   2 root root       4096 Aug  8 09:05 snap
drwxr-xr-x   2 root root       4096 Apr 23  2024 srv
-rw-------   1 root root 2147483648 Aug  8 07:30 swap.img
dr-xr-xr-x  13 root root          0 Jan 16 13:19 sys
drwxrwxrwt  12 root root       4096 Jan 16 13:20 tmp
drwxr-xr-x  12 root root       4096 Apr 23  2024 usr
drwxr-xr-x  14 root root       4096 Sep 13 10:54 var

If you need to check hidden files execute the following command:

ls -a

Directory Creation: mkdir (make directory)

The basic syntax of the mkdir command is as follows:

mkdir [OPTION]... DIRECTORY...
  • OPTION: Represents various flags that alter the command’s behavior.
  • DIRECTORY: Specifies the name(s) of the directory(ies) you wish to create.

Basic Usage

Create directory:

mkdir directory_name

Useful Options with mkdir

  • -p (Parents)
mkdir -p parent/child/grandchild

This command creates the parent, child, and grandchild directories in one go.

  • -v (Verbose)
mkdir -v newdir

Output:

mkdir: created directory 'newdir'
  • –m (Mode)
mkdir -m 755 newdir

This command creates newdir with permissions set to 755 (rwxr-xr-x).

rm directory (remove directory)

The basic syntax of the rm command is as follows:

rm [OPTION]... FILE...
  • OPTION: Represents various flags that alter the command’s behavior.
  • FILE: Specifies the name(s) of the file(s) or directory(ies) you wish to delete.

Basic Usage

rm file.txt

Useful options with rm

  • -r (Recursive)
# Remove directory and content
rm -r directory
  • -f (Force)
rm -f file.txt

The -f option forces the removal of files or directories without prompting for confirmation. This is useful for scripts or automated tasks.

  • -i (Interactive)

The -i option prompts for confirmation before each file is deleted. For example:

rm -i file1.txt file2.txt

This command prompts you before deleting each file.

defencedev.com

Previous Post

Install Ubuntu 22.04 on Oracle VM Virtual Box

Next Post

Create and Read Files in Linux with touch, cat, and less

neo

Related Posts

10+ Useful Linux find Command Examples You Should Know
Commands

10+ Useful Linux find Command Examples You Should Know

Check Disk Usage on the Linux with du Command
Commands

Check Disk Usage on the Linux with du Command

Linux Process, List all Running Services with ps Command
Commands

Check Running Processes and Services in Linux via ps

Descripton for kill command on Ubuntu
Commands

Linux Process Management, kill Command

Linux Files Operation: chwon (Change Ownership of The Files)
Commands

Linux Files Operation: chown (Change Ownership of the Files)

Linux Files Operation: grep, Efficient Text Search
Commands

Linux Files Operation: grep, Efficient Text Search

Next Post
Linux Files Operation: touch, cat, less - Read Content of Files

Create and Read Files in Linux with touch, cat, and less

Recommended

Linux Real-Time Performance (CPU, Memory Usage) Metrics with htop, atop, nload, and iostat

Linux Real-Time Performance (CPU, Memory Usage) Metrics with htop, atop, nload, and iostat

Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu

Linux Networking: ifconfig, Managing Network Interfaces on Ubuntu

My Top 5 Applications to Run on Raspberry Pi with Ubuntu

My Top 5 Applications to Run on Raspberry Pi with Ubuntu (2026)

Maximizing Network Efficiency with AdGuard: My 7-Day Results

Maximizing Network Efficiency with AdGuard: My 7-Day Results

FortiGate Brute Force Protection: Ban IPs After Failed Admin Login

FortiGate Brute Force Protection: Ban IPs After Failed Admin Login

Categories

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos
  • Web Tools

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Recent News

My Top 5 Applications to Run on Raspberry Pi with Ubuntu

My Top 5 Applications to Run on Raspberry Pi with Ubuntu (2026)

Maximizing Network Efficiency with AdGuard: My 7-Day Results

Maximizing Network Efficiency with AdGuard: My 7-Day Results

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools

© 2025 defencedev.com - All rights reserved.