0% found this document useful (0 votes)
50 views

Basic Linux

This document provides an introduction to basic Linux terminology and how to use the Red Hat Enterprise Linux graphical desktop environment. It defines common terms like command, command line, GUI, icons, panels, root user, RPM, and shell prompt. It also explains how to log in and out graphically, open a terminal, find documentation, and navigate the file system using the Nautilus file manager.

Uploaded by

jeffconnors
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Basic Linux

This document provides an introduction to basic Linux terminology and how to use the Red Hat Enterprise Linux graphical desktop environment. It defines common terms like command, command line, GUI, icons, panels, root user, RPM, and shell prompt. It also explains how to log in and out graphically, open a terminal, find documentation, and navigate the file system using the Nautilus file manager.

Uploaded by

jeffconnors
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Introducing Red Hat Enterprise Linux

LinuxUsageBasics

IntroductoryTerms
When you learn about a new operating system, you should also
learn new terminology. This section defines a few basic terms you
should learn.

Command: An instruction given to the computer, most often with


the keyboard or mouse.

Command line: The space at the shell prompt where commands


are typed.

Graphical Desktop: The most visible area of a GUI. The desktop is


where your user Home and Computer icons are located. You can
customize your desktop to have special backgrounds, colors,
and pictures to add a personal touch.

Graphical User Interface (GUI): A general term for interactive


windows, icons, menus, and panels which allow a user to initiate
actions such as starting applications and opening files using a
mouse and keyboard.

Icons are small images representing an application, folder, shortcut


or system resource (such as a diskette drive). Launcher icons
usually refer to application shortcuts.

Man page and Info page: Man (short for manual) and Info pages
give detailed information about a command or _le (man pages tend
to be brief and provide less explanation than Info pages). For
example, to read the man page for the su command, type man su at
a shell prompt (or type info su for the info page). To close man or
Info pages, press [q].

Panel: A desktop toolbar, located across the top and bottom of your
desktop. The panel contains the Applications menu and shortcut
icons to start commonly used programs.

Panels can also be customized to suit your needs.

Root: Root is an administrative user account created during


installation that has complete access to the system.(Root is also
known as the superuser.) You must be logged in as root to
accomplish certain system administration tasks, such as changing
administrative passwords and running system configuration tools.
User accounts are created so that typical user tasks can be done
without using the root account, which can reduce the chance of
damaging your Red Hat Enterprise Linux installation or applications
permanently.

RPM: RPM stands for RPM Package Manager and is how Red Hat
builds and delivers its software files. An RPM is a software package
file you can install on your Red Hat Enterprise Linux computer.

Shell prompt: A command line interface between the user and the
operating system (Figure 1-13). The shell interprets commands
entered by the user and passes them on to the operating system.

su and su -: The command su (switch user) gives you access to the


root account or other accounts on your system. When you type su to
switch to your root account while still inside your user
account shell, you have access to important system files that you
can change (or damage if you are not careful). Logging in with the
su - command makes you root within the root account shell. Use
caution when you are logged in as root.

X or X Window System: These terms refer to the graphical user


interface environments. If you are "in X" or "running X", you are
working in a GUI rather than a console environment.

LoggingIn
The next step to using your Red Hat Enterprise Linux system is to
log in. When you log in, you are introducing yourself to the system
(also called authentication). If you type the wrong user name or
Password, you will not be allowed access to your system.

Unlike some other operating systems, your Red Hat Enterprise Linux
system uses accounts to manage privileges, maintain security, and
more. Not all accounts are created equal: some accounts have fewer
rights to access files or services than others.
GraphicalLogin
When your system has booted, a graphical login screen is displayed.
Again, unless you have chosen to give your machine its own
hostname, which is primarily used in a network setting, your
machine will probably be called localhost.

To log in as root from the graphical login screen, type root at the
login prompt, press [Enter], type the root password that you chose
during installation at the password prompt, and press [Enter]. To log
in as a normal user, type your username at the login prompt, press
[Enter], type your password that you selected when creating the
user at the password prompt, and press [Enter].

Logging in from the graphical login screen automatically starts the


graphical desktop for you.

GraphicalInterface
When you installed Red Hat Enterprise Linux you had the
opportunity to install a graphical environment. Once you start the X
Window System, you will find a graphical interface known as a
desktop. Unless you specified otherwise, Red Hat Enterprise Linux
installs GNOME as the default desktop.

LoggingOut
Graphical Logout

To log out your graphical desktop session, select Actions (the


second menu on the top panel) => Log Out.
When the confirmation dialog appears, select the Logout option and
click the OK button. To save the configuration of your desktop, as
well as any programs which are running, check the Save current
setup option.

Virtual Console Logout

If you are not using the X Window System and you logged in at the
console, type exit or [Ctrl]-[D] to log out of the console session.

Shutting Down your Computer

Before turning off your computer, it is important to properly shut


down Red Hat Enterprise Linux.

Never turn your computer off without shutting down first, as you
may lose unsaved data or damage your system.

Virtual Console Shutdown


To shutdown your computer at a shell prompt, type the following
command:

halt

Some computers automatically turn the power off after shutting


down Red Hat Enterprise Linux. If your computer does not, you can
safely turn off the power to your computer after you see the
message:

System halted.

Openinga Shell Prompt


The desktop offers access to a shell prompt, an application that
allows you to type commands instead of using a graphical interface
for all computing activities.

You can open a shell prompt by selecting Applications (the main


menu on the panel) => System
Tools => Terminal.

You can also start a shell prompt by right-clicking on the desktop


and choosing Open Terminal from the menu.
To exit a shell prompt, click the X button on the upper right corner
of the shell prompt window, type exit at the prompt, or press [Ctrl]-
[D] at the prompt.

Documentation and Help

There are several resources available to get the information you


need to use and configure your Red Hat Enterprise Linux system.
Along with the Red Hat Enterprise Linux documentation there are
manual pages, documents that detail usage of important
applications and files; Info pages which break information about an
application down by context-sensitive menus; and help files that are
included in the main menu bar of graphical applications. You can
choose any method of accessing documentation that best suits your
needs, as all of these resources are either already installed on your
Red Hat Enterprise Linux system or can be easily installed.

Manual Pages

Applications, utilities, and shell prompt commands usually have


corresponding manual pages (also called man pages) that show the
reader available options and values of file or executable. Man Pages
are structured in such a way that users can quickly scan the page
for pertinent information, which is important when dealing with
commands that they have not previously encountered.

Using man

Man Pages can be accessed via shell prompt by typing the


command man and the name of the executable.

For example, to access the man page for the ls command, type the
following:

man ls

The NAME field shows the executable's name and a brief


explanation of what function the executable
performs. The SYNOPSIS field shows the common usage of the
executable, such as what options are declared and what types of
input (such as files or values) the executable supports. The
DESCRIPTION field shows available options and values associated
with a file or executable. See Also shows related terms, files, and
programs.
To navigate the man page you can use the "arrow" keys or use the
[Spacebar] to move down one page and [B] to move up. To exit the
man page, type [Q].
To search a man page for keywords type [/] and then a keyword or
phrase and press [Enter]. All instances of the keyword will be
highlighted throughout the man page, allowing you to quickly read
the keyword in context.

The man Man Page

Just like other commands, man has its own man page. Type man
man at the shell prompt for more information.

Usingthe GraphicalDesktop
Red Hat Enterprise Linux includes a powerful graphical desktop
environment where you can easily access your applications, files,
and system resources.

