1

For example, how would I move a directory called "menu" into the "data" directory? Also, I am using Ubuntu and I am new to all of this so I am unsure.

0

GUI Method:

  • Open file manager, eg Nautilus
  • Right click on the folder and click on Cut
  • Go to desired folder
  • Right click and choose Paste

CLI method: Open Terminal and run:

mv <absolute path of folder to be moved> <absolute path of destination folder>

For example:

mv menu data
  • Thanks and the final thing I want to know is after I perform that task, how do I go into the data directory and list all the files in the current directory? Would it be data -ls? – Ghetto Lisa Sep 30 '18 at 20:24
  • In terminal you can use cd to change directory. ls to list all file in current directory or ls -a (if you need to list hidden files too). It is easier to go to the directory and right on screen and choose Open in Terminal since it will open terminal in current directory. For more, you can read this – Kulfy Sep 30 '18 at 20:28
  • No, it will be ls data. It will be beneficial if you are currently in a directory and want to list files of other directory/sub-directory. – Kulfy Sep 30 '18 at 20:30
0

Introduction

As you are a new user I've created examples with extra narrative.

Nautilus Method

Nautilus is the file manager that comes with Ubuntu. You can recognize it by the file manager icon second from the top of the launcher:

file manager icon.png

Click on the filing cabinet icon to open Nautilus.

Here is a short video on how you would move the directory ~/lisa-menu underneath the directory ~/lisa-data using Nautilus. All files have been created already:

enter image description here

The video shows you

  • The directories lisa-data and lisa-menu.
  • The files are shown within lisa-menu.
  • The files are shown within lisa-data.
  • The directory lisa-menu is highlighted.
  • Right-click mouse action is used to Cut (aka delete to clipboard) the directory lisa-menu.
  • The directory lisa-data is opened by double-clicking on it.
  • Right-click mouse action is used to Paste the deleted directory lisa-menu into the lisa-data directory.

Command Line (CLI) Method

When you open a terminal you go to your home directory:

───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ 

The prompt starts with your name @ your host.

Then the current directory is displayed (~ is shorthand for your home directory).

Then the command prompt is displayed $.


Let's create some directories now:

───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ mkdir lisa-menu
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ mkdir lisa-data
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ ll lisa*
lisa-data:
total 8
drwxrwxr-x  2 rick rick 4096 Sep 30 16:33 ./
drwxr-xr-x 35 rick rick 4096 Sep 30 16:33 ../

lisa-menu:
total 8
drwxrwxr-x  2 rick rick 4096 Sep 30 16:33 ./
drwxr-xr-x 35 rick rick 4096 Sep 30 16:33 ../
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ 

We now have two empty directories ~/lisa-menu and ~/lisa-data

I've displayed the directory contents with the command `ll lisa*

I could have explicitly stated ll ~/lisa* or ll /home/rick/lisa* but when a path isn't given it is relative to the current directory which is ~/ aka /home/rick/


Now lets create some files:

───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ touch lisa-menu/option-a.mnu
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ touch lisa-menu/option-b.mnu
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ touch lisa-data/data-1.dat
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ touch lisa-data/data-2.dat
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ ll lisa*
lisa-data:
total 8
drwxrwxr-x  2 rick rick 4096 Sep 30 16:38 ./
drwxr-xr-x 35 rick rick 4096 Sep 30 16:33 ../
-rw-rw-r--  1 rick rick    0 Sep 30 16:37 data-1.dat
-rw-rw-r--  1 rick rick    0 Sep 30 16:38 data-2.dat

lisa-menu:
total 8
drwxrwxr-x  2 rick rick 4096 Sep 30 16:37 ./
drwxr-xr-x 35 rick rick 4096 Sep 30 16:33 ../
-rw-rw-r--  1 rick rick    0 Sep 30 16:37 option-a.mnu
-rw-rw-r--  1 rick rick    0 Sep 30 16:37 option-b.mnu

touch is a command to create an empty file.

We used touch lisa-menu/option-a.mnu to create the first file.

We could have explicitly stated touch ~/lisa-menu/option-a.mnu instead.

We could have changed to the directory first and then created the file:

cd lisa-menu
touch option-a.mnu

Finally we used ll lisa* to list the contents of ~/lisa-menu and ~lisa-data directories. The four files we created are there.


Now lets explore how to move the files in ~/lisa-data into a new directory ~/lisa-menu/lisa-data

───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ mv lisa-data lisa-menu
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ ll lisa-menu
total 12
drwxrwxr-x  3 rick rick 4096 Sep 30 16:44 ./
drwxr-xr-x 34 rick rick 4096 Sep 30 16:44 ../
drwxrwxr-x  2 rick rick 4096 Sep 30 16:38 lisa-data/
-rw-rw-r--  1 rick rick    0 Sep 30 16:37 option-a.mnu
-rw-rw-r--  1 rick rick    0 Sep 30 16:37 option-b.mnu
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ ll lisa-menu/lisa-data
total 8
drwxrwxr-x 2 rick rick 4096 Sep 30 16:38 ./
drwxrwxr-x 3 rick rick 4096 Sep 30 16:44 ../
-rw-rw-r-- 1 rick rick    0 Sep 30 16:37 data-1.dat
-rw-rw-r-- 1 rick rick    0 Sep 30 16:38 data-2.dat
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ 

We can use the tree command for a graphical representation of lisa-menu and lisa-data:

───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ tree lisa-menu
lisa-menu
├── lisa-data
│   ├── data-1.dat
│   └── data-2.dat
├── option-a.mnu
└── option-b.mnu

1 directory, 4 files
───────────────────────────────────────────────────────────────────────────────────────────
rick@alien:~$ 

Summary

You can repeat these steps on your own machine by opening the terminal with Ctrl+Alt+T. When you are finished type exit and press Enter to close the terminal.

I hope this short introduction is helpful. Don't hesitate to ask questions as we were all new users at one point in time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.