Directory and File Management using Terminal Debian.

Directory & File Management using Terminal Debian.

Our system is built up with directories and files. We’ll focus this discussion in using our home directory.
Most users are working in this directory.
We like to have our own data, documents, pictures, video’s, favorites, etc….
Our system has created a default folder structure as our home directory. It’s look like this example below.
Type in you terminal the bold text during this tutorial.
First of all we must know where we’re working from. Let’s take a look.
Type pwd + enter.
You can see anne’s working directory /home/anne.
Type ls + enter.
The sub directories structure displayed here.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
anne@alfa:~$

In the past we discussed the cd command to navigate through our system.
If you like you can review “Terminal exploration in home directory Debian Wheezy 7” tutorial.
In our example we have already made files in /Documents. Let’s take a look.
Type cd Documents+ enter.
Which files contains the directory Documents?
Type ls -l + enter.
We have files in our directory /Documents.
Notice the extension of the files.
Sometimes it’s not clear to see the extension of files.
We can see the extension with the command file.
Type file + name of the file + enter.
The file is a OpenDocument Text extension displayed in our example.

anne@alfa:~$ cd Documents
anne@alfa:~/Documents$ ls -l
total 44
-rw-r–r– 1 anne anne 24809 Oct 29 19:22 AJourneyIntoTheHeartOfDebianWheezy7..odt
-rw-r–r– 1 anne anne 13496 Oct 25 12:40 TerminalExplorationInHomeDirectoryDebianWheezy7.odt
anne@alfa:~/Documents$ file AJourneyIntoTheHeartOfDebianWheezy7..odt
AJourneyIntoTheHeartOfDebianWheezy7..odt: OpenDocument Text
anne@alfa:~/Documents$

TIP:
Sometimes files can have long names You don’t need to type the whole name, just copy and past it into  your terminal.
You can’t use the ctrl + c and ctrl + v, they’ve other meanings in our terminal!
Highlight the name of the file you prefer and richt click on it, choice copy.
Than type your command + space + richt click and choice paste + enter.
Example displayed below.

Highlight file, right click and click copy.

Capture

Type file + space + right click on the cursor and click paste followed by enter.

Capture1

Here you’ll see the OpenDocument Text extension showed below.

Capture2

We’ve another ls combination to view submaps or files in our home directory at once.
Review the help or man pages for more ls combinations available.
Start from your home directory ~/ (/home/anne)
Type ls -lR + enter.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ ls -lR
.:
total 32
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Desktop
drwxr-xr-x 2 anne anne 4096 Nov  3 13:02 Documents
drwxr-xr-x 2 anne anne 4096 Oct 26 17:58 Downloads
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Music
drwxr-xr-x 2 anne anne 4096 Nov  2 01:02 Pictures
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Public
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Templates
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Videos

. /Desktop:
total 0

. /Documents:
total 68
-rw-r–r– 1 anne anne 24809 Oct 29 19:22 AJourneyIntoTheHeartOfDebianWheezy7..odt
-rw-r–r– 1 anne anne 23685 Nov  2 16:23 DirectoryFileManagementUseTerminalDebianWheezy7..odt
-rw-r–r– 1 anne anne 13496 Oct 25 12:40 TerminalExplorationInHomeDirectoryDebianWheezy7.odt

. /Downloads:
total 0

. /Music:
total 0

. /Pictures:
total 276
-rw-r–r– 1 anne anne  17006 Oct 24 23:00 command1.png
-rw-r–r– 1 anne anne 107714 Oct 18 20:15 debian.png
-rw-r–r– 1 anne anne 149384 Oct 29 19:15 TOP.png

. /Public:
total 0

. /Templates:
total 0

. /Videos:
total 0
anne@alfa:~$

Now we’ll start to create our own directories and files.
Pay attention while naming directories and files! Try to avoid spaces. This will give erro’s like “no such file or directory.”
Let’s say we’ll create a dircetory named gnubizz in our home directory.
For more info about mdir you can advice the man, –help pages.
If you’re not sure about your working directory use the pwd or ls command.
Our working directory must be /home/anne.
Type mkdir + name of directory + enter.
As we can see the new directory Gnubizz.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ mkdir Gnubizz
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$

We’ll make another directory in the Gnubizz.
Go to Gnubizz with the cd command ( cd Gnubizz ).
Create a directory named OpenSource.
Type mkdir + OpenSource + enter.
After that return to your home directory by the syntax cd ~.
To view our subdirectories in our home folder execute ls -lR.
Notice the directory Gnubizz contains the sub directory OpenSource.
The directory OpenSource is a child of the parent directory Gnubizz.

