Up to $140 off-Lowest  Prices of 2024(Nov.21-Dec.2)

My Computer Tips

Home | About | Categories | All Tips & Tutorials

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

ID: 179

Category: Linux Terminal

Added: 16th of August 2020

Views: 2,836

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

Related Tips & Tutorials

Linux mv command, move files and folders using the terminal