Linux commands to create files and directories

Here are the Linux commands to create and use files and directories:

cd–Change to another current working directory

pwd–Print the name of the current working directory

mkdir–Create a directory

chmod–Change the permission on a file or directory

ls–List the contents of a directory

The following instructions explain how to create directories within your home directory, move among the directories and set appropriate file permissions:

1) First, go to your home directory by simply typing cd. To check that you are in the home directory, type pwd.

2) Create a new directory called test in your home directory:

$ mkdir test

3) Check the permissions of the directory by typing:

$ ls -ld test

4) To change permissions, use the chmod command:

$ chmod 700 test

This will change the permissions of the directory to give you complete acess and everyone else no access at all.

5) Make the test directory your current directory as follows:

$ cd test

This entry was posted on Monday, January 4th, 2010 at 2:20 pm and is filed under GNU/Linux. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Tags: , , , , , , , , ,

Leave a Reply

Anti-Spam Protection by WP-SpamFree