anne@alfa:~$ cd Gnubizz
anne@alfa:~/Gnubizz$ mkdir OpenSource
anne@alfa:~/Gnubizz$ ls
OpenSource
anne@alfa:~/Gnubizz$ cd ~
anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls -lR
.:
total 36
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Desktop
drwxr-xr-x 2 anne anne 4096 Nov  3 13:02 Documents
drwxr-xr-x 2 anne anne 4096 Oct 26 17:58 Downloads
drwxr-xr-x 3 anne anne 4096 Nov  3 14:59 Gnubizz
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Music
drwxr-xr-x 2 anne anne 4096 Nov  2 01:02 Pictures
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Public
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Templates
drwxr-xr-x 2 anne anne 4096 Oct 17 16:25 Videos

. /Desktop:
total 0

. /Documents:
total 68
-rw-r–r– 1 anne anne 24809 Oct 29 19:22 AJourneyIntoTheHeartOfDebianWheezy7..odt
-rw-r–r– 1 anne anne 23685 Nov  2 16:23 DirectoryFileManagementUseTerminalDebianWheezy7..odt
-rw-r–r– 1 anne anne 13496 Oct 25 12:40 TerminalExplorationInHomeDirectoryDebianWheezy7.odt

. /Downloads:
total 0

. /Gnubizz:
total 4
drwxr-xr-x 2 anne anne 4096 Nov  3 14:59 OpenSource

. /Gnubizz/OpenSource:
total 0

. /Music:
total 0

. /Pictures:
total 276
-rw-r–r– 1 anne anne  17006 Oct 24 23:00 command1.png
-rw-r–r– 1 anne anne 107714 Oct 18 20:15 debian.png
-rw-r–r– 1 anne anne 149384 Oct 29 19:15 TOP.png

. /Public:
total 0

. /Templates:
total 0

. /Videos:
total 0
anne@alfa:~$

We we’ll create more directories at once in our directory Gnubizz.
Create two directories named Gnubizz1 and Gnubizz2. Go to directory Gnubizz.
The working directory must by /home/anne/Gnubizz. By any doubts check it by pwd command.
Execute ls and you’ll see three directories Gnubizz1, Gnubizz2 and OpenSource displayed below
Type mkdir Gnubizz1 + space + Gnubizz2 + enter.

anne@alfa:~$ cd Gnubizz
anne@alfa:~/Gnubizz$ pwd
/home/anne/Gnubizz
anne@alfa:~/Gnubizz$ ls
OpenSource
anne@alfa:~/Gnubizz$ mkdir Gnubizz1 Gnubizz2
anne@alfa:~/Gnubizz$ ls
Gnubizz1  Gnubizz2  OpenSource
anne@alfa:~/Gnubizz$

We have seen how we create directories but sometimes we need to rename them.
We’ll rename the OpenSource to OpenSourceComputing.
We’re still in our Gnubizz directory that contains three maps, Gnubizz1  Gnubizz2  OpenSource.
Verify with ls and you w’ll see the name of the directory
OpenSource has changed into OpenSourceComputing.
Type mv + OpenSource + OpenSourceComputing + enter.

anne@alfa:~/Gnubizz$ pwd
/home/anne/Gnubizz
anne@alfa:~/Gnubizz$ ls
Gnubizz1  Gnubizz2  OpenSource
anne@alfa:~/Gnubizz$ mv OpenSource OpenSourceComputing
anne@alfa:~/Gnubizz$ ls
Gnubizz1  Gnubizz2  OpenSourceComputing
anne@alfa:~/Gnubizz$

We’re now able to make and change names of our directories.
Sometime we move them to another directory we like.
We’ll use the same command mv. We w’ll move directories Gnubizz1 and Gnubizz2 into our
OpenSourceComputing directory. First of all we need to known our path to move them.
Let’s see where the directory Gnubizz is located.
Start at your home directory and verify with pwd, /home/anne.
Execute ls to view your directory Gnubizz.
To find out the path of Gnubizz use locate command.
Now you w’ll see the path and submap path aswell of Gnubizz.
Before move directories we need to know the source path and the destination path of our directory.
Our syntax is as followed, mv + source directory + destination directory.
Typ locate + naam of directory + enter.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ locate Gnubizz
/home/anne/Gnubizz
/home/anne/Gnubizz/Gnubizz1
/home/anne/Gnubizz/Gnubizz2
/home/anne/Gnubizz/OpenSource
anne@alfa:~$

