Working with Files

From WikiEducator
Jump to: navigation, search

One way of recognising different types of files is to use the Detailed List View in location on drive Konqueror as illustrated in the previous section. Files can also be recognised by the extension on the file name. This is the part of the file name that follows the final period. The following table illustrates some common file names and examples of each.

Extension Example Description
sxw jamaica.sxw A Writer text file.
sxc populationSA.sxc A Calc spreadsheet file.
stw invoice.stw A template file that can be used as the basis for creating Writer text files.
sxi client.sxi A Impress presentation.
pdf contract.pdf A picture document format file. This format

allows a file to be sent in a format that can only be read and not edited. To read such a file you would need a pdf reader.

htm, html index.htm Htm and html files are files that can be read using

a web browser.

txt notes.txt A text file containing pure text without any

formatting.

rtf plans.rtf A rich text format file. This is a format that can be

used for exchanging files between different types of system.

doc jamaica.doc A Microsoft Word document.
xls populationSA.xls A Microsoft Excel spreadsheet file.
ppt,pps client.ppt A Microsoft PowerPoint presentation file.
mdb vendors.mdb A Microsoft Access database file.
zip install.zip A compressed file in zip format.
gz install.gz A compressed file in gzip format.
tar oo-137.i586.tar A tarball file. tar files are used for creating

installation packages.

rpm 00-137.i586.rpm A Red Hat Package Manager File. rpm files are

used for creating installation packages.

png sky.png A common format for storing graphic images.
jpg, jpeg sky.jpg A common format for storing graphic images.
tif sky.tif A common format for storing graphic images.
gif sky.gif A common format for storing graphic images.
wav TRUMPET.WAV An audio file
au TRUMPET.AU An audio file
mpg CONCERT.MPG A video file
avi CONCERT.AVI A video file
tmp ws0001.tmp A temporary file

Extensions are a Windows concept and are not actually needed in Linux. They are however useful in providing information for users about the contents or format of files.


Count the number of files, files of a particular type, in a folder (including any files in sub-folders)

Count total number of files and sub-directories in a directory

When you access a directory with Konqueror using icon mode,, the status bar at the bottom indicates the number of files and directories in the current directory.
Viewdetails.jpeg
However, these figures only count what is in the current directory and not what is in the sub-directories.
To get full information on a directory and its sub-directories:
1. Click Home.
2. View->View Mode->Tree View
3. Click on the directory you wish to analyse.
4. Expand all the sub-directories you wish to include. You will also need to expand sub-directories within these.
This is illustrated on the following screen.
Viewdetails2.jpeg
The status bar at the bottom summarises what can be seen on the screen. The totals exclude the contents of directories that have not been expanded.

Count files of a particular type

Suppose you wish to find the total number of files ending in doc in the sub-directory Letters in your home directory.
1. Start Applications->Find Files/Folders.
2. Click the Browse button.
3. Select the Letters sub-directory and Click Find.
4. Enter *doc in the Named window.
This means the files and directories can start with any number of letters but must end with the letters doc. If you had entered *.doc, the files located would end in the last four letter. If, for example, the directory contained a file called mydoc, it would be included in the first count but not the second.
If you wished to count the number of files and directories starting with the letters le, you would enter le* into the window.
Kfind.jpeg
5. Check Include subdirectories.
6. Uncheck Case sensitive search.
7. Click Find.
The files that satisfy the search specification will be displayed together with their location. The status bar at the bottom of the screen will display the count of the files.

Change file status: read-only/locked, read-write

The permissions associated with files and directories in the section called “Open a window to display directory/folder name, size, location on drive” . If you are the owner of a file, you can change these permissions.

Change permissions on a directory

In this example you will create a sub-directory in your home directory called Common. You will then give users access to change the contents of this directory.
1. Click Home.
2. Edit->Create New or press F10.
3. Create a directory called Common.
4. Right click on Common and select Properties in the context menu.
5. Click the Permissions tab.
(including any files in sub-folders)
Folderpermission1.jpeg
6. Click Advanced Permission button
7. Make sure that Show Entries, Write Entries and Enter are checked for all three Classes.
7. Check Apply changes to all subdirectories and their contents.
8. Click OK.

Change permissions on a file

By default, Linux locks access to files so that they cannot be changed by anyone other than the owner or members of the group.
1. Open Konqueror and locate the file whose permissions you wish to view or change.
2. Right click on the file and select Properties in the Context menu.
3. Click the Permissions tab.
The current permissions will be checked.
Folderpermission.jpeg
4. Click Advanced Permission button
5. Add or remove check marks to set the desired permissions.
6. Click OK.

Sort files by name, size, type, date modified

Files can be sorted by name, type, size and date by clicking on the titles at the top of the pane.
1. Open application and access the directory you wish to sort.
2. Click on Name. This will sort the files in ascending alphabetic order by name.
3. Click on Name a second time. This will now sort the files in descending order of name.
When you sort files, the directories will appear ahead of the files. Directories and files will be sorted separately.
1. Click Modified. This will sort the files in date order starting with the most recent.
2. Click Modified a second time. This will now sort them with the oldest appearing first.
3. Click Size. This will sort the files in order of size with the largest at the top.
4. Click Size a second time. This will sort them in the reverse order of size.
5. Click File Type. This will sort the files alphabetically by type.
6. Click File Type a second time. This will sort them by type in the reverse order.

== Understand the importance of maintaining correct file extensions when re-naming files ==

The part of a file name following the final period (full stop) is called the file extension. This often has a special significance which will be lost if it is changed. For example, the system will recognise that a file having a pdf extension can be opened with a pdf reader or that a file with a png extension is a graphic image.
Some files in Linux may have more than one period. Each of these separates a different part of the file name which may be of special significance to the application that will open it. If you do change a file name, only change the part that is to the left of the first period.
For example, in the file name kdbg-1.2.8-2mdk.i586.rpm, the rpm extension means that this is a file containing installation files that can be managed with the Red Hat Package Manager. The I586 component means that this package is designed to run on a Pentium processor. Changing either of these would cause problems if you tried to install the package from the file.

Re-name files, directories/folders

Rename a file
1. In a Konqueror window, right click on the icon of the file you wish to display a context menu and click Rename or press F2 or click on the label below the icon.
Renamefile.jpeg
2. This will open a small window around the name of the file.
3. Edit the name. Keep in mind the need to preserve the extension.
4. Click outside of the name when done.
Rename a directory
The process is the same as that for a file.
Renamefolder.jpeg