How to Moving Files in Linux?

How to Moving Files in Linux?

If you are a Web Developer, you may need to move a file to another directory. In Windows and other desktop operating systems, the file sharing and moving process is easy. If you try the same method on a Linux server, it may seem complicated. It's easy on desktop environments like Gnome Desktop, KDE Plasma, and others. However, it's not possible for all file directories. Today, I can provide information about how to move files on Linux using the Terminal.

Before starting with the Terminal method, let's understand how to move files when using a desktop interface. Try to move with the copy-paste method to move a file. Open two different windows of the File Manager. In the first window, go to the directory where the file is available. In the second window, go to the directory where you want to move the file. Drag the file from the first window to the second window. By following this, you can make a file shortcut on the desktop.

Moving Files on Linux using Terminal

Moving files on Linux using Terminal is very helpful when you are using a Linux operating system. For moving any file to another directory, you need to use the 'mv' command. It allows moving any file to the root directory or from the root directory to local storage or user directory.

For example, if I have a file 'file.txt' available on my Desktop and I want to move this file to the inet70 directory, I can input the given command in the terminal.

$ mv file.txt ~/Desktop/inet70
inet70@inet70pvtltd:~/Desktop$ ls
file.txt  inet70
inet70@inet70pvtltd:~/Desktop$ mv file.txt ~/Desktop/inet70
inet70@inet70pvtltd:~/Desktop$ ls ~/Desktop/inet70/
file.txt
inet70@inet70pvtltd:~/Desktop$ 

This is most helpful and it can give you the ability to move this file to the root directory easily with this command. It's not only for moving a single file at one time, it's capable of moving multiple files.

$ mv file1.txt file2.txt ~/Desktop/inet70
inet70@inet70pvtltd:~/Desktop$ ls
file1.txt  file2.txt  inet70
inet70@inet70pvtltd:~/Desktop$ mv file1.txt file2.txt ~/Desktop/inet70
inet70@inet70pvtltd:~/Desktop$ ls ~/Desktop/inet70
file1.txt  file2.txt
inet70@inet70pvtltd:~/Desktop$ 

From the second command, I can move two files to the Documents folder. You can see from the given screenshot.

If you like this content and you would like to read more of this type, you can subscribe to this platform.