UsingNautilus
Your first view of the graphical desktop looks something like
Microsoft windows . The desktop offers the following tools,
represented as desktop icons: Computer, User's Home, and
Trash. Each of these tools is an application of the Nautilus file
manager.

Usingthe Computericon
Double-clicking the Computer icon takes you to a list of all of the
devices on your system. A device is anything connected to your
computer to which data is sent or from which it is received. (You
have probably heard of a 'device driver' before (this is a piece of
software that allows a device to talk to your computer.) Most
modern systems have the following devices: a floppy drive, a CD-
ROM drive, and at least one hard drive. Other devices may be listed
depending on the makeup of your system.

Removable Media
Double-click either the Floppy icon or the CD-ROM icon to mount
the drive with Nautilus and open a new window with the drive's
contents. You can also right-click on the drive and then
select Mount Volume from the menu.

Disk
This references the hard drive. If you are using Linux, your hard
drive is already mounted, and may not be accessible from this
window. If you have other hard drives available on your system
(possibly used for other operating systems), they may be mountable
here.

File system
Double-click on the File system icon and Nautilus opens a window
that shows the entire file system, starting from the / directory. This
is a quick way to reach such useful folders as /tmp/ and /usr/bin/. If
you are not logged in as root, some folders will be unavailable. This
is to prevent accidental damage to your system.

Network
Double-click the Network icon to bring up a list of all systems on
your network. Linux systems are listed individually. Systems running
other operating systems are grouped under an icon
that reflects this. (For example, Windows systems on your network
appear under a Windows Network icon.) You are only able to
browse those machines you have permission to access.

Using the Applications and Actions Menus

On the top panel are two menus, the Applications menu and the
Actions menu. The Applications menu expands into a large set of
menus that allow you to access the applications on your system.
The Actions menu expands into a list of actions you can perform on
your session.

The ApplicationsMenu
The categories of the Applications menu are self-explanatory. For
example, the Games sub-menu holds games like Same GNOME;
the Sound and Video sub-menu holds CD players, volume
controls, and the Helix media player. For these directories, a few
moments spent browsing the contents is sufficient to familiarize
yourself with your system. A few sub-menus are worth additional
explanation:

Preferences
Preferences contains applications that allow you to customize your
system. Most of the applications in this sub-menu do not require
root privileges to access.

SystemSettings
System Settings contains higher-level configuration tools. Most of
the applications in this submenu require root privileges to access.
You should use caution when using these applications.
Date & Time: This tool allows you to set the date, time, and
timezone for your system.
Printing: The Printer Configuration Tool allows you to add
a new printer to your system, whether it is connected to your
computer or is available on a network.

Soundcard Detection: The Sound Card Configuration


Tool tool probes your system for available sound devices.

Users and Groups: The User Manager tool allows you to


add and remove users from your system.

System Tools

System Tools contains applications for utilizing and maintaining


your system. This sub-menu includes the Terminal application, the
Floppy Formatter, and other applications.

The ActionsMenu
The Actions menu contains tasks you will most likely execute on a
daily basis. These include: Lock screen, Log Out, and Search for
Files....

Lock screen This action starts a password-protected screen


saver. You must enter your password to return to the normal
desktop.

Search for Files... This action opens a Nautilus window that


allows you to search for files according to letters in
the name of the files.

Log Out
This action opens the Log Out dialog window, which
terminates your GNOME session.

Usingthe Desktop

Other icons on the desktop can be shortcuts to files, folders, and


application launchers. To open a folder or launch an application,
double-click on its icon
AddingApplicationLaunchers
Some users prefer to access favorite applications directly from the
Desktop, rather than hunting through menus. To do this, you must
create an application launcher. There are several ways to go about
this:

• Applications can be dragged and dropped from the Main


Menu onto the destop.

• Applications can be dragged and dropped from the Panel


to the desktop.

• Application launchers can be created manually.


Creating a launcher manually can be tricky. In most cases, it is best
to drag and drop an application from the Applications or the Panel

To manually create an application launcher:


1. First, you must know the name of the application for which
you are creating a launcher. For the purpose of this
example, assume the application is gedit.

2. Next, locate the application. Use the which command from


a shell prompt to locate the executable file for the
application

3. Right-click on a blank area of the desktop and choose


Create Launcher.

4. When the dialog opens, fill in the following fields:

o Name: Enter a name for the launcher. For this


example, a good name would be "GNOME Editor".

o Generic Name: (Optional) Enter the type of program.


For this example, "Text Editor" is appropriate.
o Comment: (Optional) Enter a short piece of
information about the launcher - this text is
displayed when your mouse hovers over the icon on
your desktop. For this example, use "This is my
favorite text editor!"

o Command: Enter the results of the which command


(ex: /usr/bin/gedit).

o Type: Choose the type of launcher to create. Choose


Application in this case.

o Icon: Click on the No Icon button to choose the icon for


your launcher. You can either pick one of the icons it
suggests, or browse the /usr/share/icons directory to
select another. Click the OK button to save your
selection.

o Click OK.

5. This places the launcher on your desktop. Double-clicking


the new icon launches the application.

AddingFile Links
To place a link to a file or directory on the desktop:

1. Open User's Home and navigate to the appropriate


directory.

2. Right-click on the icon of the file or directory and select


Make Link. This creates a new icon with the phrase "link
to ..." in its name.

3. Drag and drop this new icon to the desktop. If you were to
drag and drop the actual file or directory, you would move
it from its current location to the desktop.
Usingthe Panel
The long gray bars across the top and bottom of the screen are the
Panels.

The top Panel contains both the Applications and Actions menus.
It also contains application launchers, the notification area, and the
time and date.

The Panels are independently configurable. To alter the default


settings, right-click in an unused area of the Panel you wish to alter
and select Configure Panel. This allows you to change the color,
size, and position of the Panel. You may also choose to hide the
Panel automatically or manually. If you choose to hide the Panel, it
does not appear on the desktop until your mouse pointer hovers
over the Panel area.

Application launchers may be moved between the Panel and the


Desktop. Dragging and dropping application launchers from the
Desktop to the Panel (or from the Panel to the Desktop) creates
a copy of the launcher in the new location rather than moving it. In
general, applets may not be copied from the Panel to the Desktop.

Configuringthe Panel
You can hide the panel automatically or manually, place it on any
edge of your desktop, change its size and color, and change the way
it behaves. To alter the default panel settings, right-click in an
unused area of the panel and select Properties. If you choose to
hide the panel, it does not appear on the desktop until you move
your mouse pointer over the panel area

Customizingyour GNOMEsession

The Preferences sub-menu of the Applications menu offers many


customization options for your GNOME session. Below are some of
the highlights.

Configuring your Background


One way to dramatically alter the appearance of your graphical
desktop is to change the background using the Desktop
Background Preferences tool. You can choose from several
background images included with Red Hat Enterprise Linux in the
/usr/share/backgrounds/ directory, or you can use your own image.
To start the Desktop Background Preferences tool, right-click on
the desktop and choose Change Desktop Background from the
menu
The Desktop Background Preferences tool allows you to load a
background from a directory of provided images
(/usr/share/backgrounds/images/). To add images to the list of
available backgrounds, you can either drag them from your
directory into the list (which does not move the file) or you can click
the AddWallpaperbutton and select image files on your system.

There are several ways to display your images. The Tiled option
displays multiple instances of your image across the desktop, which
is useful if you use a small image or if you use a tile (or pattern)
image from /usr/share/backgrounds/tiles/ (or from your own image
collection). The Centered option places your image in the center of
the desktop, leaving the default background colors to fill in any
remaining desktop space. To fill the desktop with an image without
tiling it, use the Scaled or Stretched options.

To create a background with your own custom colors and no


images, choose the No Wallpaper option and adjust your colors
below Desktop Colors. You can choose either a solid color or a
gradient of two colors. Clicking on the color buttons allows you to
change the colors. Click Close to save and exit the Background
Preferences tool.
KeyboardShortcuts

You can create keyboard shortcuts — pressing a combination of


keys on the keyboard — to perform actions within an application or
on your desktop. Open the Keyboard Shortcuts application from
the Applications => Preferences sub-menu. The application
provides a list of every action to which you can assign a shortcut. It
might be helpful to spend a few moments looking at the default
shortcuts; using them can be a great time-saver. Scroll through the
list until you find the action you would like to assign a shortcut. Click
once on the description of the action, and then press the keystrokes
that you would like to use as a shortcut.

To create a keyboard shortcut to switch between workspaces by


pressing [Ctrl]-[Alt] and workspace number:

1. Click on Switch to workspace 1

2. Press [Ctrl]-[Alt]-[1].

3. The Keyboard Shortcut application records that these


were the keys pressed, and lists that under the Shortcut
column. (The application notifies you if the keystrokes you
have chosen are already used for another action.)
4. Repeat this process for workspaces 2-4, assigning each of
them similar keystrokes.

5. Close the Keyboard Shortcuts application to save your


changes.

6. Pressing [Ctrl]-[Alt]-[2] at any time takes you to Workspace


2. Likewise, pressing [Ctrl]-[Alt]-[3] takes you to workspace
3, [Ctrl]-[Alt]-[4] takes you to workspace 4, and [Ctrl]-[Alt]-
[1] takes you back to workspace 1.

Sound
The Sound preference tool allows you to set sounds to accompany
events. For example, your system can play a certain sound every
time you login. When you first open this tool, you should see a
series of tabs across the top of the window. Under the General tab,
check that the Enable sound server startup box is checked.

Click on the Sound Events tab, to display a list of actions that can
be accompanied by a sound. To change or add a sound to an event,
click on the description of the event, then click on the Browse... button.
Choose a sound located in the file system, and then click Open. Sound
files installed with Red Hat Enterprise Linux are located in
/usr/share/sounds/. You may also choose a sound file from your
home directory. Any file with a .wav extension can be used for an
event sound. To listen to a sound that has been selected, click the
Play button.

Screensaver
Double-click the Screensaver icon to launch the Screensaver
Preferences tool. The list on the left displays the available
screensavers. Nearly all screensavers can be customized by clicking
on the Settings... button. To see if this is the screensaver you would like
to use, click on the Previewbutton. When you have seen enough, click
the mouse anywhere on the screen and you will return to
Screensaver Preferences. When you are finished, close the
window to save your changes and exit.

RemovableStorage
Launch the Removable Storage tool from the Applications =>
Preferences sub-menu. The application opens a list of options for
the way your system handles removable storage media such as
floppy diskettes and CD-ROMs. One default option is auto-mounting.
Auto-mount means that the data on your removable media is
automatically available a few moments after you insert it; manual
mounting is not necessary

ManagingFiles and Directories

File System Terms


Extension

An extension is that part of a filename that is found after the final


".". In the filename foo.txt ".txt" is the file's extension. Extensions
are used to indicate file type.

Path

A path is the string of directories and sub-directories you would


have to navigate through in order to reach a given location in the
file system.

root access (or root privileges)

To have root access means to be logged in using the root account.


This can be done from the main login screen, a shell prompt, or any
application that requires your root password. Root access means
that the user has permission to do anything on the system, so use
root access with care.

root directory

The root directory is the top-most directory of the _le system. All
other _les and directories exist in this directory or one of its sub-
directories. Do not confuse the root directory, /, with root's
home directory, /root/.

Managing Files

If you are new to Linux, file names may look strange to you. Linux
file names may include extensions you haven't seen before, may
have multiple extensions, or may not have any at all. File names
may begin with a "." or may have other symbols in their names,
including spaces.

File Types

Compressed and Archived Files

.bz2  a file compressed with bzip2


.gz  a file compressed with gzip

.tar  a file archived with tar (short for tape archive), also known as
a tar file

.tbz or .tar.bz  a tarred and bzipped file

.tgz or .tar.gz  a tarred and gzipped file

.zip  a file compressed with ZIP compression, commonly found in


MS-DOS applications

File Formats

.au  an audio file

.gif  a GIF image file (short for Graphics Interchange Format)

.html or .htm  an HTML file (short for Hyper Text Markup


Language)

.jpg  a JPEG image file (short for Joint Photographic Experts Group)

.pdf  an electronic image of a document; PDF stands for Portable


Document Format

.png  a PNG image file (short for Portable Network Graphic)

.ps  a PostScript file; formatted for printing

.txt  a plain ASCII text file

.wav  an audio file

.xpm  an image _le (short for X Pixelmap)

SystemFiles

.conf  configurations file; configuration files sometimes use the


.cfg extension, as well

.lock  a lock file; determines whether a program or device is in use


.rpm  a Red Hat Package Manager file used to install software

Programming and Scripting Files

.c  a C program language source code file

.cpp  a C++ program language source code file

.h  a C or C++ program language header file

.o  a program object file

.pl  a Perl script

.py  a Python script

.so  a library file

.sh a shell script

.tcl  a TCL script

File Compressionand Archiving


It is useful to store a group of files in one file for easy backup, for
transfer to another directory, or for transfer to another computer. It
is also useful to compress large files; compressed files take up less
disk space and download faster via the Internet.

It is important to understand the distinction between an archive file


and a compressed file. An archive file is a collection of files and
directories stored in one file. The archive file is not compressed — it
uses the same amount of disk space as all the individual files and
directories combined. A compressed file is a collection of files and
directories that are stored in one file and stored in a way that uses
less disk space than all the individual files and directories combined.
If disk space is a concern, compress rarely-used files, or place all
such files in a single archive file and compress it.

UsingFile Roller
Red Hat Enterprise Linux includes a graphical utility called File
Roller. File Roller can compress, decompress, and archive files in
common Unix and Linux formats. It has a simple interface and
extensive help documentation. To start File Roller, select Archive
Manager from the Applications (the main menu on the panel) =>
System Tools sub-menu. File Roller is also integrated into the
desktop environment and Nautilus.

DecompressingandUnarchivingwith File Roller

To unarchive and/or decompress a file, click the Openbutton on the


main toolbar. A file menu pops up, allowing you to choose the
archive you wish to manipulate. For example, if you have a file
called foo.tar.gz located in your home directory, highlight the file and
click OK. The file appears in the main File Roller browser window as
a folder, which you can navigate by double-clicking the folder icon.
File Roller preserves all directory and subdirectory structures,
which is convenient if you are looking for a particular file in the
archive. You can extract individual files or entire archives by clicking
the Extract button, choosing the directory in which to save the
unarchived files, and clicking OK.
CreatingArchiveswith File Roller

File Roller allows you to create archives of your files and


directories. To create a new archive, click New on the toolbar. A file
browser pops up, allowing you to specify an archive name and the
compression technique. For example, you may choose a Tar
Compressed with gzip (.tar.gz) format from the drop-down menu
and type the name of the archive file you want to create. Click OK
and your new archive is ready to be filled with files and directories.
To add files to your new archive, click Add, which opens a browser
window that you can navigate to find the file or directory to add to
the archive. Click Add when you are finished, and click Archive =>
Close to close the archive.

Compressing Files at the Shell Prompt

Bzip2 and Bunzip2

To use bzip2 to compress a file, enter the following command at a


shell prompt:

bzip2 filename
The file is compressed and saved as filename.bz2.

To expand the compressed file, enter the following command:

bunzip2 filename.bz2

The filename.bz2 compressed file is deleted and replaced with


filename.

You can use bzip2 to compress multiple files and directories at the
same time by listing them with a space between each one:

bzip2 filename.bz2 file1 file2 file3 /usr/work/school

The above command compresses file1, file2, file3, and the contents
of the /usr/work/school/ directory (assuming this directory exists)
and places them in a file named filename.bz2.

Gzip and Gunzip

To use gzip to compress a file, enter the following command at a


shell prompt:

gzip filename

The file is compressed and saved as filename.gz.

To expand the compressed file, enter the following command:

gunzip filename.gz

The filename.gz compressed file is deleted and replaced with


filename.

You can use gzip to compress multiple files and directories at the
same time by listing them with a space between each one:

gzip -r filename.gz file1 file2 file3 /usr/work/school

The above command compresses file1, file2, file3, and the contents
of the /usr/work/school/ directory (assuming this directory exists)
and places them in a file named filename.gz.

Zip and Unzip

To compress a file with zip, enter the following command:


zip -r filename.zip filesdir

In this example, filename.zip represents the file you are creating


and filesdir represents the directory you want to put in the new zip
file. The -r option specifies that you want to include all files
contained in the filesdir directory recursively.

To extract the contents of a zip file, enter the following command:

unzip filename.zip

You can use zip to compress multiple files and directories at the
same time by listing them with a space between each one:

zip -r filename.zip file1 file2 file3 /usr/work/school

The above command compresses file1, file2, file3, and the contents
of the /usr/work/school/ directory (assuming this directory exists)
and places them in a file named filename.zip.

Archiving Files at the Shell Prompt

A tar file is a collection of several files and/or directories in one file.


This is a good way to create backups and archives.

Some of tar's options include:

-c  creates a new archive

-f  when used with the -c option, use the filename specified for the
creation of the tar file; when used with the -x option, unarchive the
specified file

-t  show the list of files in the tar file

-v  show the progress of the files being archived

-x  extract files from an archive

-z  compress the tar file with gzip

-j  compress the tar file with bzip2

To create a tar file, enter:

tar -cvf filename.tar directory/file


In this example, filename.tar represents the file you are creating
and directory/file represents the directory and file you want to put in
the archived file.

You can tar multiple files and directories at the same time by listing
them with a space between each one:

tar -cvf filename.tar /home/mine/work /home/mine/school

The above command places all the files in the work and the school
subdirectories of /home/mine in a new file called filename.tar in the
current directory.

To list the contents of a tar file, enter:

tar -tvf filename.tar

To extract the contents of a tar file, enter:

tar -xvf filename.tar

This command does not remove the tar file, but it places copies of
its unarchived contents in the current working directory, preserving
any directory structure that the archive file used.

Managing Directories
In manyways, directoriesare treatedlike files. Theycan be created,deleted, movedand
copiedfromNautilusor froma shell prompt, usingcommandssimilar to thosefor files.

CreatingDirectories

You must have write permissions in a directory in order to create a


new sub-directory. Most users have these permissions in their home
directory (and its sub-directories) and the /tmp/ directory.

To create a new directory with Nautilus, navigate to the location of


your new directory. Right-click in a blank portion of the window and
select Create Folder. A new folder icon appears with the
highlighted text untitled folder. Type a name for your folder and
press [Enter].

To create a new directory using a shell prompt, use the command


mkdir. Enter: mkdir <directory-name>, replacing <directory-name> with
the intended title of the new directory.
DeletingDirectories
To delete a directory from Nautilus, right click on it and choose
Move to Trash, or click and drag the icon to the Trash on the
Desktop.

To delete an empty directory from a shell prompt, enter the


command rmdir. To delete a directory that may not be empty (and
consequently everything inside that directory), enter the command
rm -rf <directory>.

Shell PromptBasics
Why Use a Shell Prompt

Graphical environments for Linux have come a long way in the past
few years. You can be perfectly productive in the X Window System
and only have to open a shell prompt to complete a few tasks.
However, many Red Hat Enterprise Linux functions can be
completed faster from the shell prompt than from a graphical user
interface (GUI). In less time than it takes to open a _le manager,
locate a directory, and then create, delete, or modify _les from a
GUI, a task can be finished with just a few commands at a shell
prompt.

A shell prompt looks similar to other command line interfaces with


which you might be familiar. Users type commands at a shell
prompt, the shell interprets these commands, and then the shell
tells the OS what to do. Experienced users can write shell scripts to
expand their capabilities even further.

Shell PromptTerms
Below are a few terms to know before beginning the discussion of
the shell prompt.

command line

The command line is where options to a command are placed. The


following is an example of a command line:

command -options <filename>

shell prompt

The shell prompt is the marker on the screen that shows where the
command line should be placed. The following is an example of a
shell prompt:
[[email protected] username]$

Shell

The shell is the program that interprets commands so that the


operating system can understand them.

terminal window

The terminal window is the window that contains the shell prompt,
command line, and output from the shell.

Opening and using a Shell Prompt

A terminal window is opened from the Applications (the main


menu on the panel), or by right-clicking on the desktop and
selecting Open Terminal.

Entering or running a command refers to typing a given command


and pressing [Enter]. To close a terminal window, either click on the
[X] in the upper right corner of the screen or enter the exit
command at the shell prompt.

The shell prompt within a terminal window looks something like this:

[[email protected] username]$

There are any number of symbols that can be used to indicate the
end of the shell prompt, and you can customize what your prompt
looks like. However, there are two symbols that you will see more
often than any others, "$" and "#". The first symbol, "$", is the last
character in the prompt when you are logged in as a normal user.
The shell prompt for a normal user looks something like this:

[[email protected] username]$

The second symbol, "#", is the last character in the prompt when
you are logged in as root. This is true whether you logged in as root
from the initial screen or if you executed the su - command to
become root. The shell prompt for root looks something like this:

[[email protected] root]#

This slight difference can help remind you what privileges you
currently have.
Structure of shell prompt commands

In general, a command run from the shell prompt will have the
following format:

command -options <filename>.


Both -options and <filename> are optional: the command may not
require either one, or it may require multiple options and files.

When specifying multiple options, list them as a group. For


example, to see a long listing of information (-l) about all files (-a) in
a directory, you would run the command:

ls -la

There are many variations in required information types for


individual commands. If you aren't sure about a command and how
it is used, you can do one of three things:

1) Enter the command alone at a shell prompt and press [Enter]. For
example, entering cp alone returns a brief description of the
command and its usage. Other commands, such as cat, require no
arguments or _les to run as normal. To quit such a command, press
[Ctrl]-[D]. If that does not work, press [Ctrl]-[C].

