How to Move Files on Ubuntu: GUI & Terminal Methods for Beginners & Intermediate Users

1. Introduction

Ubuntu is a Linux distribution favored by many users for its balance of usability and flexibility. Particularly for developers and system administrators, managing files is one of the routine tasks.

In this article, we explain how to move files in an Ubuntu environment, targeting users from beginners to intermediate. By covering both GUI (Graphical User Interface) and CLI (Command Line Interface) approaches, we enable users to choose the method that fits their skill level or preference.

By reading this article, you will acquire skills such as:

  • Spostamento semplice di file tramite GUI
  • Operazioni flessibili usando il comando mv
  • Precauzioni e contromisure per i permessi e gli errori

Now, let’s dive into the detailed methods for moving files on Ubuntu.

2. Moving Files Using the GUI

Ubuntu provides GUI tools to perform file operations intuitively. In this section, we introduce how to move files using the default file manager “Files.”

2.1 Launching the File Manager

The Ubuntu file manager is called “Files.” Here are the steps to launch it:

  1. Fai clic sull’icona “Files” nella barra delle attività a sinistra.
  2. In alternativa, premi il tasto “Super” (equivalente al tasto Windows), fai apparire la barra di ricerca, digita “Files” e premi Invio.

Then the file manager will open, allowing you to visually navigate directories and perform operations.

2.2 Moving Files by Drag & Drop

The simplest way to move files or folders is via drag & drop. Perform the following steps:

  1. Nel file manager, fai clic per selezionare il/i file o la/i cartella/e che desideri spostare.
  2. Apri la cartella di destinazione in un’altra finestra o nella stessa finestra.
  3. Trascina gli elementi selezionati e rilasciali nella destinazione.

This will move the selected item(s) to the target location.

2.3 Moving Files via Copy & Paste

Another handy method is to use copy & paste. Please follow these steps:

  1. Fai clic con il pulsante destro del mouse sul file che vuoi spostare e seleziona “Taglia.”
  2. Apri la cartella di destinazione, fai clic con il pulsante destro del mouse e seleziona “Incolla.”

You can also use keyboard shortcuts:

  • Taglia: Ctrl + X
  • Copia: Ctrl + C
  • Paste: Ctrl + V

This allows efficient operations even if you are less comfortable with mouse operations.

3. Moving Files via Terminal

On Ubuntu, you can move files or folders efficiently using the terminal. In this section, we explain the basic usage of the mv command and useful options.

3.1 Basics of the mv Command

To move files in the terminal, use the mv command. This command stands for “move,” and can also be used to rename files.

Basic syntax:

mv [options] source destination
  • source: percorso del file o della cartella da spostare
  • destinazione: percorso della posizione di destinazione

Example:

mv file1.txt /home/user/Documents/

In this example, file1.txt in the current directory is moved to the Documents folder.

3.2 Moving Files

Move a file to another folder:

mv example.txt /home/user/Desktop/

This command moves example.txt to the Desktop folder.

Move multiple files at once:

mv file1.txt file2.txt /home/user/Documents/

Here, two files are moved simultaneously into the Documents directory.

3.3 Moving Directories

You can move directories similarly.

Move a folder to another location:

mv folder1 /home/user/Documents/

This command moves folder1 into the Documents folder.

Move contents of a folder:

