In: Computer Science
Linux
Use touch to create a file in your working directory called PutFileHere
this is a linux question i acidentally put javascript when i first submitted it
Following Linux Command can be used :
* To Print the Present working directory - pwd
* To List the contents of your current (present) directory - ls
* To get more details about the file you can use long listing command ll or ls -l command .
* To change the current working directory - cd
* Easiest way to create a new file in Linux is by :
cat command: It is used to create the file with
content
touch command: It is used to create a file without
any content. The file created using touch command is empty. This
command can be used when, at the time of file creation, the user
does not have data to store.
Following is the command's generic syntax:
touch [OPTION]... FILE...
# Touch command to create single file:
Syntax:
touch file_name
# Touch command to create multiple files:
You can use Touch Command to create multiple files at the same time. These files would be empty while creation.
Syntax:
touch File1_name File2_name File3_name
Touch Command Options
-a, used to change the access time only
-c, if the file does not exist, do not create
it.(If you want to just update the access time of existing file,
without creating it)
-d, used to update the access and modification
times
-m, used to change the modification time
only
-r, use the access and modification times of
file
-t, used to creates a file using a specified
time
So, For creating a file in your working directory
called PutFileHere. We must use touch command.
Here PutFileHere is the Directory, so we need to be inside PutFileHere directory and then create a file in there.
Commands:
cd PutFileHere // to move in to PutFileHere folder(directory).
touch File1 // Here 'File1' is the name of the file to be created in PutFileHere folder(directory) .