2) Enter man command at a shell prompt. This opens the manual


page for that command. A man page is a manual written by the
command's developer explaining how it is used and what each
option means. You can also enter man man at a shell prompt for
more information on man pages.

Navigate through the man page using the directional keys on your
keyboard. The [Space] bar moves you down a page, [B] moves you
up a page. To quit, press [Q]. If the man page for a command is
either unavailable or does not provide enough information, the info
system may provide additional information.

3) Enter info command at a shell prompt. Some info pages have


the same information as man pages, but navigation is slightly
different. For more information, enter info info at a shell prompt.

Usefultips for the bashshell


Tab Completion

Tab completion is one of the most useful shortcuts available at the


command line. Red Hat Enterprise Linux has the ability to "guess"
what command, directory, or filename you are entering at the shell
prompt. Press the [Tab] key, and the shell offers possible
completions for partial words. The more letters typed before
pressing [Tab], the closer the shell comes to the intended
command.

The shell assumes that the first word entered at the prompt is a
command. The possible completions it offers are the names of
commands or applications. This can be helpful if you are not sure of
the exact spelling of a command or if you are searching for a certain
command. It can also serve to help a new user become familiar with
the available commands.

For example:

1. Type the letter g at a prompt and press [Tab] twice.

2. The shell asks if you want to see all 379 possibilities. This means
that there are 379 commands that start with the letter "g".
Searching through this list would take too much time.

