Table 2-8 shows commands to create and use files and directories.
TABLE 2-8
Commands to Create and Use Files
Command Result
cd Change to another directory.
pwd Print the name of the current (or present) working directory.
mkdir Create a directory.
chmod Change the permissions on a file or directory.
ls List the contents of a directory.
The following steps lead you through creating directories within your home directory and moving
among your directories, with a mention of setting appropriate file permissions:
1. Go to your home directory. To do this, simply type cd. (For other ways of referring to
your home directory, see the sidebar ???Identifying Directories???.)
2. To make sure that you??™re in your home directory, type pwd. When I do this, I get the following
response (yours will reflect your home directory):
$ pwd
/home/chris
3. Create a new directory called test in your home directory, as follows:
$ mkdir test
4. Check the permissions of the directory:
$ ls -ld test
drwxr-xr-x 2 chris sales 1024 Jan 24 12:17 test
This listing shows that test is a directory (d). The d is followed by the permissions
(rwxr-xr-x), which are explained later in the section ???Understanding File Permissions.???
The rest of the information indicates the owner (chris), the group (sales), and the date
that the files in the directory were most recently modified (Jan.
Pages:
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224