End User Manual:Files and folders

From LQWiki
Jump to navigation Jump to search

The File System

(see also Filesystem)

One of the most powerful features of a modern computer system is the ability to store data in a form which can be easily retrieved and transported or copied across to other computer systems or media. Data created and accessed by a user in the computer is stored in what is called a file. This concept of an electronic file to store electronic data mimics the physical world usage of a file to store data written on paper. This mimicry is carried further by the organisation of these electronic files into electronic folders or directories. Like a physical folder, an electronic folder can contain very many files. A folder may also have sub-folders or sub-directories.

Note: We shall be using the terms folder and directory interchangeably, unless stated otherwise.

Files and folders can be created, copied, moved (i.e. transferred) and deleted. The folders themselves are organised in a hierarchical manner starting at the root of the file system. Each user is given a home directory and upon logging in, the user is placed in his home directory.

Ownerships and Permissions

As the system is set up to handle multiple users concurrently, it needs to have in place mechanisms with which it can control the security and privacy of the file system. It needs to be able to control access to the file system resources for each individual user. In addition it also has to be able to control access at a group level i.e. users who belong to the same group can be given certain privileges with respect to the file system operations. To be able to perform these features, associated with each file or folder are the categories:

  • owner
  • group
  • others

and the file permissions:

  • read (r)
  • write (w)
  • execute (x)

and the directory permissions:

  • read (r)
  • write (w)
  • access (x)

Associated with a file are the categories owner, group and others and the permissions which these have on the file. The userid of the user who creates a file by default becomes the owner of the file. Userids on the system are assigned to one or more groups. When a userid is created on the system, a group which has the same name as the userid is also created and the new userid belongs to this group. By default this group (which has the same name as the file owner) is associated with the file. All of the other userids on the system which are not the owner of the file or belong to the group associated with the file, are placed in the category others .

By default the owner has read and write permission for a non-executable file and read, write, and execute permission for an executable file. The group associated with the file has read permission for a non-executable file and read, execute rights for an executable file. The others group has read only permission for non-executable file and read, execute rights for an executable file.

The rights and ownership concepts described above apply to directories too. However since a directory cannot be executed, access rights is substituted for execution rights. Access to a directory means that the userid with the appropriate permission can descend into the directory (i.e. change directory to it).

The File Manager application described below may be used to view and modify the ownership and permissions of a file or folder. Only the owner of a file/folder can change its permissions and only the superuser or root can change the ownership of a file/folder.

See also

Using the File Manager

As it is possible for a user to create and store hundreds and thousands of files and folders, a File Manager is needed to assist the user to manage and manipulate these files and the file system on which it resides.

In this section a brief description of the File Manager and how to use it is given. For more details you should consult the “Help” application on the Main Menu. From the Help application choose:

Desktop --> Nautilus File Manager

To start using the File Manager double-click on the home directory icon on the desktop. (This may be named “username's Home” where username is the username of the user currently logged in.)

By default, the File Manager window consists of a side pane and a main view pane. At the top of the window just under the window titlebar, are the menu bar and the location bar.

The view pane displays the files and folders contained in the current directory that the user is in. These can be displayed as icons (default) or changed to display them as a listing of filenames.

The side pane contains an icon that represents the current file or current folder. The side pane also contains information about the current file or current folder. A hierarchical (tree) view of the file system on the computer can be obtained from the side pane. By navigating through this, you can access files and folders outside your home directory (provided of course that you have the permission to do so).

Accessing Files and Programs

From the view pane of the File Manager, you can open files as well as run (launch) executable programs by double-clicking on the icon representing them.

Creating New Folders

To create a new folder under the folder you are currently in, move the mouse to the menu bar at the top (just beneath the titlebar of the window) and click on File and then click on Create Folder. A new folder will appear on the view pane and you will have to type in the name of the new folder. Copy Files and Folders

To copy a file, click on the file in the view pane to select it. Then select from the menu bar at the top,

Edit --> Copy File

Next open up the folder in which you want to copy the file to and then select from the menu bar at the top,

Edit --> Paste Files

Another way to copy a file is to right click on the file icon and then select “Copy File”. Then navigate to the icon of the folder where you want the copy to be placed in and then right click on the folder icon and select “Paste Files into Folder”.

The procedures above can be done with folders too.

To copy more than one file or folder at a time, select multiple files/folders by holding down the CTRL key while clicking on the files or folders.

Moving Files and Folders

Moving a file or folder is different from copying in that a copy of the file/folder is not made, i.e. only one copy of the file/folder exists, and the file/folder is transferred from one folder to another.

To move a file, click on the file in the view pane to select it. Then select from the menu bar at the top,

Edit --> Cut File

Next open up the folder in which you want to move the file to and then select from the menu bar at the to.

Edit --> Paste Files

Another way of moving a file is to drag and drop the file into the destination folder.

The procedures above can be done with folders too.

To move more than one file or folder at a time, select multiple files/folders by holding down the CTRL key while clicking on the files or folders.

Renaming Files and Folders

To rename a file, click on the file in the view pane to select it. Then select from the menu bar at the top,

Edit --> Rename

and then type in the new name.

Alternately you can also right-click on the file and then select “Rename” .

The procedures above can be done with folders too.

Deleting Files and Folders

To delete a file, click on the file in the view pane to select it. Then select from the menu bar at the top,

Edit --> Move to Trash

Alternately you can select the file and then use the DELETE key on the keyboard to delete the file. This has the same effect as above of moving the file to the Trash folder.

It is still possible to salvage a deleted file from the Trash. To do this double-click on the Trash icon on the desktop to open up the Trash folder. Then you can move the file you want to salvage to the desired folder. Note that if you delete the file from the Trash then it cannot be recovered anymore.

The procedures above can be done with folders too.

To delete more than one file or folder at a time, select multiple files/folders by holding down the CTRL key while clicking on the files or folders.

Viewing and Modifying the Permissions of a File or Folder

To view the owner and group of a file/folder and/or to modify its permission settings, select the file/folder and select from the menu bar at the top,

File --> Properties

Click on the Permissions tab. The owner and group of the file/folder are displayed as well as the associated permissions.

To change the permissions, modify the check boxes accordingly to the new permissions desired. Click on Close to apply the changes.

Note: It is recommended that you do not modify the default file/folder permission settings unless you know what you are doing. This is to minimise the risk of compromising the security of the files and folders.

The Trash Can

The trash can icon on the desktop contains files and folders which you have deleted using the File Manager or an application run from the desktop. As noted above it is a special folder in which in is still possible to move back the deleted items to another folder so as to “undelete” them. However over time, the trash folder will be filled up as many files and folders get deleted through usage. So it is a good idea to periodically empty or delete the items found in the trash.

To empty the trash, right-click on the trash icon and select “Empty Trash”. Otherwise you can open the trash by double-clicking on it and then select to delete all the items in the trash folder using the File Manager functions described above.

Exercises

1.Use the File Manager to perform the following:

Create a new folder called testdir under the home directory Copy the following files into the folder testdir: /etc/services, /etc/hosts Access the testdir folder: Open the two files there to view their contents, then close them Rename the file hosts to hosts.backup and services to services.copy Move the file hosts.backup to the /usr/tmp directory Delete the file services.copy Move up to the home directory Delete the folder testdir Launch the application xeyes found in the folder /usr/X11 R6/bin

2.Check the trash can and restore the deleted file(s) there

Using A Text Editor

(see also text editor)

Very often it is necessary to use the computer to input some text or to modify the data in a text file. While a full-fledged word processor like OpenOffice.org's Writer may be used, it can be an overkill since the sophisticated features and formatting available with a word processor are not needed in many cases. A text text editor can be used instead. The Linux system comes installed with many text editors. In this section we shall be looking at how to use a text editor which comes with the GNOME Desktop - gedit.

Note: A text file here refers to a a file which contains pure text printing characters only. Some types of files e.g. those created by a word processor, while appearing to be text-only actually contain other non-printing characters and hence are not pure-text files.

Starting Gedit

Gedit may be started from the Main Menu,

Main Menu --> Accessories --> Text Editor After gedit has started, you can immediately type in text into the main edit window. The mouse is also used extensively in gedit, to move around the document as well as to perform editing functions.

Inputing Text

Text can be entered by simply typing into the main gedit window. By default the text will wrap to the next line when it reaches the border of the editing window.

Marking Text

The mouse may be used to mark a block of text by clicking on the beginning of the block and dragging the mouse to the end of the block before releasing it.

Deleting Text

Text can be deleted one character at a time by moving the mouse to the character in question and using the DELETE and BACKSPACE keys in the normal fashion.

If there is a lot of text to be deleted, a more efficient way to delete text is to mark it first and then press the DELETE key on the keyboard.

Copy, Cut and Paste

Text can be edited by marking it first and then selecting Cut, or Copy from the buttons at the top. "Cutting" will result in the marked text being copied into a storage buffer and then deleted from the editing window, while "Copying" will result in just a copy of the text being copied into the storage buffer without the deletion of the original text. The text cut/copied in this way can then be pasted into another part of the document by moving the mouse to the desired location and selecting the Paste button at the top.

Another way of invoking these functions is to click on the Edit option on the top menu bar and selecting the desired function, e.g.

Edit --> Cut Edit --> Copy Edit --> Paste

Undo

After performing an editing function, e.g. deleting a block of text, you can undo the action by clicking on the Undo button at the top. The Undo function can also be invoked using the Edit menu selection at the top.

Saving Text

The text typed in can be saved by clicking on the File option on the main menu bar at the top and selecting,

File --> Save As ...

Move to the folder you want to save the file in and enter the name of the file to save.

Find and Replace

The Find button can be used to locate a text string. By default this search is not case sensitive and will also locate the text if it is part of a word. These default options can be changed from the Find dialog.

The Replace button can be used to locate a text string and replacing it with another. Again the default options of non-case sensitive and matching part of a word can be changed.

The Find and Replace functions can also be performed using the Search menu selection at the top.

Opening A File

You can edit a text document already saved on the system by opening it. From the main menu at the top choose,

File --> Open

and select the file to open.

Preferences

Preferences can be set from the Preferences menu selection,

Edit --> Preferences

The Preferences you can set include the font, colour and point size to be used, tab spacing, autowrapping, and autoindenting.

Help

More information on how to use gedit can be obtained by selecting Help from the menu at the top.

Exercises

1.Use the gedit text editor to type in the first page of this guide. Save the document in a file on your home folder.

2.Open the saved file and edit it by: deleting the second paragraph on page one adding the statement “End of Chapter” to the last page save the edited document as a new file



This article is part of the End User Manual, which is based, in whole or in part, on "User Guide to Using the Linux Desktop", by Nah Soo Hoe and Colin Charles. It was released by the copyright holders, the United Nations Development Programme’s Asia-Pacific Development Information Programme (UNDP-APDIP), under the terms of the Creative Commons (attribution variant) license. The original can be found here: http://www.iosn.net/training/end-user-manual/ .

The End User Manual is intended for the use of users without prior Linux or PC experience who wish to learn how to use linux. The original authors intended for the User Guide to be as generic as possible, but in some cases, this was not possible. In these cases, Fedora was used as a baseline. All desktop directions use refer to the Gnome desktop. These choices are not intended as an endorsement of these programs.