3. Press [N] for no.

4. Entering more of the command name will produce a shorter list of


possible matches. For this example, type gnome and press [Tab]
twice. A list of every command that starts with "gnome" appears.
This is a much shorter list, and can be scrolled through using the
same keys as man pages. Scroll to the end of the list to return to the
shell prompt. The letters "gnome" are still entered.

5. To finish entering a command with tab completion, enter just a


few more characters, "-ca", and press [Tab] twice. The shell returns
a match of gnome-calculator, and if you then press [Enter],
the GNOME Calculator application starts.

Command History

It is unnecessary to type the same command over and over. The


bash shell remembers your past commands. These commands are
stored in the .bash_history file in each user's home directory.
To use the history, press the up arrow to scroll backward through
the commands you have already entered. The [Ctrl]-[R] shortcut
searches through your previous commands. Press [Ctrl]-[R] and type
the beginning of the command you previously issued. The command
history stops at the most recent version of that command.

Commands that you only typed partially and did not follow with
[Enter] are not saved into your command history file. To clear your
command history,
type history -c.
By default, Red Hat Enterprise Linux stores 1000 commands. Each
terminal window or shell prompt stores a separate set of commands.
If you gain root privileges by using the command su -, the history
file (and thus the commands) you access are root's, not the user's.

Wildcards

