Creating a Linux File with Touch

To create an empty file called testfile within your current directory, use the following command:

To edit this file, you must use a text editor.

You can create a file in a different location by changing what is after touch. To create a new file in /home/hadi/testdirectory, if you are already in your home directory, you can use the following:

Of from anywhere using an absolute path, you can use this:

Or from anywhere using a path shortcut, you can use the following command:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s