Create directories and files in Linux

This is on of basic operations and first thing that you learn when start using Linux. First of all I will create directories and files through terminal commands, without using any GUI.

With cd .. navigate to location where you want to create directories or files. For example you want to do it in home directory, navigate to there with:

something@ubuntu:~$cd home/

Then create test_dir directory using mkdir commands:

something@ubuntu:~/home$mkdir test_dir

Verify creation by going back one step with cd .. and then type ls. You will receive output with list of directories inside home directory.

Now with cd test_dir/ navigate to test_dir where you will create text file using cat > command:

cat >test_file.txt

By default, file will be opened and you need to hold ctrl-c to go back to terminal.

Again type ls under test_dirĀ  in order to verify creation of text file. Now you can start manipulate with security issues, by adding privileges to users.

I hope that this tutorial was informative to you and thank you for visiting this website.



Dejan Dzodan

Dejan Dzodan

IT professional for more then 15 years, mostly in financial institutions but with experience in ISP and retail. Proven in networking and overall infrastructure projects. Cisco instructor.

Leave a Reply

Your email address will not be published. Required fields are marked *

5 + 5 =