Wildcards are place holders used to allow users to search for or use
multiple files with similar names.

The subject of wildcards is part of the larger subject of regular


expressions. Two of the most common wildcards are "*" and "?".
The asterisk, "*", represents any character or string of characters.

The entry a*.txt could refer to ab.txt as well as aardvark.txt.

The question mark represents a single character. The entry a?.txt


could refer to ab.txt and a1.txt, but not aardvark.txt.

Useful Keystrokes

Clearing and Resetting the Terminal

The terminal window begins to look crowded very quickly. You can
always exit from the terminal window and open a new one, but
there is a quicker and easier way to remove the contents displayed
in the terminal.

To clear the terminal, enter the command clear at the shell prompt.
The clear command clears the terminal, leaving only a new shell
prompt at the top of the window.
You can also clear the screen using the keystroke [Ctrl]-[L].
Determining Your Current Directory with pwd

As you browse directories, it is easy to get lost or forget the name of


your current directory. By default, the Bash prompt in Red Hat
Enterprise Linux shows only your current directory, not the entire
path.

For example, the path to the application gedit is /usr/bin/gedit. The


path to user someone's home directory is /home/someone/

To display the location of your current working directory, enter the


command pwd.

The output should look similar to:

/home/user

Manipulating Files in Your Current Working Directory


ViewingDirectoryContentswith ls

To see what is in your current working directory, use the ls


command.

Many options are available with the ls command. The ls command,


by itself, does not show all of the files in the directory. Some files
are hidden files (also called dot files) and can only be seen with an
additional option specified to the ls command.

Enter the command ls -a. Now you an view the hidden "dot" files.
Viewing all the files using the ls -a command can give you plenty of
detail, but you can view still more information by using multiple
options.

To see the size of a file or directory, when it was created, and so on,
add the long option (-l) to the ls -a command. This command shows
the file creation date, its size, ownership, permissions, and more.

You do not have to be in the directory whose contents you want to


view to use the ls command. For example, to see what is in the /etc/
directory from your home directory, type:

ls -al /etc
The following is a brief list of options commonly used with ls.
Remember, you can view the full list by reading the ls man page
(man ls).

• -a (all) — Lists all files in the directory, including hidden


files (.filename). The .. and . at the top of your list refer to
the parent directory and the current directory,
respectively.

• -l (long) — Lists details about contents, including


permissions (modes), owner, group, size, creation date,
whether the file is a link to somewhere else on the system
and where its link points.

• -F (file type) — Adds a symbol to the end of each listing.


These symbols include /, to indicate a directory; @, to
indicate a symbolic link to another file; and *, to indicate
an executable file.

• -r (reverse) — Lists the contents of the directory in reverse


sort order.

• -R (recursive) — Lists the contents of all directories below


the current directory recursively.

• -S (size) — Sorts files by their sizes.

Copyingfiles with cp
To create a copy of an existing file, use the cp command.

While cp does have options, they are not used as often as those of
other commands. To view these options, read the man page by
entering man cp at a shell prompt.

To copy files within the current directory specify the new name then
command line is.

cp original_file new_file
This command creates a new file, named new_file, with the same
content as the original file.

To copy a file to a different directory, specify a path as the third


word on the command line:

cp original_file /dir1/dir2/

This command creates a copy of original_file in dir2/. If the last part


of the path is a filename instead of a directory, the copy has that
new name.

cp original_file /dir1/dir2/new_file

This creates a new file named new_file with the contents of


original_file in dir2/.
Alternatively, if you know where the file is and would like to place a
copy of it in your current directory, enter the path as word two and
"." as the third word.

cp /dir1/dir2/filename

The above command places a copy of filename in your current


working directory.

Movingfiles with mv
To move a file or directory from one location to another, use the
command mv.

Common useful options for mv include:

• -i (interactive) — Prompts you if the file you have selected


overwrites an existing file in the destination directory.

• -f (force) — Overrides the interactive mode and moves


without prompting. Be very careful about using this option.

• -v (verbose) — Shows the progress of the files as they are


being moved.

To move a file from the current directory to another location, enter a


path as the third word on the command line.

mv filename /dir1/
This command would remove filename from the current working
directory and place it in /dir1/.

Alternatively, a path to the location of the file may be entered as the


second word and "." as the thrid word. This moves the file from the
location specified in word two into your current working directory.

mv /tmp/filename

The above command moves the file filename from the /tmp/
directory into your current working directory.

Renamingfiles with mv
To rename a file or directory, use the mv command.

To rename a file with mv, the third word on the command line must
end in the new filename.

mv original_name new_name

The above command renames the file original_name to new_name.

Deletefiles with rm
To delete a file using rm enter the following at a shell prompt

rm filename

The second word can also be a path, but must end in a file.

rm ../../filename

There are many options to rm. To view them all, enter man rm at
the shell prompt.

• -i (interactive) — Prompts you to confirm the deletion. This


option can stop you from deleting a file by mistake.

• -f (force) — Overrides interactive mode and removes the


file(s) without prompting. This might not be a good idea,
unless you know exactly what you are doing.

• -v (verbose) — Shows the progress of the files as they are


being removed.

• -r (recursive) — Deletes a directory and all files and


subdirectories it contains.
Deletingdirectories
There are two commands that can be used to delete directories. The
first is rmdir and the second is rm.

The rmdir command will only delete directories that are empty. If
you are concerned about accidentally deleting a directory that is not
empty, use this command.

rmdir directory/

The above command permanently deletes directory/ if it is empty.

If you want to delete a directory and all of its contents, use the
command rm -rf. Note that if you enter rm -rf, the shell will not ask if
you are sure before permanently deleting the directory.

