Category: Linux Terminal

Added: 16th of August 2020

Viewed: 2,784 times


Create a new folder and file using the mkdir and touch commands using the terminal in Linux

The first question you might is ask is why you would want to create a new directory and file using the terminal when you can already do this through your file manager on Linux. If you are logged in to a remote Linux machine and don't have access to a remote desktop you can then create this using the terminal.

To create a new directory in Linux using the terminal we can use the mkdir command

mkdir sample_directory


After this we need to CD in to that sample_directory we created
cd sample_directory


To create a new file in Linux using the terminal we can use the touch command
touch sample_file.txt


To list the file in the directory we can use the dir or ls commands
ls