Ubuntu: Create, copy, delete folders - this is how it works in the terminal
Related Videos: Linux/Mac Terminal Tutorial: Create, Copy, Move, Rename and Delete Files and Directories (May 2024).
With the terminal you can manage the folder structure of your system in Ubuntu. For example, it can be used to copy, delete and create folders. We show you which commands you need for the actions.
Ubuntu: Manage folders in the terminal
Managing the folders with your terminal is not much more difficult than with a click of the mouse. You just need to know the right commands:
- Start the terminal and navigate to the location where you want to create a new folder. If you are not yet familiar with the shell commands, we will show you an overview of the most important commands for the terminal.
- In the example (see screenshot) the folder "Downloads / Practical Tip" was jumped to. The new folder "Test" should now be created there.
- This works with the "mkdir" command, which stands for "make directory". So the command is complete: "mkdir test".
- If you want to copy this folder into another directory, you can use the tool "cp" (short form for "copy"). The general syntax of the command is: "cp -r SOURCE TARGET".
- The parameter "-r" stands for "recursive" and therefore means that all files and subdirectories within the folder should also be copied.
- In the example, the "Test" folder just created is to be copied to its "Downloads" subdirectory. The complete command for this is: "cp -r Test ~ / Downloads". Alternatively, in this special case of an over directory, "cp -r Test ../" also works.
- You delete a folder with the command "rmdir" ("remove directory"). If, as in the example, you are in the same directory as the folder to be deleted, the command is simply: "rmdir test". If you are not in the same directory, you must enter the complete path up to "Test".
In the next practical tip we will show you how to install programs using the terminal with Ubuntu.