rm -rf /dir1/

The above command deletes /dir1/ and every file and sub-directory
that exists inside.

LeavingyourCurrentWorkingDirectory
To change directories from your current working directory, use the
command cd.

cd /tmp/

The above command changes directories to the /tmp/


directory. The second word on the command line must be a
path. It can either be relative or absolute, and can move one
directory or many. If the cd command is entered at the shell
prompt with no options or path specified, the default action is
to move the user into their home directory. For example, user
someone would be moved to the /home/someone/ directory.

The cd has many useful options. You can see all of these
options by entering man cd at the shell prompt. The most
commonly used options are listed below.

• cd — Returns you to your login directory

• cd - — Returns you to your previous working directory

• cd ~ — Also returns you to your login directory


• cd / — Takes you to the entire system's root directory.

• cd /root — Takes you to the home directory of the root


user. You must be the root user to access this directory.

• cd /home — Takes you to the home directory, where


user login directories are usually stored

• cd .. — Takes you to the directory one level up.

• cd ~otheruser — Takes you to otheruser's home


directory, if otheruser has granted you permission.

Below are a few examples of the use of cd.

• cd /dir1/dir2/ — Regardless of which directory you are


in, this absolute path takes you directly to dir2, a
subdirectory of /dir1/.

• cd ../../dir2/dir3/ — This relative path takes you up two


directories, then to dir2/, and finally into its
subdirectory dir3/.

Viewingtext files fromthe shell prompt

The headCommand
The head command displays the beginning of a file. The format
of the head command is:

head <filename>

By default, you can only read the first ten lines of a file. You can
change the number of lines displayed by specifying a number
option.

head -20 <filename>

The above command would display the first 20 lines of a file


named <filename>.

The tail Command


The reverse of head is tail. Using tail, you can view the last ten
lines of a file. This can be useful for viewing the last ten lines of a
log file for important system messages. You can also use tail to
watch log files as they are updated. Using the -f option, tail
automatically prints new messages from an open file to the
screen in real-time. For example, to actively watch
/var/log/messages, enter the folowing at a shell prompt (as the
root user):

tail -f /var/log/messages

Press [Ctrl]-[C] when you are finished

The moreCommand
The more command is a "pager" utility used to view text in the
terminal window one page or screen at a time. The [Space] bar
moves forward one page and [Q] quits.

ViewingFileswith less
The format of the less command is:

less <filename>

The main difference between more and less is that less allows
backward and single-line movement using the same navigation
as man pages: press the [Space] bar to go down one page, the
[B] to go back one page, the directional (or "arrow") keys to
move one line at a time, and [Q] to quit.

To search the output of a text file using less, press [/] and enter
the keyword to search for within the file.

/stuff

The above command would search through the file for all
instances of "stuff" and highlight them in the text.

Viewingand creatingfiles with cat


The cat command is a versatile utility. It can be used to view
text, to create text files, and to join files. Its name is short for
concatenate, which means to combine files.

Using cat alone echoes on the screen any text you enter. It will
continue to do so until you exit with the [Ctrl]-[D] keystroke.
Entering the cat command followed by a file name displays the
entire contents of the file on the screen. If the file is long, the
contents scroll off the screen.

The grepCommand
The grep command is useful for finding specific character strings
in a file. For example, to find every reference made to "pattern"
in the file <filename>, enter:

grep pattern <filename>

Each line in the file that includes the pattern "pattern" is located
and displayed on the screen/

Manipulating Information from the Shell


From the shell's point of view, there are three kinds of
information: standard input, standard output, and standard error.
In simple terms, standard input is the information that a user
enters from the keyboard for the shell to use, such as commands
and filenames. Standard output is essentially the information the
shell prints on the screen after evaluating a user's commands.
Standard error is the information that indicates that something
has gone wrong. Collectively, these three types of information
are referred to as standard I/O (input/output).
The ability to manipulate and use information from the shell is
one of the strengths of Red Hat Enterprise Linux. This section
discusses the simpler aspects of standard I/O manipulation

Pipesand Pagers
we saw that using cat to view a large file causes the contents to
scroll off the screen. Using a pipe, we can control that behavior.
A pipe is the ( | ) symbol. It is used to connect the standard
output of one command to the standard input of another
command. Essentially, it allows a user to string commands
together. Pagers are commands (such as less) that display text
in the terminal window.

Using cat, the pipe (|), and less together displays the file one
page at a time. You can then use the up and down arrow keys to
move backward and forward through the pages
cat <filename> | less

The above command opens the file named <filename> using the
cat command, but does not allow it to scroll off the screen.

Using the pipe with a pager is also useful when examining large
directories with ls. For example, view the /etc/ directory with the
ls command.

ls -al /etc/

Notice that the contents scroll past too quickly to view. To get a
closer look at the output of the ls command, pipe it through less.

ls -al /etc/ | less

Now you can view the contents of /etc/ one screen at a time.
Remember that you can navigate forward and backward through
the screens and even search for specific text using the [/] key.

You can combine redirection with wildcards.

ls -al /etc/ a* | less

The above displays all files and directories in /etc/ that start with
the letter "a" one screen at a time.

UsingRedirection
Redirection means changing where standard input comes from
or where the standard output goes.

To redirect standard output, use the > symbol. Placing > after
the cat command (or after any utility that writes to standard
output) redirects its output to the file name following the symbol.

Remember that the cat command echoes the text you enter on
the screen. Those echoes are the standard output of the
command. To redirect this output to a file, type the following at a
shell prompt and press Enter: cat > foo.txt. Enter a few more
lines of text, and use the [Ctrl]-[D] key combination to quit cat.

The following screen is an example, redirecting three lines of


text into the file foo.txt.
The following screen is another example, redirecting three more
lines of text to create the file bar.txt.
The following screen demonstrates cat's concatenate function,
adding the contents of bar.txt to the end of foo.txt. Without
redirection to the file example1.txt, cat displays the
concatenated contents of foo.txt and bar.txt on the screen.

The

following screen displays the contents of example1.txt, so that


the user can see how the files were added together.
AppendingStandardOutput
The symbol >> appends standard output. This means it adds the
standard output to the end of a file, rather than over-writing the
file.

The following screen shows the command to append bar.txt to


foo.txt. The contents of bar.txt are now permanently added to
the end of foo.txt. The cat command is called a second time to
display the contents of foo.txt.

To

compare example1.txt and the modified foo.txt, use the diff


command. diff compares text files line-by-line and reports the
differences to standard output. The following screen shows the
comparison between example1.txt and foo.txt. Because there are no
differences, diff returns no information

RedirectingStandardInput
You can also performthe sametype of redirectionwith standardinput.

Whenyou use the redirect standardinput symbol<, you are telling the shell that you
want a file to be read as input for a command.

The followingscreenshowsfoo.txt beingredirectedas input for cat:


A Comparisonof CommonDOSandLinuxCommands

Command's MS-DOS Linux BasicLinuxExample


Purpose

Copiesfiles copy cp cp thisfile.txt


/home/thisdirectory
Command's MS-DOS Linux BasicLinuxExample
Purpose

Movesfiles move mv mv thisfile.txt


/home/thisdirectory

Lists files dir ls ls

Clears cls clear clear


screen

Closesshell exit exit exit


prompt

Displaysor date date date


sets date

Deletesfiles del rm rm thisfile.txt

"Echoes" echo echo echo this message


output to the
screen

Edits text edit gedit gedit thisfile.txt


files

Compares fc diff diff file1 file2


the contents
of files

Findsa find grep grep word or phrase


string of text thisfile.txt
in a file