Type mv ~/Gnubizz/Gnubizz1 + space + ~/Gnubizz/OpenSourceComputing + enter.
Verify with ls to see if Gnubizz1 has moved into the directory OpenSourceComputing.
Type ls Gnubizz/OpenSourceComputing.+ enter.
Notice Gnubizz1 has moved into OpenSourceComputing.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ locate Gnubizz
/home/anne/Gnubizz
/home/anne/Gnubizz/Gnubizz1
/home/anne/Gnubizz/Gnubizz2
/home/anne/Gnubizz/OpenSource
anne@alfa:~$ mv ~/Gnubizz/Gnubizz1 ~/Gnubizz/OpenSourceComputing
anne@alfa:~$ ls Gnubizz/OpenSourceComputing
Gnubizz1
anne@alfa:~$

We can use the another description of our path to move our second directory Gnubizz2 into OpenSourceComputing.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ locate Gnubizz
/home/anne/Gnubizz
/home/anne/Gnubizz/Gnubizz1
/home/anne/Gnubizz/Gnubizz2
/home/anne/Gnubizz/OpenSource
anne@alfa:~$ mv /home/anne/Gnubizz/Gnubizz2 /home/anne/Gnubizz/OpenSourceComputing
anne@alfa:~$ ls /Gnubizz/OpenSourceComputing
Gnubizz1  Gnubizz2
anne@alfa:~$

Sometimes we can have errors when we check this out.
The best way to check is use the ls command followed by the full path. In this example.
Type ls /home/anne/Gnubizz/OpenSourceComputing + enter.
Now our OpenSourceComputing contains two subdirectories Gnubizz1 and Gnubizz2.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ locate Gnubizz
/home/anne/Gnubizz
/home/anne/Gnubizz/Gnubizz1
/home/anne/Gnubizz/Gnubizz2
/home/anne/Gnubizz/OpenSource
anne@alfa:~$ ls /home/anne/Gnubizz/OpenSourceComputing
Gnubizz1  Gnubizz2
anne@alfa:~$

The other description to the full path

anne@alfa:~$ ls ~/Gnubizz/OpenSourceComputing
Gnubizz1  Gnubizz2
anne@alfa:~$

We have seen how we can view, make, change names and move directories.
We’ll copy the whole directory Gnubizz on our Desktop.
As you have seen our directory Gnubizz contains subdirectory displayed below.
Type ls -R Gnubizz + enter.

anne@alfa:~$ ls -R Gnubizz
Gnubizz:
OpenSourceComputing

Gnubizz/OpenSourceComputing:
Gnubizz1  Gnubizz2

Gnubizz/OpenSourceComputing/Gnubizz1:

Gnubizz/OpenSourceComputing/Gnubizz2:

Now w’ll copy the directory Gnubizz and its contents on our Desktop by using the cp command.
You can advice the cp man or help pages to reveal more info.
Start at your home directory /home/anne.
We must know the source and destination path while using the cp command.
The syntax is as followed cp + source directory path + space  + destination directory path.
The -R will copy the whole directory into our Desktop. Notice the directory Gnubizz is copied into our Desktop.
Now we’ve two same Gnubizz directories, one in our Desktop and the other one in our home directory.
Type cp -R ~/Gnubizz ~/Desktop + enter.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ cp -R ~/Gnubizz ~/Desktop
anne@alfa:~$ ls Desktop
Gnubizz

Check this with the command ls from your home directory.
Notice you’ll see Gnubizz and it’s contents twice by Desktop and Your home directory.

anne@alfa:~$ ls -R
.:
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos

. /Desktop:
Gnubizz

. /Desktop/Gnubizz:
OpenSourceComputing

. /Desktop/Gnubizz/OpenSourceComputing:
Gnubizz1  Gnubizz2

. /Desktop/Gnubizz/OpenSourceComputin /Gnubizz1:

. /Desktop/Gnubizz/OpenSourceComputing/Gnubizz2:

. /Documents:
AJourneyIntoTheHeartOfDebianWheezy7..odt
DirectoryFileManagementUseTerminalDebianWheezy7..odt
TerminalExplorationInHomeDirectoryDebianWheezy7.odt

. /Downloads:

. /Gnubizz:
OpenSourceComputing

. /Gnubizz/OpenSourceComputing:
Gnubizz1  Gnubizz2

. /Gnubizz/OpenSourceComputing/Gnubizz1:

. /Gnubizz/OpenSourceComputing/Gnubizz2:

. /Music:

. /Pictures:
command1.png  debian.png  TOP.png

. /Public:

. /Templates:

. /Videos:
anne@alfa:~$

In our directories we have files. This file can be everything you like, video’s, documents, foto’s, songs etc…..
We have some files stored in our directory Documents and Pictures.
Start at your home directory.
Notice the file extensions stored at Documents and Pictures.
The pictures have the extension png and de documents odt.
Type ls -R + enter.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls -R
.:
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos

. /Desktop:
Gnubizz

. /Desktop/Gnubizz:
OpenSourceComputing

. /Desktop/Gnubizz/OpenSourceComputing:
Gnubizz1  Gnubizz2

. /Desktop/Gnubizz/OpenSourceComputing/Gnubizz1:

. /Desktop/Gnubizz/OpenSourceComputing/Gnubizz2:

. /Documents:
AJourneyIntoTheHeartOfDebianWheezy7..odt  A.odt  TerminalExplorationInHomeDirectoryDebianWheezy7.odt

. /Downloads:

. /Gnubizz:
OpenSourceComputing

. /Gnubizz/OpenSourceComputing:
Gnubizz1  Gnubizz2

. /Gnubizz/OpenSourceComputing/Gnubizz1:

. /Gnubizz/OpenSourceComputing/Gnubizz2:

. /Music:

. /Pictures:
command1.png  debian.png  TOP.png

. /Public:

. /Templates:

. /Videos:
anne@alfa:~$

w’ll make a text file using Pico in our terminal.
Go to the subdirectory Gnubizz in the directory Desktop.
To find the right path to Gnubizz you can use the command locate.
The path is /home/anne/Desktop/Gnubizz.
Type cd /home/anne/Desktop/Gnubizz

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ locate Gnubizz
/home/anne/Gnubizz
/home/anne/Desktop/Gnubizz
/home/anne/Desktop/Gnubizz/OpenSourceComputing
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
/home/anne/Gnubizz/OpenSourceComputing
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz2
anne@alfa:~$ cd /home/anne/Desktop/Gnubizz
anne@alfa:~/Desktop/Gnubizz$

Our purpose is making a file into our Gnubizz directory.
Open Pico in your terminal and type some text you like.
Type pico + enter.

1

When you’re done editing you can press ctrl + x.
After ctrl + x you w’ll be asked what you want. If you like to save your file type Y.
If you press N your file w’ll be lost.

2

You will be asked to fill in your file name. Type your filename and press enter.
We’ve just created our file in Gnubizz.

3

Check in your Gnubizz directory using the ls commad.
Type ls + enter or if you prefer ls -l + enter.
Notice the new file in Gnubizz. In our example you w’ll see  our file named GnubizzSite.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ locate Gnubizz
/home/anne/Gnubizz
/home/anne/Desktop/Gnubizz
/home/anne/Desktop/Gnubizz/OpenSourceComputing
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
/home/anne/Gnubizz/OpenSourceComputing
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz2
anne@alfa:~$ cd /home/anne/Desktop/Gnubizz
anne@alfa:~/Desktop/Gnubizz$ pico
anne@alfa:~/Desktop/Gnubizz$ ls
GnubizzSite  OpenSourceComputing
anne@alfa:~/Desktop/Gnubizz$ ls -l
total 8
-rw-r–r– 1 anne anne  450 Nov  5 18:43 GnubizzSite
drwxr-xr-x 4 anne anne 4096 Nov  4 16:09 OpenSourceComputing
anne@alfa:~/Desktop/Gnubizz$

Check the extension of our new file.
Our file Gnubizzsite has the extension ASCII text displayed below.
Type file GnubizzSite + enter.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ locate Gnubizz
/home/anne/Gnubizz
/home/anne/Desktop/Gnubizz
/home/anne/Desktop/Gnubizz/OpenSourceComputing
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
/home/anne/Gnubizz/OpenSourceComputing
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz2
anne@alfa:~$ cd /home/anne/Desktop/Gnubizz
anne@alfa:~/Desktop/Gnubizz$ pico
anne@alfa:~/Desktop/Gnubizz$ ls
GnubizzSite  OpenSourceComputing
anne@alfa:~/Desktop/Gnubizz$ ls -l
total 8
-rw-r–r– 1 anne anne  450 Nov  5 18:43 GnubizzSite
drwxr-xr-x 4 anne anne 4096 Nov  4 16:09 OpenSourceComputing
anne@alfa:~/Desktop/Gnubizz$ file GnubizzSite
GnubizzSite: ASCII text
anne@alfa:~/Desktop/Gnubizz$

