< Day Day Up > |
9.13.1 ProblemYou want to organize your files by placing them in directories. But where do directories come from? For that matter, how do you create a file? 9.13.2 SolutionUse mkdir and touch. mkdir creates directories. Mind your filepaths! This comand creates a new subdirectory in the current directory: $ mkdir photos This creates a new top-level directory. Only the superuser can do this: # mkdir /local_bins You can set permissions when you create a directory: # mkdir -m 755 /shared To create a subdirectory and all of its parent directories at once, use the -p flag: $ mkdir -p photos/scanned/jpgs/thumbs Most files are created by a program, such as a word processor, image editor, or compiler. You can also create a new, empty file with touch: $ touch newfile.txt 9.13.3 Discussiontouch is useful in scripting, when you need the script to create a new file. It's also useful for creating placeholders, or for populating a directory for testing things. 9.13.4 See Also
|
< Day Day Up > |