Formatsa format a: mke2fs /sbin/mke2fs /dev/fd0


diskette (if diskette (/dev/fd0 is the Linux
is in A:) equivalent of A:)

Displays command man or man command


command /? info
help

Createsa mkdir mkdir mkdir directory


directory

Views more less less thisfile.txt


Command's MS-DOS Linux BasicLinuxExample
Purpose

contentsof a
file

Renamesa ren mv mv thisfile.txt thatfile.txt


file

Displays chdir pwd pwd


your location
in the file
system

Changes cd cd cd /directory/directory
directories pathname pathnam
with a e
specified
path
(absolute
path)

Changes cd.. cd .. cd ..
directories
with a
relativepath

Displaysthe time date date


time

Shows mem free free


amountof
RAMin use

Notes:
a. Gedit is a graphical text editor; other editors you can use in
place of Gedit include nano and vi.
b. The more pager can also be used to page through a file one
screen at a time.
c. The mv command can both move a file and, if you want to
rename a file in the same directory, "move" that file to the
same directory with a new name.

SystemDirectories
This is a list of the primary Red Hat Enterprise Linux system
directories. Each directory is described briefly.

• /bin/ — Used to store user commands. The directory /usr/bin/


also stores user commands.

• /sbin/ — Location of many system commands, such as


shutdown. The directory /usr/sbin/ also contains many system
commands.

• /root/ — The home directory of root, the superuser.

• /misc/ — This directory is used for automatically mounting


directories on removeable devices (such as Zip drives) and
remote directories (such as NFS shares) using autofs. Refer to
the autofs manual page (type man autofs at a shell prompt)
for more information.

• /mnt/ — This directory typically contains the mount points for


file systems mounted after the system is booted.

• /media/ — This directory contains the mount points for


removable media, such as diskettes, CD-ROMs, and USB flash
drives.

• /boot/ — Contains the kernel and other files used during


system startup.

• /lost+found/ — Used by fsck to place orphaned files (files


without names).

• /lib/ — Contains many device modules and library files used by


programs in /bin/ and /sbin/. The directory /usr/lib/ contains
library files for user applications.

• /dev/ — Stores device files.

• /etc/ — Contains configuration files and directories.

• /var/ — For variable (or constantly changing) files, such as log


files and the printer spool.

• /usr/ — Contains files and directories directly relating to users


of the system, such as programs and supporting library files.

• /proc/ — A virtual file system (not actually stored on the disk)


that contains system information used by certain programs.

• /initrd/ — A directory that is used to mount the initrd.img


image file and load needed device modules during bootup.

• /tftpboot/ — Contains files and applications needed for


Preboot Execution Environment (PXE), a service that allows
client machines and machines without hard drives to boot an
operating system from an image on a central PXE server.

• /tmp/ — The temporary directory for users and programs.


/tmp/ allows all users on a system read and write access.

• /home/ — Default location of user home directories.

• /opt/ — Directory where optional files and programs are


stored. This directory is used mainly by third-party developers
for easy installation and uninstallation of their software
packages.

FILESYSTEMLAYOUT
KeyboardShortcuts
Here are a few keyboard shortcuts you can use to perform common
tasks quickly

• [Ctrl] + [Alt] + [Backspace] = kills your current X session. Kills


your graphical desktop session and returns you to the login
screen. Use this if the normal exit procedure does not work.

• [Ctrl] + [Alt] + [Delete] = From a non-graphical shell prompt,


shuts down your Red Hat Enterprise Linux system. Use only
when the normal shutdown procedure does not work. In a
graphical desktop session, this shortcut displays the desktop
logout screen that allows you to logout, reboot, or shut down
your system.

• [Ctrl] + [Alt] + [Fn] = switches screens. [Ctrl]+[Alt] + one of


the function keys displays an available screen. By default, [F1]
through [F6] are text-mode shell prompt screens and [F7] is
the graphical desktop screen.

• [Alt] + [Tab] = switches tasks in a graphical desktop


environment. If you have more than one application open at a
time, you can use [Alt] + [Tab] to switch among open tasks
and applications.

• [Ctrl] + [a] = moves cursor to the beginning of a line. This


works in most text editors and in the URL field in Mozilla.

• [Ctrl] + [d] = logout of (and close) shell prompt. Use this quick
shortcut instead of typing exit or logout.

• [Ctrl] + [e] = moves cursor to end of a line. This works in most


text editors and in the URL field in Mozilla.

• [Ctrl] + [l] = clears the terminal. This shortcut does the same
thing as typing clear at a command line.

• [Ctrl] + [u] = clears the current line. If you are working in a


terminal, use this shortcut to clear the current line from the
cursor all the way to the beginning of the line.

• [Middle Mouse Button] = pastes highlighted text. Use the left


mouse button to highlight the text. Point the cursor to the spot
where you want it pasted. Click the middle mouse button to
paste it. In a system with a two-button mouse, if you
configured your mouse to emulate a third mouse button, you
can click both the left and right mouse buttons simultaneously
to perform a paste.

• [Tab] = command autocomplete. Use this command when


using a shell prompt. Type the first few characters of a
command or filename and then press the [Tab] key. It will
automatically complete the command or show all commands
that match the characters you typed.

• [Up] and [Down] Arrow = shows command history. When


using a shell prompt, press the [up] or [down] arrow to scroll
through a history of commands you have typed from the
current directory. When you see the command you want to
use, press [Enter].

LocatingFilesandDirectories
Find

The format of the find commandis:


find path pattern

Locate

The format of the locate command is:

locate pattern

Which, whereis, whatis

which

The format of the which command is:

which command

which returns the location of binary, or executable, shell


commands

whereis

The format of the whereis command is:

whereis command

command returns the locations of: the binary of find, the


location of the source code, and the location of the find
man page

whatis
The format of the whatis is:

whatis command

This command returns information about the command


from each of its man pages.

Using Multiple Commands


Linux allows you to enter multiple commands at one time. The
only requirement is that you separate the commands with a
semicolon.

Suppose you have downloaded a new file called foobar-1.3-


2.i386.rpm and you want to put it in a new subdirectory within
your home directory called rpms/, but the subdirectory has not
been created. You can combine both the creation of the rpms/
directory and the moving of your downloaded file into the
directory by typing the following at a shell prompt:

mkdir rpms/; mv foobar-1.3-2.i386.rpm rpms/

Running the combination of commands creates the directory and


moves the file in one line.

Working with OpenOffice.org

Feature overview of OpenOffice.org


OpenOffice.org is a powerful office suite that includes word
processing, spreadsheets, and slides. It has all of the
functionality of the best-known office suites, and uses some
powerful additional tools to help you easily create
professional-looking documents.

One of the benefits of using an open source office suite is the


vibrant community of OpenOffice.org users who share their
templates, tutorials, and other information on the web.
Extensive documentation for the OpenOffice.org suite is
available online, both at their website and on various user
sites.

Compatibilitywith otherformats
OpenOffice.org is compatible with most common document
formats, including:

• MS Office, from 6.0 through the present version

• RTF (Rich Text Format)

• StarWriter

• HTML (Hyper Text Markup Language)

• PDF (Portable Document Format)

Currently, OpenOffice.org is not compatible with a few


formats, including:

• MS Works

• WordPerfect

OpenOffice.org Writer
A word processor is like a text editor but has several additional
features that allow you to format, design, and print your
documents without the need to memorize complex formatting
tags or codes. OpenOffice.org Writer is a powerful word
processor that features WYSIWYG formatting - what you see in
the OpenOffice.org Writer window is what you get if you print
or share the document.

