Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

A Quick Introduction to Unix/Creating Files

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Creating Files Files are essentially containers. You can fill a file with a variety of kinds of data, rather as you might fill a bucket with water or sand. There are occasions when the facility to create an empty bucket is useful. The command touch %touch my_new_file This creates a file called my_new_file. One other use of touch is to update a file's date and time. This is done with the option -t. For example %touch -t 201010112230 my_new_file This would update the time and date stamp for the file causing it to show the date and time 11 October 2010 at 22:30. The data and time format is yyyymmddhhmm. You can check the effect of touch with ls -l Why use touch? One very good use for touch is to help create directory and file structures. Suppose that in a university departmental office each year you must create various administrative files. You will need a file of the new students; a file of staff; a file of options offered that year and so on. From your home you might first of all create a directory to hold the student files: % mkdir -p /degreeadmin/2010/students and then to be sure that you have the correct file structure % touch /degreeadmin/2010/students/student_list.txt and similarly for any other files and directories you need.