Managing Your Files
Files are the meat and potatoes of any computer, and they need to be managed, copied, moved, renamed, grouped, and loaded. Included with Ubuntu is a powerful yet simple file manager called Nautilus that integrates tightly into your desktop.
Nautilus makes extensive use of drag and drop. Unlike the kind of file manager used in Windows with its tree view and listing of files, Nautilus displays files in a series of windows in which you can drag files around easily. For those who just can't say goodbye to the tree view, Nautilus also supports that. Aside from providing a simpler user interface, Nautilus also includes a number of useful features such as video and image previews, emblems, bookmarks, permissions management, and more.
How Linux Stores and Organizes Files
Before we use Nautilus it would be worthwhile to have a crash course in how files and folders are organized on a Linux system. If you have not used Linux before, this is likely to be new to you as the layout is quite different from Windows and Mac OS X.
In the Windows world each disk drive is labeled with an identifying letter such as C: for your hard disk and A: for the floppy drive. In the Linux world, however, everything is part of the same file system organization. As such, if you have two or three hard disks, a CD drive, and USB stick all plugged in, they will all be part of the same folder structure.
The diagram shown in Figure 3-39 should give you an idea of how everything hangs together.
Figure 3-39 Linux file system organization.
Right at the top of the tree is the root folder, referred to as /. Inside this folder there are a number of special system folders, each with a specific use. As an example, the /home folder contains a number of home directories for each user on the system. As such, the jono user account has the home folder set to /home/jono.
Which Folder Does What?
The folder structure in a modern Linux distribution such as Ubuntu was largely inspired by the original Unix foundations that were created by men with large beards and sensible sweaters. Although you don't really need to know what these folders do, since Ubuntu looks after the housekeeping for you, some of you may be interested in the more important folders. For your pleasure, we present the Linux folder hit list in Table 3-1.
Table 3-1. Linux Folders
Folder |
Use |
/boot |
Contains important files to boot the computer including the bootloader configuration and the kernel. |
/dev |
Each device on your system (such as sound cards, Webcams, etc.) has an entry in this folder. Each application accesses the device by using the relevant items inside /dev. |
/etc |
Systemwide configuration files for the software installed on your system are stored here. |
/home |
Each user account on the system has a home directory, and they are stored here. |
/lib |
Important system software libraries are stored here. You should never need to delve into this world of the unknown. |
/media |
Media devices such as CD drives and USB sticks are referenced here when they are plugged in. More on this later. |
/mnt |
Other devices can be mounted later. Again, more on this later. |
/opt |
Optional software can be installed here. This folder is usually used when you want to build your own software. If you don't build your own software, you ignore this folder. |
/proc /sys |
Information about the current running status of the system is stored here. |
/root |
This is the home directory for the main superuser. |
/sbin |
Software that should only be run by the superuser is stored here. |
/usr |
General software is installed here. |
/var |
This folder contains log files about the software on your computer. |
Configuration Files
In the table, /etc is described as storing systemwide configuration files for your computer. Aside from these files that affect everyone, there are also configuration files for each specific user. Earlier, when you customized Ubuntu's look and feel, the settings were only applied to your current user account. So where are those settings stored?
Inside your home directory there are a number of folders that begin with a dot (.) such as .gnome2 and .openoffice2. These folders contain the configuration settings for specific applications for that specific user. By default these dot folders are hidden in Nautilus, as you rarely need to access them. For future reference you can view these hidden files and folders by clicking View > Show Hidden Files.
You can start Nautilus from a number of different places such as Applications > Accessories > File Browser or more commonly by clicking Places > Home Folder to load your home folder. When the folder loads, you should see something similar to what is shown in Figure 3-40.
Figure 3-40 Accessing your home folder files is as simple as clicking Places > Home Folder.
The Nautilus window is split into two different parts. The sidebar shows categories of information such as bookmarks, folders, emblems (more on these later), and more. In the main part of the window you can see the subfolders and files in the current folder. By default, Nautilus displays your bookmarks in the left sidebar and displays the contents of your home folder.
So, let's play with Nautilus and see what you can do with it. The first important skills to learn are general file management. Many of the tasks you need to do can be achieved by right-clicking your file/folder and selecting the relevant option. There are also a number of options in the Edit menu.
First create a folder. Do this by right-clicking the main part of the window and selecting Create Folder. A folder is added, and you can type in the name of it. If you change your mind about the name, rename it by right-clicking and selecting Rename. If you double-click on a folder, you can access it and perform the same operations in that subfolder.
Nautilus is also flexible in how your files are displayed. You can view the files and folders as either the default collection of icons or as a list. To switch to the list view, select View > View As List. You can also configure the organization of how your files and folders are displayed by right-clicking the main part of the window and selecting one of the options in the Arrange Items menu. Play with each of these options to see which ones work best for you.
Selecting, Copying, and Moving Files/Folders
Copying and moving files and folders are simple with Nautilus and can be done in a number of different ways. To test this, create two folders in your home directory called Work and Invoices. Save some files inside each folder. You can quickly create empty files by double-clicking the folder to go into it, right-clicking, selecting Create Document > Empty File, and renaming the file to something useful. With a couple of folders now complete with files in them, let's move them around.
One method is to use two windows. Right-click the Work folder, and select Open in New Window. You now have two windows open, one with the contents of Work and one with the contents of your home directory. Now copy the Invoices folder to the Work folder by clicking it and dragging it over to the second window (which shows the contents of Work). By default, dragging from one window to another copies the item.
Another option is to select what you want to copy and paste it. Selecting items can again be done in a number of ways. One method is to click each file/folder while holding down the Shift or Ctrl keys to make multiple selections. The difference between the two keys is that Shift will allow you select a number of files/folders next to each other and Ctrl selects independent files and folders from anywhere in the folder-listing view. When you have selected what should be copied, right-click and select Cut or Copy. Cut will copy the original files but remove them and Copy will just copy them while leaving the original files intact. Now go to the destination folder, right-click it, and select Paste. The files/folders are now added.
Using the Sidebar
The sidebar in Nautilus can be changed to a variety of different views that should cater to virtually all tastes. Each of these different sidebar views has a range of different functions. Table 3-2 explains each one.
Table 3-2. The Different Nautilus Sidebar Options
Option |
Feature |
Places |
This is the default view and includes the devices and bookmarks in the sidebar that you typically see in the file chooser. |
Information |
Displays some limited information about the current folder. |
Tree |
Displays a tree view similar to Windows/Mac OS X. Those of you who love the way Windows/Mac OS X works may want to use this. |
History |
Displays a history of the folders that you have clicked on. |
Notes |
This useful little feature allows you to write notes in the sidebar that are stored in the folder. This is handy when you need to explain or make comments about the current folder. |
Emblems |
List the files and folders that have specific emblems attached. Emblems are discussed separately. |
Although you will no doubt stick with one in particular, it is not uncommon to switch between options to achieve a particular task. For this reason, the flexibility provided by the range of sidebar options is useful.
Using Emblems
Emblems give you the ability to tag files and folders to indicate something. These small graphical icons are used to say that the file/folder falls into a particular category, visually signified by the emblem. As an example, you may want to tag a file to indicate it is a draft.
When you select the Emblems sidebar, a range of different emblems appears. To apply an emblem to a file/folder, just drag the emblem onto it. You can drag multiple emblems onto the files to indicate multiple things.