We’ll copy our file GnubizzSite to our subdirectories Gnubizz1 and Gnubizz2 in our Desktop.
Start at your Gnubizz directory and execute the locate command to display the path.
Type locate + Gnubizz1 + space + Gnubizz2 + enter to reveal the full path.
Copy our GnubizzSite file into our two subdirectories Gnubizz1 and Gnubizz2.
Type cp GnubizzSite + space + /home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
Repeat this command for the second directory.
You can use your arrow keys on your board to get your command back again.
Use your up arrow key and only change the 1 of Gbubizz1 to 2 like this:
cp GnubizzSite + space + /home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
Now we’ve three files named GnubizzSite in our dirctories, Gnubizz, Gnubizz1 and Gnubizz2 located in our Desktop.
Check this as followed. Type
ls /home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
and
ls /home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
and one more time.
type ls

anne@alfa:~/Desktop/Gnubizz$ locate Gnubizz1 Gnubizz2
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz2
anne@alfa:~/Desktop/Gnubizz$ ls
GnubizzSite  OpenSourceComputing
anne@alfa:~/Desktop/Gnubizz$ cp GnubizzSite /home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
anne@alfa:~/Desktop/Gnubizz$ cp GnubizzSite /home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
anne@alfa:~/Desktop/Gnubizz$ ls/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
GnubizzSite
anne@alfa:~/Desktop/Gnubizz$ ls/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
GnubizzSite
anne@alfa:~/Desktop/Gnubizz$ ls
GnubizzSite  OpenSourceComputing
anne@alfa:~/Desktop/Gnubizz$

Let’s open our file GnubizzSite in the directory Gnubizz1 in our Desktop. Start in the Gnubizz1 directory.
Type cd/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
Open your file GnubizzSite with pico.
Type Pico GnubizzSite
Modify your file by typing more text you like and save your file using the same name.
How to save your file you can follow the same procedure as the description above.
When you’ve done your modification press ctrl + x and than Y.
Keep the name GnubizzSite and press enter.
Our file is saved again after the modification.

4

We have made, moved, modified, and saved directories and files.
Now we’ll remove our directory Gnubizz in our home directory.
As you know we have two of them, one in our Desktop and one in our Home directory.
Start in the home directoy /home/anne.
Type ls if you’re not sure before removing directories or files.
Be aware when you remove it you can’t get it back!
Type rmdir Gnubizz + enter.
Notice we have a error, we can’t remove it because this directory contains subdirectories. (not displayed here!!)
We we’ll navigate through this directory and remove them.
Let’s do it ;-).
Type cd /home/anne/Gnubizz/OpenSourceComputing
Now we’re in OpenSourceComputing that contains the Gnubizz1 and Gnubizz2. Remove them.
Type rmdir Gnubizz1 Gnubizz2
Verify it with the ls command to see there’re gone now.
Type cd ..
We’re in the directory Gnubizz that contain the directory OpenSourceComputing.
Type rmdir OpenSourceComputing
Check it with ls and you w’ll see it’s gone.
Type cd .. again to go into you home directory.
Verify with ls command.
Type rmdir Gnubizz
Type one more time ls and you w’ll see everything is gone.

anne@alfa:~$ pwd
/home/anne
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ locate Gnubizz
/home/anne/Gnubizz
/home/anne/Desktop/Gnubizz
/home/anne/Desktop/Gnubizz/OpenSourceComputing
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Desktop/Gnubizz/OpenSourceComputing/Gnubizz2
/home/anne/Gnubizz/OpenSourceComputing
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz1
/home/anne/Gnubizz/OpenSourceComputing/Gnubizz2
anne@alfa:~$ cd /home/anne/Gnubizz/OpenSourceComputing
anne@alfa:~/Gnubizz/OpenSourceComputing$ ls
Gnubizz1  Gnubizz2
anne@alfa:~/Gnubizz/OpenSourceComputing$ rmdir Gnubizz1 Gnubizz2
anne@alfa:~/Gnubizz/OpenSourceComputing$ ls
anne@alfa:~/Gnubizz/OpenSourceComputing$ cd ..
anne@alfa:~/Gnubizz$ ls
OpenSourceComputing
anne@alfa:~/Gnubizz$ rmdir OpenSourceComputing
anne@alfa:~/Gnubizz$ ls
anne@alfa:~/Gnubizz$ cd ..
anne@alfa:~$ ls
Desktop  Documents  Downloads  Gnubizz  Music  Pictures  Public  Templates  Videos
anne@alfa:~$ rmdir Gnubizz
anne@alfa:~$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos
anne@alfa:~$

Ok at the first time it’s hard to understand but over time you’ll get used to it.
Just try and play and you will loved it.

This was our journey through home directory.
By any doubts our questions don’t hesitate to leave a comment.
We hope you’ve enjoyed it.
See you next time. ;-)

About these ads

One Response to Directory and File Management using Terminal Debian.

  1. Pingback: Applications and commando’s locations Debian Wheezy 7 | Gnu Bizz 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: