Manipulating Files and Directories
The file manager, konqueror, is such an integral part of KDE that it deserves special discussion. This section covers how to use konqueror to manipulate files and directories, as well as to navigate remote filesystems and view World Wide Web pages.
Introduction to the File Manager
konqueror is different from other file managers that you might have encountered because it treats all the objects that it browses in a very consistent manner. konqueror is really a generic browser, capable of viewing not only file and directory listings, but many other things as well. The way konqueror achieves this is by using Uniform Resource Locators (URLs) for all the paths that it browses and by using plug-in modules to display various types of information. Thus, in addition to being a filesystem browser and manager, konqueror is also an FTP client, a World Wide Web browser, an archive file viewer, an image viewer, and much more.
Because all the separate things that konqueror can browse are treated the same, it enables you to perform operations conveniently, with little regard for the location of the item you are manipulating. For example, you can drag links from a World Wide Web page onto your Desktop, where you can click them at any time to call them up. You can do the same thing for FTP directories, placing them on your Desktop just like folders. When you click a file on a remote FTP site, konqueror launches it or opens it as if it were a local file. The only difference is that it might take longer as konqueror downloads the file to your system to operate on it.
In another example, you can drag files directly from a remote FTP site (in a folder in konqueror) directly to another KDE application running on your Desktop. You can drag a package file on an FTP site directly to the package manager program to view the package information and install it on your system.
This kind of seamless interaction between remote and local objects makes it easier to access and manage the things you work with on a day-to-day basis.
Tip - Not all KDE applications are as location transparent as konqueror. Just because you can click an FTP site's text file and automatically pull up a text editor doesn't mean that saving from the editor will automatically upload the file back to the FTP site. Unfortunately, you might find that when you save the file, you are simply updating the temporary file, which will be deleted when you close the text editor. Hopefully this will be improved in future versions of KDE.
konqueror is not just a viewer. It is also a manager that can be used to adjust and actively manipulate the objects it is browsing. For example, it uses the KDE file typing system to determine how to launch programs and documents. It recognizes file types on both local and remote files, so it knows what icons to display and what context menus to present to manipulate the items. When you launch a remote file, KDE downloads the file and starts the correct application. You can drag an item from one file manager window to another to make a copy of the item or to make a link to the item. Finally, on your local filesystem, konqueror enables you to manipulate the filesystem attributes of the item (such as the owner and the permissions) with an easy, graphical dialog box.
To get started with the file manager, some user interface elements are described first. The subsequent sections cover specific tasks you can perform with konqueror.
Navigating the Filesystem with konqueror
To start the file manager, click any directory folder or the Home Directory button on the Panel. The file manager is started and displays the contents of the directory you selected in its main window. This is referred to as the browser area of the window. Usually, this is the only area in the main window. However, there is also a directory tree view, which shares the space in the main window with the browser area when it is exposed. Finally there is terminal emulation window area. Figure 3.11 shows the file manager with all three areas exposed.
The Browser Area
The browser area is usually filled with the contents of the current directory. The items in the directory have icons identifying their file type. You can change the view of the directory contents using options on the View, View Mode menu. The five display types (corresponding to options on the View menu) are as follows:
Icon ViewShows the directory contents as large icons in a grid.
Text ViewShows a detailed listing of files and directories, as well as their filesystem attributes.
MuliColumn ViewShows just the filename and mini-icon in a multicolumn view.
Detailed List ViewShows the same file details at the Text View, but also includes mini-icons to indicate the file type.
Tree ViewSimilar to Detailed List View, but each icon can be expanded into a tree of subdirectories.
Normally, hidden files (those that start with a dot) are not shown in the listing. To see these files in the listing, select View, Show Dot Files from the menu. Other options to control the view of the browser area are also available, and will be described. There are a number of ways to navigate to other directories in the file manager. To move to a subdirectory, click the folder or directory name in the browser window. To move to the parent directory, click the up arrow in the file manager button bar. To switch between directories that you have already visited, use the forward and back arrows on the button bar. Each of these buttons also has a small down arrow under it. This is to indicate that if you hold down the button, you will see a list of places to go. For the up arrow, this will be a list of parents, grandparents, and so forth of this directory (or URL). For the left and right buttons, this will be backward and forward in the history the cache.
To switch to an item in the bookmark list, select it in the Bookmarks menu.
Finally, you can type the location to which you want to jump to in the location bar at the top of the file manager window, or in a pop-up Open Location dialog box. You can access this dialog box by selecting the Location, Open Location menu item, or by using the keyboard shortcut Ctrl+O. When you type in the location, you can specify it as either a regular directory path or as a URL. Use the file prefix for locations within your local filesystem.
The Directory Tree
The left pane of the file manager window area is generally the Tree View. By default it is hidden, but you can show it by selecting Window, Show Directory Tree in the file manager menu. The Tree View has three top-level directories corresponding to different places to begin browsing the filesystem:
The Home Directory folderCorresponds to your home directory.
The Network folderThis folder has three sub-folders: FTP Archives for FTP sites that you frequent; Web Sites, which contains your bookmarks; and Windows Shares, which provides access to SMB shares.
The Root folderCorresponds to the root of the entire filesystem.
The Tree view only shows directories, not individual files or links. To expand or collapse a directory, click the box with a plus or minus sign to the left of the directory name. When a directory is collapsed, the box has a plus in it; when it is expanded the box has a minus sign. To make the browser window jump to a directory in the Tree view, click the directory name (provided the browser window is linked; see "Linking Windows" in the following text.)
The Terminal Emulator Window
You can display a terminal emulator window (similar to konsole) in the bottom of the file manager by selecting Window, Show Terminal emulator window. This will give you access to a shell prompt, where you can enter normal UNIX commands. As you change directories using the browser or directory tree, this window will automatically change directories as well (provided they are linked; see "Linking Windows" in the following section). Changing directories in the terminal emulator using the cd command will not change the views of the browser or directory tree.
When you change directories using the browser or directory tree, other windows can change as well. By default, all windows are locked together so they select the same directory. Sometimes it can be convenient to unlink an individual window, however, so that it will always view the same directory.
To link or unlink windows, select the Link box. All windows with the link box selected are linked together and will always point to the same directory. The one exception is the terminal emulator. If you use the cd command, it will be out of sync with the other windows.
Adding More Windows
The three default windows are just the start of your layout options. You can create multiple copies of the browser and terminal emulator windows, and each copy can view a different directory or Web site.
To create a new window, select an existing window of the type you would like to create. Then select one of the following menu options:
Window, Split View Left/RightSplits the current window vertically into two windows of the same kind. The shortcut for this is Ctrl+Shift+L.
Window, Split View Top/BottomSplits the current window horizontally into two windows of the same kind. The shortcut for this is Ctrl+Shift+T.
Window, New View on RightCreates a new window of the same kind on the far right.
Window, New View on BottomCreates a new window of the same kind at the bottom.
Newly created windows will be unlinked by default, making it easier to view other locations. You can change the location they view by clicking them (the small green light in the lower-left corner will indicate which window is active), and then entering a new location in the Location bar at the top of konqueror.
To remove an existing browser or terminal emulator window, click it and then select Window, Remove Active View or Ctrl+Shift+R. To resize a window, click and drag the border between two windows.
Saving a Layout
When you've created a particularly useful layout, you can save it by selecting Window, Save/ Remove View Profile.
First, choose a name for your profile, or select an existing profile name. Then select whether to Save URLs in profile. If you select this, then whenever you load this profile, it will visit the same URLs.
Select whether to Save window size in profile, which will save the overall size of the konqueror window. Otherwise, just the relative sizes of the windows will be remembered.
Finally click Save to save the profile, or click Delete Selected Profile to delete it.
Performing Management Tasks
This section describes all the different management tasks you can perform with the file manager. This includes such things as getting information about a file; moving, copying, and removing files; and changing various attributes of a file, such as its name, ownership, and permissions.
Getting Information About a File
The most basic management task is simply finding out information about a file. Information can be obtained in a number of different ways.
First, the status bar shows the size and type of the item that is currently under the mouse pointer. To see this information, move the mouse over the items in which you are interested.
You can also see detailed file information by selecting either Text View or Detailed List View from the View menu. This shows the type, name, size, modification time, permissions, owner, group, and link target for each item in columns across the screen. The icons in the browser window indicate the type of each item, as recognized by KDE. KDE provides a large set of different icons to identify files of different types. By convention, a directory has a folder as its icon, a documents file often has a piece of paper in its icon, and a program often has a gear. Over time, you will learn these conventions and begin to identify easily, by the icon, the types of files you are looking at.
Certain management actions can be performed by directly manipulating the items in the browser window. There are multiple ways to select more than one item to manipulate.
To select an item without launching it, hold down the Ctrl key and click the item. The item is shaded to indicate that it is selected. To add items to the selection, or to remove items that are already selected, use Ctrl+Click as well. You can also select a group of items by dragging a rectangle around them.
If you have a large number of items and it is awkwardor impossibleto select them with a rectangle, you can select them using a name and wildcard specification. To do this, choose Edit, Select from the menu, or use the Ctrl+Plus (on the number pad) keyboard shortcut. Then type a filename or wildcard specification into the Select files dialog box. Click OK, and files matching your specification are selected. Similarly, you can unselect files using the Edit, Unselect or Ctrl+Minus (on the number pad). Edit, Unselect All (Ctrl+U) will unselect all files, and Edit, Invert selection (Ctrl+*) will invert your selection.
Moving and Copying Files
The easiest way to move or copy files from one part of your filesystem to another, or to make links to a file, is to select and drag them. You can drag files between two open file manager windows, between the file manager window and the Desktop, or from the file manager window to a folder icon (either on the Desktop or in another file manager window). When you drop the item, you are presented with a menu with three options: Copy, Move, and Link. Select one of these options, and the operation is completed. For operations that can take a long time, a status window opens to inform you of the progress of the operation.
You can also copy files (but not move or link them) by selecting them and then choosing the Copy option from either the Edit menu or the context menu for the files. This marks the items for copying. Now browse to the location where you want to copy the files, and select Paste from either the Edit menu or the context menu of the directory in which you want to copy the files.
Note - Using the Copy and Paste menu options requires only one file manager window to be open. If your screen is cluttered, or if there is some other reason why it might be awkward or time consuming to have two file manager windows open, this method of copying files can be very useful. Similarly, you could open multiple browse windows within the file manager window and drag files between them.
Sometimes it is hard to decide which of the possible actions (Copy, Move, or Link) is the most appropriate. This is especially true when you start working with special KDE files and directories, such as the Desktop itself. Some of the following suggestions might seem obvious, but here are some rules of thumb to help you decide:
Only select Copy if you really want to create another copy of the itemThis is rarely what you want to do with executable programs and scripts. It might or might not be what you want with documents and other files, depending on the circumstances. Remember that having multiple copies means that modifications to one copy won't affect the other. Although it is possible to put real documents on the Desktop, most people just put links there, or put files there only temporarily.
Only select Move if you want to change the location of the original itemThis is rarely what you want to do with a program or script. Programs are usually located in bin directories on the path, and moving them makes them inaccessible for command-line use.
For a desktop configuration file, you usually copy it or link itSometimes, moving a desktop file from its original location results in it no longer working correctly. For example, MimeType desktop files only have meaning in a mimelnk directory. Don't move desktop files out of special directories unless you know what you are doing.
To remove a file from your system, you have three options: move it to the Trash can, delete it, or shred it. Moving it to the Trash moves the file to the Trash directory, which means that it still takes up space in your filesystem, but that you can recover it if you need it in the future. Deleting the file completely erases it from your system. There is no way to recover the file. Shredding the file goes an extra step by first overwriting the file with a complex series of data before deleting it. This should ensure that even advanced data recovery techniques won't be able to restore all or part of the file.
To move a file to the Trashcan, choose the Move to Trash option from either the Edit menu or the local context menu, or drag the item from the file manager window to the Trash icon on the Desktop. TSimilarly, to delete it, select the file (or files), and then choose the Delete option from either of these menus. Finally, to shred it, select the file (or files), and choose the Shred option.
Launching a file from the file manager is exactly the same as launching it from the Desktop window. You can either click the item, drag the item on top of a program, select Open With from the context menu of the item, or select one of the programs listed in the context menu.
If you single-click the item, KDE determines an appropriate course of action, depending on the file type. If KDE cannot determine a default program for the file, KDE prompts you for a program with which to open the file.
Modifying Files and Directories
KDE makes it very easy to manipulate the attributes of an item in the filesystem by providing a simple graphical dialog box to manipulate an object's properties. To access this dialog box, select Properties from the item's context menu. The dialog box has different tab pages, depending on the item type. But the first two tab pages of the dialog box, General and Permissions, are common to all types.
Renaming a File
To rename a file, select Properties from the file's context menu. When the dialog box opens, you are on the General page of the dialog box. Edit the Name field, and click the OK button.
Changing Ownership and Permissions
To change ownership and permissions on a file, access the Properties dialog box, and select the Permissions tab (see Figure 3.12).
To modify the permissions of an item, click the check boxes in the Access permissions section of the dialog box. To change the owner or group of the file, use the controls under Ownership.
Navigating the Web
The file manager operates not just on local files. It is also a generic World Wide Web browser. To go to a Web page, click a URL item, or enter the URL for the page in the location bar of the file manager.
To navigate, use the same techniques as you do with a normal Web browser. Click links and use the forward and back buttons in the button bar. Reload a page using the reload button. Access the history list from the Go menu.
To go to a bookmarked site, click the item in the Bookmarks menu. To add the current page to the bookmarks, select Bookmarks, Add Bookmark. If you have sub-menus in your bookmark list, you can select Add Bookmark for the menu on which you want the site to be placed.
You can edit bookmarks by selecting Bookmarks, Edit Bookmarks. This will open another konqueror window viewing your bookmark directory. By dragging links here, or using the local menu's Create new dialog, you can create new bookmarks. By creating directories here, you can categorize your bookmarks into whatever classifications you would like.
To save a link in a Web page on the Desktop, drag the link from the file manager window to the Desktop. To save the current page to the Desktop, back up one page and drag the link from the previous page to the Desktop. If you don't have a link to drag (for example, you got to a site by typing it in instead of following a link), you can make an entry on the Desktop by following these steps:
Select Bookmarks, Add Bookmark to add the page to the bookmark list.
Now select Bookmarks, Edit Bookmarks to show the Bookmarks folder.
Drag the item from the Bookmarks folder to the Desktop.
Looking Inside Archives
To view the contents of an archive (tar, tgz, zip, and so forth) file, click the file. You can operate on individual files and directories inside the archive, just like you do in a normal directory. You can also right-click the archive and select Archiver, which provides a more archive-specific view, including the ability to easily extract and add items to the archive.
Special Features or Tips
The file manager has a couple of other features that serve as handy shortcuts for common operations.
Miscellaneous Handy Shortcuts
To open a terminal window with the current directory the same as the file manager, select Tools, Open Terminal, or use the keyboard shortcut Ctrl+T. This is handy when you get to a directory and discover that you need to perform some complex action there. Instead of opening a terminal window and navigating there manually, just type Ctrl+T. Of course you can always use the integrated terminal emulator by selecting Window, Show Terminal emulator window.
To open a folder in a new file manager window instead of the current file manager window, click it with the middle mouse button.
To open a new file manager window with the same current directory as the current window, click the gear icon in the toolbar (located on the right of the toolbar).
Sometimes, you need to perform a file manipulation for which you just don't have permissions. In this case it is possible to start a terminal window, su to root, and execute the commands by hand. However, to make it more convenient to overcome this situation, and to enable you to continue operating using a graphical file manager, KDE provides a way to launch a file manager with superuser (root) privileges.
To do this, select System, File Manager (Super User Mode) from the Application Starter menu. A special terminal window starts up and prompts you for the root password for your machine. Enter it, and a file manager with root privileges starts. To remind you that you are operating with special privileges, the handle of the menu bar in the file manager window is shown in bright red. You can use this file manager window to perform operations that require root privileges. When you drag files between file manager windows of both types (root and regular user) onscreen, the window that performs the copy, move, or link operation is the destination window (the window being dropped on). This means, for example, that you cannot drag a file to which you don't have permissions from a root file manager window to a non-root file manager window. You can, however, perform this drag the other way around.
To view a window in full-screen mode, select Window, Fullscreen Mode (Ctrl+Shift+F). This will expand the current window to fill the entire screen, including the normal panel and menu areas. It will also get rid of the konqueror menu bar and status bar, leaving just the toolbars. This will give you the most screen real estate for viewing. To exit full screen mode, click the icon with four arrows pointing toward the center of a screen.