Tuesday, January 5, 2010

Linux RedHat Simulation RHCE Course 02

1-Simulation: Directory and File Organization



2-Simulation: Managing Files with Nautilus





3-Simulation: Backing-up your system configuration


Sunday, January 3, 2010

Lesson 06 Determining File Content Part 04

Determining File Content


Files can contain many different types of data. The contents of any given file might be ASCII or binary.


ASCII files include, but are not limited to, these types:




Plain text
HTML
Executable shell scripts


C program source code
Mailbox-format text


Binary files include, but are not limited to, these types:


Compiled executables


Compressed data


Images


Sound samples



It’s a good idea to check the file type before opening it, to determine the appropriate command or application to use. Binary file types use an extended character set. Some of these characters are also used to display special characters, sound an error beep at the terminal, clear or flash the screen, or even lock up the terminal display. To check the file type, use the file command.


This is the syntax for the file command:

file [options] …



file type




The file command prints its best guess of the type of data contained in a file whose name is given as an argument. It bases its guess on a comparison of the contents of the file with the patterns and offsets in its reference file, /usr/share/magic.

Here are some file types, as reported by the file command:



file types table



Lesson 06 Browsing the Filesystem Graphically Part 03

Using Nautilus

Nautilus is a graphical filesystem browser provided as part of the GNOME graphical environment. Although managing files from the command line can be more versatile and powerful, many people find a graphical interface to be more intuitive.

Nautilus can run in either of two modes:
Spatial mode
Browser mode

Spatial mode is designed to be the most intuitive for new users and is the simplest in terms of user-interface clutter. Windows have a very basic layout with no toolbar; when a directory is double-clicked it opens in its own window. A menu in the lower-left of each window allows the user to list and select parent directories of the one currently displayed. Typing Ctrl-Shift-W closes all parent windows.


Spatial mode


Browser mode provides a more traditional file-manager interface with a side pane on the left that can display file details, a filesystem tree, or even notes the user has taken about the contents of a directory. The categories displayed in the sidebar can be selected from a drop-down menu. Folders open in the same window instead of in new ones, and the user navigates using the standard back, forward, and up icons available in most graphical file managers.


Browser mode

To access Nautilus, use one of the following methods:

Desktop icons
Computer icon
Home directory icon
Removable device icons (CD-ROMs, USB drives, floppy disks)

Menu option
Applications > System Tools > File Browser

The two most common ways to access Nautilus are via desktop icons or a menu option. The desktop icons labeled Computer, and for example, Joe’s Home will each open a Nautilus window in spatial mode. The Home icon opens a window that displays the user’s home directory. The Computer icon opens a window that presents an ordered view of available filesystem resources. This includes the Filesystem icon, which opens a window displaying the root directory; the Network icon, which allows the user to browse the local network for shared disks; and an icon for each removable media filesystem, such as those on CD-ROMs, floppy disks, and USB drives.

Nautilus can be started in browser mode by selecting File Browser from the Applications menu under System Tools in the upper left corner of your GNOME desktop. If you would like Nautilus to always start in browser mode, even when accessed via the desktop icons, open a Nautilus window, select Edit > Preferences from the menus, go to the Behavior tab, select Always open in browser windows and click Close.

Moving and Copying in Nautilus
The following keyboard shortcuts apply to Drag-and-Drop in Nautilus:

Drag
Moves on the same filesystem, or copies if on a different filesystem
Drag + Ctrl
Always copies
Drag + Alt
Asks whether to copy, move, or create a symbolic link (alias)
If the destination is on the same filesystem as the source, when you drag and drop files, Nautilus will move the file instead of copying it. To force Nautilus to copy instead of move, drag the file to its destination and press Ctrl before releasing the mouse button. Holding the Alt key instead will make Nautilus ask whether to copy, move, or create a symlink. A symlink, or symbolic link, is an alias to the source file that does not take up extra space on the drive.

Right-clicking an object in Nautilus opens context menu listing actions you can take on that item. The exact contents of the context menu depend on what is being clicked (the "context" of the click). For files or directories, the context menu includes options to copy, cut (move), or rename the selected object. If you cut or copy a file or directory and then right-click your desktop or a directory, then the context menu will include a paste option. Selecting this option will copy or move (depending on whether the source file was copied or cut from its original location) the previously selected object (or objects) into the directory.

Lesson 06 Working with the Filesystem Part02

Changing Directories
The shell prompt displays the last component of the directory name, for example, it displays student01 to represent /home/student01. To move from directory to directory on the system, use the cd command.

The cd command accepts one of two arguments:

An absolute or relative path name
A shortcut representing the directory to which you wish to change
A number of shortcuts are at your disposal for use with the cd command. A dot (.) and a double dot (..) are two shortcuts found in every directory. The . shortcut represents the current directory, whereas the .. shortcut represents the parent directory.

For example, if your current working directory is /home/student01, what would typing the following do?
cd ..
It would move you to the /home directory.

The tilde (~) is an abbreviation for “home directory.” Used by itself, it represents your own home directory. Used as a prefix to another user’s login ID, it represents that user’s home directory.
A dash (-) represents your previous working directory. It’s a handy shortcut to use to switch back and forth between two directories.
For example:









Listing Directory Contents

To list directory contents, use the ls command.

This is the syntax for the ls command:

ls [options] [files_or_directories]

Examples

The ls command used without any arguments will list the file and directory names in the current directory.
ls -a includes so-called hidden files and directories whose names begin with a dot (.).




ls lists another file or directory if given as an argument:




Use ls -l for a more detailed “long” listing:





ls -R recursively lists through subdirectories, listing their contents too.

The ls command has many other options. For a full listing, view the man page for the ls command. All options can be used in combination with other ls options.


Copying Files and Directories

To copy files and directories, use the cp command.

The cp command syntax is as follows:

cp [options] file destination

More than one file may be copied at a time if the destination is a directory:

cp [options] file1 file2 destination

The cp command must always be given at least two arguments. When two arguments are given, the first argument is interpreted as the source file and the second argument as the destination. These arguments can be specified as either an absolute or relative path name. If an existing directory is named, a copy of the source file is placed in that directory with the same name as the source. Otherwise, the destination is interpreted as a file name, and a copy of the source file is created with that destination name.

When more than two arguments are provided, all arguments except the last are interpreted as source files. The last argument is interpreted as a destination directory. Copies of the source files are placed, with their original names, in the destination directory.

These are some of the common options of the cp command:

-i Interactive – Asks before overwriting a file
-r Recursive – Recursively copies an entire directory tree
-p Preserve – Preserves permissions, ownership, and time stamps
-a Archive – Copies files and directories recursively (like -r) while preserving permissions (like -p)

Copying Files and Directories: The Destination

When you use the cp command to copy a single file to a destination, cp first checks whether the destination directory exists. If it does exist, cp places a copy of the source file, with the same name as the source file, into the destination directory. If the destination directory does not exist, the source file is assumed to be a new name and cp makes a copy of the source file with the destination name.

As an example, assume the current directory is ~/test and you want to make a copy of file01.txt in a subdirectory of your home directory, named backups.



Moving and Renaming Files and Directories

To move files, use the mv command.

The syntax for the mv command is as follows:

mv [options] file destination

More than one file can be moved at a time, but the destination must be a directory:

mv [options] file1 file2 destination

The mv command must always be given at least two arguments. Aside from a couple of switches, mv and cp function identically. The only difference is that cp results in matching identical files; with mv, the source disappears, leaving only the destination files.

Using Two Arguments

The first argument is taken as the source file. It may or may not be prepended with a relative or absolute path name. The second argument is interpreted as the destination. It may or may not be prepended with a relative or absolute path name.

If it names an existing directory, the source file is moved to that directory with the same name as the source. Otherwise, the destination is interpreted as a file name, and the source file is renamed, moved, or renamed and moved to that destination name.

Using More than Two Arguments

All arguments but the last are interpreted as source files. These may or may not be prepended with a relative or absolute path name.

The last argument is interpreted as a destination directory. It may or may not be prepended with a relative or absolute path name. The source files are moved, with their original file names, to the destination directory.

For example:




Creating and Removing Files


The touch command can be used to create or modify existing files. This command updates a file’s time stamps. For example, if the last time you accessed a file was at 10:02 p.m. and you touch the file at 10:45 p.m., the file will show its last access at 10:45 p.m. If you touch a file that does not exist, an empty file will be created.

To remove files, use the rm command.

This is the syntax for the rm command:

rm [options] …

One or more files can be removed at a time. By default, rm will not remove directories. The -r option tells rm to remove files recursively, so it will delete directories and their contents.

To remove a directory and all files and subdirectories it contains, and suppressing and ignoring warnings about removing write-protected files and directories in the process, use rm -rf.

Note: Be very careful not to erase needed files with the -rf option! If necessary, the rm command can be made interactive by using the -i option.

Remember—you cannot undo the effects of the rm command. The only way you can restore files deleted this way is to restore from a backup.

Using rm: Examples

To remove a directory and all its contents, use this command:

rm -r directory

Use -r in combination with -i to recurse through the named directory and to query whether or not each file should be removed. The file will be removed if the user types y or Y:

rm -ri directory
rm: descend into directory ‘include’? Y
rm: descend into directory ‘include/files’ ? Y
rm: remove regular file ‘directory/files/file1.txt’ ? Y
…output truncated…

Use the -f option to suppress warnings about write-protected files. If the example above had used rm -rf instead of rm -ri, the directory tree would have been deleted with no further prompting.

Note

Be very careful using the rm -rf command. If run from the wrong directory, it can do extensive damage to the system, without prompting you for confirmation.

Creating and Removing Directories

To create directories, use the mkdir command. For example, to create a directory called work, use the following:

mkdir work


To remove an empty directory, use rmdir command. For example, to remove the work directory, use this command:

rmdir work

Lesson 06 Filesystem Principles part 01

Filesystem Principles




In this lesson, you will study Linux file hierarchy principles. You will learn about the contents of some important directories, some rules for naming files and directories, and how to display the current working directory. You will also look at the difference between absolute and relative path names.


Linux File Hierarchy Principles

Filesystem Basics

These Linux file hierarchy concepts will be expanded upon in the pages that follow:

• A single-rooted, inverted-tree structure is used for organizing files and directories, including distinct physical volumes, such as floppy disks, CD-ROMs, and multiple hard drives.

• The base of the inverted-tree hierarchy is known as root, or /, and is the top of the file structure.

• A forward (/) slash separates elements of a path name, for example /usr/bin/X11/X.

• Names in the Linux file hierarchy are case sensitive.

• Each shell and process on the system has a designated current or working directory.

• Two dots (..) refer to the parent directory of any particular directory, which is one level up in the file hierarchy.

• One dot (.) refers to the current directory.

• Files and directories whose names begin with a dot (.) are hidden, that is, they are not displayed by default in file-name listings.

• A user's path is a list of directories that are searched for commands typed at the command line.


Note:
Linux uses the forward slash (/) to separate elements of a path name, whereas DOS (Windows) uses a back slash (\).


Present Working Directory


The present working directory is the directory in which you are currently working. To view the present working directory, use the pwd command. When you type the pwd command at the command line, the absolute path to your current working directory is displayed. For example










File and Directory Names
With the default filesystem, file names may have up to 255 characters. (Depending on the configuration of your system, different restrictions may apply.)
File names generally consist of letters, numbers, and certain punctuation marks. All other characters, except the forward slash (/), are valid.
Some special characters are best avoided in file names. Avoid the following: <, >, ?, *, and ". Also avoid using tabs, spaces, and other non-printable characters.
If you do need to access a file with special characters, enclose the file name in quotation marks.

For example: ls -l "file name with spaces.txt"

If you remove the quotation marks from the above example, you would be asking the system to list four different files.
Also keep in mind that file names are case sensitive. This means that FILE is different from file and File. Once again, although you can create these files, it may be wise to avoid doing so as it may cause confusion in the future.

Absolute and Relative Path Names

The location of a directory or file can be specified by either of two arguments: its absolute path name or its relative path name. An absolute path name has these characteristics:
Begins with a forward slash (/)
Contains the complete name of each directory that must be traversed from the root file system up to the object being named
Can be used anytime, and is valid regardless of the current directory

A relative path name has these characteristics:
Does not begin with a forward slash (/)
Specifies the location of the file or directory relative to the current working directory
Is usually shorter than the respective absolute path name

Linux redhat simulation RHCE Course 01

1-Simulation: Logging in and using basic Linux commands





2-Simulation: Using the Help Tools


Saturday, January 2, 2010

Linux Sabily

What is Sabily ?

Sabily is an operating system, like MS Windows or Mac OS X. Without an operating system, a computer is unusable, and Windows is not the only OS available! (though you often don't have the choice, that's why we are working hard to fix the bug number one)

I already have Windows, why would I use Sabily ?
Because Sabily is free, already includes all software you need in your everyday tasks, and is customized specifically for Muslims. And even if you didn't buy Windows, you should not use pirated copies because then you are still supporting Microsoft by adding to the impression it's the only OS available.

It should be a tremendous work to develop an operating system?
Actually we don't start from scratch, we use the Ubuntu operating system as a groundwork. Ubuntu is a GNU/Linux distribution whose goal is to provide an easy-to-use, up-to-date, stable and free system, also for companies. Sabily customizes Ubuntu by removing, modifying and adding software, and also customizes the graphic design to make a system adapted to Muslims.

Is there a company like Microsoft which develops Sabily?
No there isn't, just a communauty of voluntaries coming from all over the world (France, Tunisia, Egypt, Indonesia etc.). You can as well participate, as a developer, a graphic designer, a tester or if you just want to share your ideas.

What are the main features of Sabily?
The main software are: Zekr and Mus-haf Othman (Quran study tools), Minbar and Firefox-praytimes (prayer times applications), Monajat (application that popups prayers every predetermined time), Hijra (islamic calendar) and WebStrict (parental control tool). Arabic language is also well supported. And of course the graphic design is also customized (see screenshots).

What other software are included in Sabily?
OpenOffice (word processor, spreasheet, presentation), Firefox (web browser), Pidgin (instant messaging), F-spot (photos management), Gimp (image manipulation program) and other multimedia software (video/audio). All of this in included in the "small" version of Sabily, but the "full" version contains dozens of other software! (educational software, tools and entire Quran recitations, see the full list here)

Sabily seems very interesting, what should I do to use it?
You have to download the ISO file and to burn it on a DVD, then to start your computer from the DVD. You will have the choice to test or to install the system. In a first time we advise you to test it because it is safe for your computer, nothing will be written on your hard disk. You can even test Sabily directly from Windows, by using a Virtual Box image.

 
Home | About | Link | Link
Simple Proff Blogger Template Created By Herro | Inspiring By Busy Bee Woo Themes