Manage Your Files


A file manager is, at heart, merely a graphical way to organize and view your files. Not a lot of innovations can be made in moving files and folders around. With that in mind, you will probably feel right at home in the Linux file managers if you have used Windows or Mac OS. In most computer operating systems, all the data is arranged in a hierarchy of folders (directories) and files. Of course, your data is organized this way because we are all familiar with folders and documents in the physical world.

The Linux File System

Each operating system has its own folder, or directory, hierarchy. You might be familiar with a few of the top-level folders in Windows, such as Program Files. Linux is not so palpable in its naming of the top-level directories. Most of those directories at the top level are ones that you will notand usually should nothave to get into. If you are curious, many pages online (such as the one at http://www.freeos.com/articles/3102/) give lengthy explanations of the purpose of each top-level directory.

You might not want to change anything in the /etc directory or the /var directory, but there are a few files and locations in the Linux file system that are useful to know about. You can sort of mentally bookmark these for reference.

/etc

This is a directory that you shouldn't muck around in unless you know what you're doing, but /etc is a good directory to know about. This is where the most important configuration files for Linux are kept. In extreme problem situations, the fix can be in here. However, unless you think of yourself as something close to an advanced user and have a reason to be there, consider this directory forbidden. Here, I will say it in German, so it sounds more forbidding: Verboten!

UNDER THE HOOD

IS IT A FOLDER OR A DIRECTORY?

It's both. A folder anda directory are used as interchangeable terms. Folder is the friendlier term, invoking images of manila folders on a physical desk. Directory is the more technical term that makes us all feel smarter. I'm going to switch back and forth because, though I am a genius, I am only sometimes smart.


/home/[username]

This is where you live. /home has directories for each of the users on your computer (except the root user). Your home directory is readable only by you and the root user. You can do whatever you want in here. Preference files for many of the programs that you run are also stored here in hidden folders.

/mnt

If you mount another file system or external storage media, such as your Windows disk partition, a floppy disk, or a CD, /mnt is a good place to look for those files. /mnt is the usual place where your OS will give you access to mounted file systems.

/misc

Can't find the file system that you mounted in /mnt? Look in /misc. This is the directory that Fedora sometimes uses to mount file systems to.

/root

You have a home, and so does the root user. But the root user is too good to live in the /home neighborhood where you live. If you run any programs as the root user, most of the preference files will be in here. You shouldn't have to play around in the /root directory much.

/tmp

/tmp means "temporary." This is a handy directory for placing temporary files, especially files that you need to hand off to another user on the computer. You will see some mystery files in the /tmp directory because programs also use the /tmp directory to keep temporary files. Don't bother cleaning it out; Linux can tidy up after itself.

/usr/bin

This directory is on your verboten list of directories not to change things in, but it's a great place to know about when you are looking for programs. /usr/bin is where most of your executable program files are stored. Want to run the command to start a program? This is where Linux finds the command.

/usr/share

The root user owns this directory, but it contains many files that all users share, thus the name. For example, /usr/share/pixmaps is where you will usually find desktop wallpaper and icon files.

Owners and Permissions

Files and directories have ownership and permissions in Linux. These settings determine whether you are allowed to read, write, or execute that object (in the case of programs and scripts). Ownership and permissions are strict. You can't perform a hostile takeover to become the owner of a file. You can't talk your way into reading any file or folder that you are not allowed to read. Ownership is shown by username. Either letters or numbers represent the permissions for a file or folder. The letters and numbers stand for the three aspects of permission: read, write, and execute. Table 2.3 shows the text and number codes for permissions.

Table 2.3. File Permission Text and Number Codes

PERMISSION TYPE

TEXT VIEW

NUMBER VIEW

Read

r

4

Write

w

2

Execute (or Access for directories)

x

1


You can see the permission for an object by right-clicking the file or folder in your file manager and looking at the Permissions tab (shown in Figure 2.10). You should see a section for the permissions with check boxes and a section showing the ownership. Permissions are listed in the order of the permissions for the object's owner, the permissions for members of the group the object belongs to, and permissions for everyone. If you have read and write permissions to the file, you can change some of the permissions for the file. If you are the owner of the file, you can pretty much do whatever you want with that file.

Figure 2.10. File permissions listed in the Nautilus file manager.


You can also see permissions listed in your terminal from the command line. We talk more about the terminal in a bit. You usually don't have to worry about whether you have permissions for a file. Occasionally, however, knowing how to check the permissions can save you a good amount of troubleshooting time. For instance, if you find yourself unable to delete a file or to move a file, check the permissions. If you cannot save changes to a file, check the permissions. Permissions will become more prohibitive when you have to work with files that are outside your home directory.

Konqueror

Program Info

Fedora/GNOME menu

Main menu > Home

(when using KDE)

Mandrake/KDE menu

Main menu > Internet > More Internet Applications > Konqueror

(opens the program in browser mode)

Terminal Command

konqueror

Program URL

http://www.konqueror.org/


In KDE Konqueror is your right-hand .man? woman? window? Anyway, Konqueror is a program you will find yourself using a lot (see Figure 2.11). It's a file manager, a Web browser, and more. Konqueror is your assistant to use when you need to look at your files or copy, move, or delete files.

Figure 2.11. Konqueror as a file manager.


Konqueror isn't all that different from file managers you might have used in Windows or Mac OS. When you open the program as a file manager, you see a menu bar, a tool bar, an address bar, and two panels below those. The menu contains options for working with files and folders, changing locations, bookmarking locations to go to later, and changing the program's settings. To get familiar with the program, go to Settings > Configure Konqueror, and play with the preferences.

The toolbar and address bar in Konqueror have the one-click convenience to perform most of the frequently used functions in the program. The arrow buttons let you move up a directory, back to the directory you were just in, or forward again. The toolbar button with the little house icon is your Home; use this button to go to /home[username], your home directory. The other buttons include a Refresh button for renewing your view of the folder, in case something changed; editing buttons for Copy, Cut, and Paste; and a few buttons for changing the view. In the address bar, you can type in the path of any directory you want to go to and then press Enter.

Files and directories in Konqueror are represented by icons to look like documents and folders. You can usually tell the type of documentwhether it is a text document, an audio file, a picture, and so onby the icon Konqueror uses to show the file. You can right-click any file or folder to see the properties for that object, including permissions, the type of file, and the date that the file was last changed. Having all this information readily available makes managing your files easy.

TOOL KIT 2.1

Create, Rename, Copy, and Move Files in Konqueror

I love to pretend. I was always the weird kid running around pretending to be shot by imaginary robbers. Let's pretend that we are KDE supporters and spies. We have just captured the plans to the next version of GNOME.

Create a Folder and a File

1.

Before we pretend, we have to create something to pretend with. Open Konqueror. Go to your home directory by clicking on the Home icon on the toolbar.

2.

Right-click in the empty white space. On the pop-up menu, choose Create New > Folder. Type in the name for our new folder in the dialog box, SecretPlans. You can also use the Edit menu to get to the Create New choices.

3.

Double-click the new folder, SecretPlans, to go into it. It's empty. We will put something in it. Right-click in the empty white space and go to Create New > File > Text_File. Name that file (see Figure 2.12) StolenGNOMEPlans.txt. You can also use the Edit menu to get to the Create New choices.

Figure 2.12. The blank new file in Konqueror.


Rename a Folder and a File

We've just heard from our KDE intel team that the GNOME people are on to us. They are looking for the plans that we stole. We have to rename the files so they aren't so obvious.

1.

Click once on the file StolenGNOMEPlans.txt to highlight it. From the menus at the top of your window, go to Edit > Rename. You can also right-click the file and choose Rename, press the F2 key, or click the name text of the file.

2.

Type in the new file name, TheresNothingToSeeHere.txt. Press Enter or click in the white space somewhere to exit the text edit mode.

3.

Use either the Up button or the Back button on the toolbar to return to the home directory. Then rename the folder SecretPlans to NothingInteresting using the same method that you used to rename the file.

Copy and Move a Folder and a File

Holy bejeesus! The GNOME team has infiltrated our KDE compound! Scramble! Scramble! Put destruct plan KDestroy58A into motion. (You can't hear me, but I'm making those little kid gun noises right now with my mouth.) Kapow! Bang. We have to hide the evidence of our espionage!

1.

Go to your home directory in Konqueror. Our clever file renaming won't fool the GNOME spies for long. We have to make copies of the folder and its contents as a backup. Right-click the folder NothingInteresting and choose Copy from the pop-up menu. You can also press Ctrl+C or go to the Edit menu.

2.

Right-click in the empty white space and choose Paste. Again, the Edit menu or Ctrl+V would also work. The pop-up box warns you and prompts for a different name. Name the folder KDestroy58A. Click Continue.

3.

We have to move the copied folder to a new location to hide it from the Gnomies. Open a new window in Konqueror by going to the menu Location > New Window.

4.

In the Location bar of the new window, type /tmp and press Enter.

5.

Click in your first Konqueror window, the one with the secret plan folders in it. Click the new folder, KDestroy58A, and keep your left mouse button down. While holding your left mouse button down, drag the folder over to the second Konqueror window, the one that is at the /tmp directory. Let go of your left mouse button to drop the folder in the new location. Konqueror asks you what action you want to do. Choose Move Here.

6.

Back in our home directory, highlight the NothingInteresting folder and press the Delete key to send it to the Trash. We have foiled the intruders.

Crowds cheer. Babies laugh. Dogs chase cats.


Konqueror is a powerful program with many more capabilities than the simple file management we have talked about. This will get you started. Next, you should look through all the menus and poke at everything to see what it does. With Linux, your regular username will be prevented from doing any real damage because that username won't have permissions to hurt the system files. You can also look at the aesthetic customizations you can do to Konqueror in Topic 4.

Nautilus

Program Info

Fedora/GNOME menu

Main Menu > Browse File System

Mandrake/KDE menu

Main Menu > System > File tools > Nautilus

Terminal Command

nautilus

Program URL

http://www.gnome.org/projects/nautilus/


File managers in the most popular operating systems currently do not differ a lot in form and function. If you know how to navigate through one file manager, it won't take you long to learn to use another file manager. Nautilus is certainly in this group of similar file manager programs that merely have a different flavor and different accessories. While you use GNOME, Nautilus is your center, the program that is your gateway to accessing other programs and working with your data.

Again, as in most file manager programs, files and directories are displayed as documents with associated icons and folders. You can right-click any file or folder to view details about that object or to change permissions. When you double-click a file, either you see a preview of the file's contents or a program opens. Nautilus can display images and text documents, or Nautilus can open files, by type, in default programs.

Nautilus adds a twist to the traditional file manager layout by having two modes in which you can view your files: browser mode and spatial mode. The browser mode of Nautilus looks like a traditional file manager. The spatial mode doesn't look too much different, except that everything in the Nautilus layout is pared to the basics.

Nautilus in Browser Mode

The browser mode of Nautilus (see Figure 2.13) is named as such because you can browse your files in a single window. Click on any folder, use the Up button on the toolbar, or double-click a file to preview the contents. All those actions happen in the same Nautilus window. You can think of it as browsing a book or magazine page by page.

Figure 2.13. Nautilus using the Browse File System option in the main menu.


The layout of Nautilus in browser mode is a simple one, with a menu, toolbar, address bar, a left-side detail and navigation pane, and a right-side view pane. The menu bar and toolbar are easy to understand, with the menus containing basic options and the toolbar consisting of large, labeled icons. The Location bar is an address bar into which you can type any file location. Unlike Konqueror, Nautilus does not advertise itself as a Web browser as well as a file manager, but you can type Web addresses into the location bar. By default, Nautilus shows you the source code of the Web page you visit. You can change this behavior, but you are better off opening a Web browser. The left-side panel shows details about a highlighted file or folder, such as date and file type. You can use the Information drop-down list to choose other views for the left-side pane, including a tree navigation view. The main view pane on the right displays the contents of the folder you are in or the preview of a file's contents.

Nautilus in Spatial Mode

The spatial mode of Nautilus (see Figure 2.14) keeps everything separate in its own place, or space. This is the Nautilus way of displaying file management in an object-oriented way. If the phrase "object oriented" means nothing to you, don't worry; it means a lot to programmer types. What the spatial mode in Nautilus means for everyone is that every folder opens in a separate window. Every file system, every device, and every folder is given its own space.

Figure 2.14. Nautilus as a spatial file manger accessible from the desktop home icon.


There are still lingering arguments in the Linux community as to whether spatial file management is a good thing. Some users maintain that they just don't want all of those extra windows. Advocates argue that spatial file management is more intuitive for users, helps new users learn the Linux file system faster, and makes dragging and dropping files more convenient.

The GNOME developers have made the new spatial experience more user friendly with certain details to help you know where you are in the file system:

  • Every new Nautilus window opens offset from, down and to the right of, the previous window (cascaded), to allow you to easily click on any open window in a series.

  • If you want to browse, you can access the Browse Folder option from the File menu or by right-clicking on any folder.

  • When any folder has an open window, the icon for that folder dims to indicate that the folder is open.

  • The title of the current space is always at the top of that Nautilus window.

  • Click on the bottom-right title on the status bar to see an expanded menu of the directory tree above the current directory.

UNDER THE HOOD

A TRASH CAN FULL OF ERRORS

Sometimes you can't empty your trash because of permissions problems. You might have created a file or folder while you were logged into the terminal as the root user then tried to delete them from Nautilus as your regular user. You can log out of GNOME and then log in as the root user to delete those files.


"Out, damned spatial! Out, I say!"

Although that isn't the exact line from Macbeth, it is the sentiment of some GNOME users since Nautilus added spatial mode. Controversy, opinion, and argument still rage on whether Nautilus's spatial mode is a good thing. If you don't want to use spatial mode, the easiest thing to do is start Nautilus from the Browse File System choice on the main menu. If that isn't permanent enough for you, there is another way to force Nautilus to always open in browsing mode. Open a terminal (if you find yourself afraid of commands and the terminal, skip ahead to familiarize yourself with terminal commands). Type in this command:

[View full width]

gconftool-2 type bool set /apps/nautilus/preferences /always_use_browser true

Log out of GNOME, and log back in. Nautilus will remain in browser mode. If you ever want to switch this back, just replace the word true at the end of the command with false.


Nautilus has traditionally played catch-up to Konqueror. KDE zealots have touted Konqueror as the innovative leader of Linux file managers for years. With spatial file management and new uses for the Nautilus file manager beyond simple file tasks, Nautilus is becoming an innovator as well. If the spatial file management seems odd to you, try it for a while. Switch between spatial mode and browser mode in Nautilus until you find the best fit for how you think and how you work.

TOOL KIT 2.2

Create, Rename, Copy, and Move Files in Nautilus

I liked pretending to be in a KDE vs. GNOME war so much the last time that I want to play again. You can open Nautilus in either browser or spatial mode and have the steps in this toolkit still work. In case you didn't play last time, we are going to pretend that we are GNOME supporters and spies. We have just captured the plans to the next version of KDE.

Create a Folder and a File

1.

Before we pretend, we have to create something to pretend with. Open Nautilus in browser mode. You can, of course, manage files in spatial mode as well, but we should be on the same page here. Go to your home directory by clicking the Home icon on the toolbar.

2.

Right-click in the empty white space. On the pop-up menu, choose Create Folder. The new folder appears as Untitled Folder, with the name already highlighted for you. Type in the name for our new folder, SecretPlans. You can also use the File menu to get to the Create Folder option.

3.

Double-click the new folder, SecretPlans, to go into it. It's empty. We will put something in it. Right-click in the empty white space and go to Create Document > Empty File. Name that file StolenKDEPlans.txt. You can also use the Edit menu to create a new file. This file is only an empty file, but you can create or download document templates to use with Nautilus.

Rename a Folder and a File

Message from HQ: Our Linux sentinel computers have detected KDE hackers attempting to infiltrate our network to retrieve the stolen plans. We have to rename the folder and file to hide them.

1.

Click once on the file StolenKDEPlans.txt to highlight it. From the menus at the top of your window, go to Edit > Rename. You can also right-click the file and choose Rename, press the F2 key, or click the name of the file.

2.

Type in the new file name, TheresNothingToSeeHere.txt. Press Enter or click in the white space somewhere to exit the text edit mode.

3.

Use either the Up button or the Back button on the toolbar to return to the home directory. Then rename the folder SecretPlans to NothingInteresting using the same method that you used to rename the file.

Copy and Move a Folder and a File

We managed to defeat the KDE infiltrators with an encryption scheme. Beep. Beep. Now they are sending in a KDE Seal teamyou know, I'd actually love to see small seals in uniform . . . but, anywayto breech our perimeter! I'll hold them back with my laser gun while you hide the files better! Zeerrrrr! Szhoooo.

1.

Go to your home directory in Nautilus. We have to make copies of the folder and its contents as a backup. Right-click the folder NothingInteresting and choose Copy File from the pop-up menu. You can also press Ctrl+C or go to the Edit menu.

2.

Right-click in the empty white space and choose Paste. Again, the Edit menu or Ctrl+V would also work. The folder appears named as NothingInteresting (copy). Use your new skills to rename the folder as PicturesOfKojak.

3.

We have to move the copied folder to a new location to hide it from the KDE commandos. Open a new window in Nautilus by going back to the main menu and choosing Browse File System again.

4.

In the Location bar of the new window, type /tmp and press Enter.

5.

Click in your first Nautilus window, the one with the secret plan folders in it. Click the new folder, PicturesOfKojak, and keep your left mouse button down. While holding your left mouse button down, drag the folder over to the second Nautilus window, the one that is at the /tmp directory. Let go of your left mouse button to drop the folder in the new location.

6.

Back in our home directory, highlight the NothingInteresting folder and press the Delete key to send it to the Trash. We have foiled the intruders.

"Don't thank us, oh grateful throngs of citizens. It's our job to save the world."




Linux Desktop(c) Garage
Linux(R) Desktop Garage
ISBN: 0131494198
EAN: 2147483647
Year: 2006
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net