Copying Files and Directories (and Moving, Too)


Copying Files and Directories (and Moving, Too!)

Ah! This is where you learn another great trick with Konqueror. An easy way to copy a file from one directory to another is to fire up two versions of Konqueror. In the first, you find the file (or files) you want to copy. In the second Konqueror window, you locate the directory to which you want those files copied. Simply drag the file from one window into the other. A little menu will pop up asking you whether you want to copy the file here or move it here (Figure 5-6).

Figure 5-6. Confirmation when moving or copying files.


An interesting question, isn't it? That's because copying and moving files are done in pretty much the same way. Both involve a copy. The difference is in what happens after the copy is done. In one case, you copy the file and keep the original, thus giving you two copies of the same file but in different places. A move, on the other hand, copies the file and deletes the original from where it was.

One easy trick is to select the file you want, right-click to get the menu, and then click on Copy. Now go into the directory where you would like this file to appear, right-click somewhere on a blank space of Konqueror's main window, and click Paste from the pop-up menu. You can also specify the Copy and Paste options from the menu bar under Edit.

Shell Out

The Linux command to copy is cp. If you wanted to copy a file called big_report to notsobig_report, you would type the following command:

 cp big_report notsobig_report 


Wait! What about Links?

If you're following along, you probably noticed that the pop-up menu for dragging and dropping a file offered a third option, Link Here. Links are a kind of copy that don't take up much space. In the world of that other OS, you probably thought of them as shortcuts. Links let you create a pseudo-copy of a file or directory that doesn't take up the space of the original file. If you wanted a copy of a particularly large file to exist in several places on the disk, it makes more sense to point to the original and let the system deal with the link as though it were the original. It's important to remember that deleting a link doesn't remove the original file, just the link.

Speaking of links, if you know the pathname to something, you can create a link in any directory at any time. You might remember that I said your desktop itself was a directory in fact, you saw it in Konqueror when I had you navigating your personal home directory. Anyhow, by right-clicking in Konqueror's active window, you can choose Create New (like you did to create a directory) and select Link to Location (URL) from the menu.

A pop-up window will appear with the words New Link to Location (URL) and a blank box for you to enter a location. In this case, you have to know the name of the location that you are linking. For instance, your system comes with a number of sample wallpapers (which we talk about in the next chapter). If for some reason I wanted to have a copy of one of these wallpapers in my home directory, I might link to it as Figure 5-7 shows. Enter the full pathname and press <Enter>. That's it.

Figure 5-7. Creating an icon link to a URL.


When the icon shows up on your desktop, the full path to the file will be the name. If you would like to see something different, right-click on the link you just created and select Properties. A dialog box will appear with three tabs (Figure 5-8): General, which is the link name; Permissions, which represents security-related information; and URL, the path to the file itself. Once created, you probably shouldn't need to change the URL.

Figure 5-8. Desktop icon properties.


On the General tab, you should see an icon next to the name of the file you are linking to. You can change that icon by clicking on it and selecting a new one from the list that pops up (you'll find hundreds). Furthermore, you can change the name of the link you just created to something that makes more sense to you. When you first open the Properties dialog, the file name is already highlighted. Just type the new name and hit <Enter>.

The middle tab, Permissions, lets you change who gets access to a file or directory and what kind of access they get.

Which Brings Us to Permissions

This is your first look at Linux security, this time at the file (or directory) level. Under that Properties tab, you'll see a list of access permissions (Figure 5-9).

Figure 5-9. File permissions in Properties dialog.


This is how you would go about changing permissions. There is, however, another way to identify file permissions that doesn't involve opening up a properties dialog for every file. Remember those file tips I had you configure for Konqueror? Well, we are going to use those now.

Move your mouse pointer so that it hovers over any file. A file tip dialog will pop up (Figure 5-10) telling you the type of file, the size, the last modification date, and the permissions.

Figure 5-10. File tips displaying permissions in Konqueror.


There are actually ten columns describing permissions for a file. For the most part, you'll see either a hyphen or a d in the first column this would represent a directory. The next nine columns are actually three sets of three columns. Those other nine characters (characters 2 10) indicate permissions for the user or owner of the file (first three), the group (second group of three), and others or everyone else (last three). If you look at an image and see -rw-rw-r--, you'll see that the user and group have read and write permissions. All others have read-only permission, the same permission everyone else has.

Shell Out

Want to see the permissions at the shell prompt? Simply add -l to the ls command, like this:

 ls -l directory_name 


From time to time during your Linux experience, you will have to change permissions, sometimes to give someone else access to your directories or files or to make a script or program executable. By using the Permissions tab, you can select read, write, or execute permissions for the owner (yourself), the group you belong to, and everyone else by selecting the permissions in the appropriate drop-down list under the Access Permissions section.



Moving to Linux(c) Kiss the Blue Screen of Death Goodbye!
Moving to Linux: Kiss the Blue Screen of Death Goodbye!
ISBN: 0321159985
EAN: 2147483647
Year: 2003
Pages: 247

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