copy paste in linux

Linux Basics: How to Open, Edit, Copy, and Move Files in Linux


Navigating Linux and handling files effectively is a fundamental part of any Linux user’s skill set. This article will guide you through the process of opening, editing, copying, and moving files within a Linux environment.

Opening Files in Linux

The Linux operating system uses text files extensively for configuration, and opening them is a routine task. You can open a file in Linux using various commands, the most common being cat, less, more, and vi.

Using cat Command

The cat command displays the content of a file on the terminal. Use the following syntax to open a file:


Copy code

cat filename

Using less and more Commands

less and more commands allow you to view the content of a file page by page, which is useful for large files. The syntax for these commands is:

less filename

more filename

Using vi Command

The vi command opens a file in the VI text editor, which is available on almost every Linux distribution. Use the following syntax to open a file:

vi filename

Editing Files in Linux

Linux offers several text editors, such as VI, nano, and emacs, to edit files. Here, we’ll focus on the nano editor due to its simplicity.

Using nano Command

The nano command opens a file in the Nano text editor. Here’s the command syntax:

nano filename

You can navigate the file using arrow keys, and make the necessary changes. To save and exit, press Ctrl + X, then Y, and finally Enter.

Copying Files in Linux

The cp command is used to copy files in Linux. It follows this basic syntax:

cp source_file destination_file

If you want to copy a directory, use the -r (recursive) option:

cp -r source_directory destination_directory

Moving Files in Linux

The mv command in Linux is used to move or rename files. To move a file, use:

mv source_file destination_directory

To rename a file:

mv old_filename new_filename


Mastering file handling in Linux will make your daily tasks easier and more efficient. Remember, Linux is case-sensitive, so always ensure the correct case when typing filenames. Keep practicing these commands until they become second nature.

For more tips and tricks, visit PureVoltage’s blog regularly. We continuously strive to equip you with useful information to enhance your Linux skills.