Overviewof OpenOffice.orgWriter
Writing documents using OpenOffice.org is similar to other
word processing applications you may have used before. To start
OpenOffice.org Writer, you can either start it from the
Applications by selecting Applications => Office =>
OpenOffice.org Writer, or start it from a shell prompt by
entering oowriter.

When OpenOffice.org Writer opens, you are presented with a


blank document. The margins of the document are represented
by the gray box drawn on the main screen. You can start
entering text immediately.

To create a new file in OpenOffice.org Writer

1. Go to File => New => Text Document or click on the


New document icon in the upper left. (The small arrow
in the upper right of the icon allows you to select the
type of document to create.)

2. Begin entering text.

To open an existing file:

1. Go to File => Open, click on the folder icon, or press


[Ctrl]-[O].

2. A file browser window opens.

3. Use the navigation icons in the upper right or click


through the folders in the window pane to find the file
you wish to open.

4. Either double-click on the file or click once to highlight


it and then click on the Open button to open the file.

To save a file:

1. Click on the floppy disk icon, go to File => Save, or go


to File => Save As.

2. A window opens that shows your file system. If you


have already saved this file before, you will not have to
do anything else.

3. Navigate to the location where you would like to save


your file.

4. Enter a name for your file in the File name field.

5. Select the format for your file from the File type drop
down menu.

6. Click on the Save button

To save your document as a .pdf file, go to File => Export


as pdf. While OpenOffice.org Writer can save as a .pdf, it
cannot read or edit them. To view a .pdf file, see FIXME.

To print a document:

1. Click on the printer icon or go to File => Print or press


[Ctrl]-[P]

2. A window opens with print configuration options.

3. Select the options you would like.

4. Click on the OK button.

To preview a file before printing:


1. Go to File => Page Preview.

2. A new window opens, displaying your file.

3. Examine your document: zoom in and out with the


magnifying glass icons or scroll through the pages with
the page icons near the upper left.

4. You may print from this screen the same way as from
the main screen.

5. When you are finished examining your document, click


the ClosePreviewbutton to return to the main screen.

To change text formatting:

1. Highlight the text you would like to format.

2. Either apply a style to the text with the Stylist (refer to


FIXME) or

3. Choose formatting options from the toolbar, such as


bold, alignment, line spacing, font color, etc.

To add lists to your text:

1. Either highlight existing text you would like to make


into a list or move your cursor to the blank line where
you would like to start the list.

2. Click either the Numbering icon or the Bullets icon.

3. For existing text, your list will automatically be created


and formatted. For new text, enter each list item and
press [Enter].

4. To exit the list, press [Enter] twice.

To format a page:

1. Go to Format => Page.

2. A window opens with several tabs of page options. The


Page tab allows you to change your margins.

3. Select the formatting options you would like to change


for your page.

4. Click on the OK button to apply the changes.

To undo changes:

1. Click on the Undo icon, go to Edit => Undo, or press


[Ctrl]-[Z].
2. If you click on the blue arrow at the top right of the
Undo icon, a list of the previous actions apprears.
Choosing one of these items undoes all actions back to
that point.

OpenOffice.org Calc

OpenOffice.org Calc functions similarly to other


spreadsheet applications. It is useful for creating forms as
well as calculations.

To create a new spreadsheet:

1. Start OpenOffice.org Calc from the Applications


menu bu going to Application => Office =>
OpenOffice.org Calc or enter oocalc at a shell
prompt.

2. Enter text, numbers, or functions.

To open an existing spreadsheet:

1. With OpenOffice.org Calc open, go to File => Open,


click on the Folder icon, or press [Ctrl]-[O].

2. Navigate to the location of the spreadsheet.

3. Double-click on the spreadsheet name or click once to


highlight it and then click the OK button.

To save a spreadsheet:

1. Click on the floppy disk icon, go to File => Save, or go


to File => Save As.

2. A window opens that shows your file system. If you


have already saved this file before, you won't have to
do anything else.

3. Navigate to the lcoation you would like to save your file


in.

4. Enter a name for your file in the File name field.

5. Select the format for your file from the File type drop
down menu.

6. Click on the Save button.

To print a spreadsheet:
1. Click on the printer icon or go to File => Print or press
[Ctrl]-[P].

2. A window opens with print configuration options.

3. Select the options you would like.

4. Click on the OK button.

To manually enter a function:

1. Select the cell where the function should be placed.

2. Enter the function: start with an "=" sign and enter the
name of the function.

3. To use cells in the argument of the function (the part of


the function that is operated on), enter an open
parenthesis, "(", and then highlight the cells with your
mouse. You can also type in the cell names after the
open parenthesis.

4. Press [Enter] to enter the function and calculate the


result.

To enter a function using the Function AutoPilot:

1. Select the cell where the function should go.

2. Go to Insert => Function or press [Ctrl]-[F2].

3. The AutoPilot window opens.

4. Select the function you would like to use from the pane
on the left. You select by double-clicking on the name
of the function.

5. In the right pane, information about the selected


function is displayed. Fields for the data are just below
the function information. Lastly, a box displays the
result of your calculation.

6. To select cells to use in your function, click on the


Shrink icon next to the field these cells will be entered.

7. Highlight the cells with your mouse. Press [Enter] to


return to AutoPilot

8. When finished, click the OK button.

To use conditional formatting:

1. Go to Format => Conditional Formatting...


2. A window opens with formatting options.

3. Select whether the condition applies to a cell or a


function in the far left.

4. Select the condition of the relationship in the next drop-


down box.

5. In the next field, either enter a value or select cells.

6. In the Cell Style drop-down menu, select what the


resulting style should be.

To change cell format:

1. Select the cells to outline by highlighting them with the


mouse.

2. Go to Format => Cells and select the Borders tab, or


click the Borders icon on the Object Bar toolbar.

3. On the Borders tab, choose the color, position, weight,


and line type of your borders. Click the OK button to
apply these borders.

4. The small blue arrow in the upper right of the Borders


icon opens a drop-down menu. Double-click the image
that represents the borders to apply to your selection.

To create a chart:

1. Select the data to use for the chart by highlighting with


the mouse.

2. Go to Insert => Chart.

3. The AutoFormat Chart window opens.

4. Select where you want your chart displayed and click


Next >>.

5. Choose a chart type and click Next >>.

6. Choose a variant and click Next >>.

7. Enter titles for your chart and click Create.

Working with Text Editor

vi
vi is a shell prompt text editor. This means that like less,
opening an instance of vi does not open a GUI window.
Instead, the contents of the file being edited appear in the
current terminal window. Because vi works without a GUI, it
can be used to edit text files even when X is not working.

vi operates via keystrokes — listed below is a small set of the


keystrokes necessary to work with text in vi.

vi uses many more keystrokes. To learn more about vi, view


the manual page by entering man vi at a shell prompt. You
can also access the vim tutorial but entering vimtutor
command at a shell prompt.

Key Action

[i] With a file open, press[i] to enter Insert mode.This modeallowsyou to movethe
cursor and to deleteand add text anywherein the file.

[Esc] Pressingthe [Esc] key at any time takesyou out of Insert modeand into Normal
mode.

[w] [w] writes your changesto the file. Enter Normalmode,press[Shift]-[:], [w], and
finally press[Enter].

[q] [q] quits vi. Enter Normalmode,press[Shift]-[:], [q], and finally press[Enter]. To
saveyour changesbeforeexiting, enter :wq. To quit without savingyour changes,
enter :q!.

[!] [!] forcesvi to executethe commandsthat precedeit.

You might also like