Featured

    Featured Posts

WORKING WITH FILES

Linux shell provide simple but powerful tools for manipulating files. As with directories, you can move, rename or delete a file. If a file is a text file you can also use tools to edit it. In this chapter, we will describe a couple of command that can help you work with files in a Linux environment.
Creating files
There are several ways to create a file in Linux. The most common way to create a file in Linux is to use the touch command. Although the primary purpose of this command is to update the timestamp of a file, it is often used to create one. The syntax is simple: you just type touch followed by the name of the file. If the file doesn’t exist, the new empty file is created.
Here is an example:
linux touch command
As you can see in the picture above, a file called “new_file” is created.
Deleting files
To delete a file the rm command is used. The syntax: rm FILE_NAME
Example:
 linux rm command
The picture above shows us that a file called “new_file” has been deleted.
Displaying the content of a file
There are many tools in Linux to display the content of a file. One of the most commonly used ones is the less program. This program displays a file’s contents one screen at a time. You can navigate the file by using arrow keys or the mouse wheel.
The usage is simple: just type the less command, followed with the name of the file you would like to display.
linux less command
In the picture above we can see the content of the file named textfile.txt.
author

Author Name

Author Description!

Get Free Email Updates to your Inbox!

Post a Comment

www.ccna.ma

yu
Powered by Blogger.

Translate

Copyright © Learn Linux Th3pro.xyz | Blogger Templates | Designed By Code TAOUSSI