My Computer Tips

My Computer tips has over 290 tutorials and tips.

Valid CSS!

Categories

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: 3,187

Related Tips & Tutorials

Linux mv command, move files and folders using the terminal

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