How to Create a File or Directory in Linux using Commands

This post will show you how to create new folders or directories within Linux using the command line.
mkdir command is used to create directory in Linux.

How To Create Directory In Linux

Use following syntax to create Directory in Linux.
mkdir <directoryname>
Ex. mkdir directoryname
Sometimes, there is a need to change permission of directory. You must know how to change permission of Directory in Linux

How To Create A Directory And Set Permissions At The Same Time

chmod command is used to change permission.
Ex. chmod -m777 directoryname
In above example, chmod command used to change permission of file, -m for modify, 777 is the permission, where user, group and others have full permission of Directory, filename is the name of directory for which you want to change permission.

How To Create File In Linux

touch command is used to create File in Linux. To create file in Linux use following syntax.
touch <filename>
Ex. touch filename

How To Check Permission

Permission of File and Directory is very important factor in Linux. Permission is required to allow or deny users to access particular file. ls command is used to check file permission.
ls -l /filename
Ex. ls -l file
In above example, ls means list, -l to check permission and /filename is the name of file we want to check file permissions.

Related Posts:

 

Most Reading