codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

Ā© 2026 codingstuff.io. All rights reserved.

Built with ā¤ļø for developers everywhere

/
/
All Tutorials
🐧

Linux & Bash

6 / 60 topics
5File System Navigation6Creating Files and Directories7Viewing Files Content8Editing Files9File Permissions10Symbolic Links
Tutorials/Linux & Bash/Creating Files and Directories
🐧Linux & Bash

Creating Files and Directories

Updated 2026-05-15
10 min read

Creating Files and Directories

Introduction

In this tutorial, we will explore how to create new files and directories in a Linux environment. Understanding how to manage files and directories is fundamental for any developer working with Linux systems. This knowledge will help you navigate the file system effectively, organize your work, and perform essential tasks.

Concept

Linux provides several commands to create files and directories. Here are the basic concepts:

  • Files: The smallest unit of data storage in a computer.
  • Directories (or Folders): Containers that hold files and other directories.

The primary commands used for creating these are touch for files and mkdir for directories.

Examples

Creating Files

To create a new file, you can use the touch command. This command creates an empty file if it does not exist or updates the timestamp of the file if it already exists.

Terminal
Output
-rw-r--r-- 1 user group 0 May 15 12:34 newfile.txt

Creating Directories

To create a new directory, you can use the mkdir command. This command creates a new directory with the specified name.

Terminal
Output
drwxr-xr-x 2 user group 4096 May 15 12:35 newdirectory

Creating Multiple Files and Directories

You can create multiple files or directories at once by listing them after the command.

Terminal

This command will create three directories named dir1, dir2, and dir3.

Creating Nested Directories

If you need to create a directory with nested subdirectories, you can use the -p option with mkdir. This option allows you to create parent directories as needed.

Terminal

This command will create a file named newfile.txt inside the grandchild directory. If any of the directories in the path do not exist, you will need to create them first or use the -p option with mkdir.

What's Next?

In the next section, we will learn how to view the contents of files using various commands like cat, less, and more. This knowledge will help you read and understand the data stored in your files.

Stay tuned for more tutorials on Linux file management!


PreviousFile System NavigationNext Viewing Files Content

Recommended Gear

File System NavigationViewing Files Content