mv folder1/* /home/user/Documents/

This moves all files and subfolders inside folder1 into Documents.

3.4 Renaming Files or Directories

Rename a file:

mv oldname.txt newname.txt

This renames oldname.txt to newname.txt.

Rename a folder:

mv oldfolder newfolder

The folder can be renamed similarly.

3.5 Common Options for mv

-i (interactive overwrite confirmation)

mv -i file1.txt /home/user/Documents/

If a file with the same name exists at the destination, you will be asked for confirmation before overwriting.

-f (force overwrite)

mv -f file1.txt /home/user/Documents/

This overwrites without asking.

-n (no overwrite)

mv -n file1.txt /home/user/Documents/

If a file with the same name already exists, the move is skipped.

-v (verbose)

mv -v file1.txt /home/user/Documents/

This option prints the process of moving to the console.

By combining these options, you can perform file operations flexibly according to your needs.

4. Precautions and Best Practices

When moving files on Ubuntu, you should pay attention to risks such as overwriting and permissions. In this section, we introduce points to avoid trouble and how to work effectively.

4.1 Overwrite Risk and How to Prevent It

Overwrite risk when moving files:
Using mv, if a file with the same name exists in the destination, it will be overwritten automatically. This can lead to unintended data loss.

Countermeasures:

  1. Sposta con conferma di sovrascrittura (opzione -i)
mv -i file1.txt /home/user/Documents/

→ You’ll be asked whether to overwrite, making operations safer.

  1. Nessuna sovrascrittura (opzione -n)
mv -n file1.txt /home/user/Documents/

→ If a same-named file exists, the move is skipped.

  1. Fai un backup prima di sovrascrivere
cp file1.txt file1_backup.txt

→ By backing up beforehand, you can guard against data loss.

4.2 Permission-Related Considerations

Permission errors:
When attempting to move system files or files owned by other users, you may get a “Permission denied” error.

Countermeasures:

  1. Verifica i permessi del file:
ls -l file1.txt

→ Check ownership and permissions.

  1. Change permissions:
sudo chmod 755 file1.txt

→ Grant read, write, execute permissions as needed.

  1. Operare come amministratore:
sudo mv file1.txt /etc/config/

→ Using sudo grants administrative privileges, but be careful when handling system files.

4.3 Handling Symbolic Links

A symbolic link is a reference (shortcut) to a file or directory. When you move a symlink with mv, only the link itself is moved, not its target.

Be cautious when dealing with links:

mv link1.txt /home/user/Documents/

→ Only the link is moved, which may break the link if the target is elsewhere.

Countermeasure:

  • Se vuoi spostare il file effettivo, controlla l’obiettivo del link.
ls -l link1.txt
  • Opzionalmente, copia la destinazione effettiva prima di spostare:
cp /path/to/target.txt /home/user/Documents/

4.4 Moving Between Different Filesystems

When moving across partitions or devices:
The mv command normally performs a “move” operation, but when the source and destination lie on different filesystems, it effectively does a “copy & delete.” For large amounts of data, this behavior requires caution.

Countermeasures:

  1. Copia prima, verifica, poi elimina:
cp -r folder1 /media/usb-drive/
rm -r folder1

→ After confirming the data moved, remove the original files.

  1. Usa rsync per spostare:
rsync -av --remove-source-files folder1/ /media/usb-drive/

→ This command copies and then deletes the original automatically, which is useful for large datasets.

By understanding these precautions and best practices, you can avoid trouble when moving files and work safely and efficiently.

5. Conclusion

In this article, we have explained how to move files on Ubuntu using both GUI and CLI approaches in detail. We organized the characteristics and advantages of each method to provide useful information for a range of users from beginners to intermediate.

Summary of Key Points

  1. Uso dell’interfaccia grafica per lo spostamento dei file:
  • Usa drag & drop o copy & paste per eseguire operazioni visivamente e facilmente.
  • È intuitivo e aiuta a prevenire gli errori, rendendolo consigliato per i principianti.
  1. Utilizzo del Terminale (CLI) per lo spostamento dei file:
  • Sfrutta il comando mv per operazioni avanzate e elaborazione batch.
  • Combina le opzioni (-i, -f, -n, -v) per ridurre al minimo i rischi durante l’esecuzione dei tuoi compiti.
  1. Precauzioni & Migliori Pratiche:
  • Usa opzioni o backup per evitare sovrascritture non intenzionali.
  • Sii attento agli errori di permesso, alla gestione dei collegamenti simbolici e ai movimenti tra sistemi di file; usa sudo o rsync a seconda del caso.

Which method should you choose?

  • Per i principianti: Il gestore di file GUI è semplice e meno soggetto a errori, quindi è preferito.
  • Per utenti intermedi e oltre: Una volta a proprio agio con il terminale, le operazioni basate su CLI sono più veloci e flessibili. Usa la CLI soprattutto per spostamenti di dati in blocco o flussi di lavoro scriptati.

Next Steps

Take advantage of this knowledge and learn these advanced skills:

  • Scrittura di script di automazione:
    Usa mv negli script batch per puntare a una gestione efficiente dei file.
  • Collegamento con l’archiviazione cloud:
    Collega il tuo ambiente Ubuntu a Google Drive o Dropbox per imparare la gestione dei file remoti.
  • Utilizzando script shell:
    Automatizza le operazioni quotidiane o configura backup regolari con script.

Finally

File management in Ubuntu combines flexibility and efficiency by using both GUI and CLI methods. Use the techniques introduced in this article, and discover which approach best fits your workflow. We will continue delivering useful tips and methods for Ubuntu and Linux topics—please stay tuned!

年収訴求