12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Shell Basics 109Reading Text FilesSometimes you want to quickly read a text file such as a configuration file without havingto open a text editor. This is possible with the less, more, and cat command-line utilities.All three have the same basic syntax but work differently and have different commandlineoptions. To use them in their default modes, type the command followed by the textfile to read such as less output.txt, more /var/log/messages, or cat /etc/sysconfig/network.With the less command, the Page Up and Page Down keys can be used to scroll up anddown the contents of the file. The more command only allows you to scroll down the fileusing the spacebar to advance. The cat command outputs the contents of the file to thecommand line and then exits, so if the file is longer than the number of lines in yourterminal, you will only see the last part of the file.The cat command can also be used in conjunction with the grep command that waspreviously discussed with the history command. For example, to view only the kernelmessages in the system log file, use the following command:4cat /var/log/messages | grep kernelBecause only root can view this file, you need to be logged in as the root user to view thecontents. Are you already logged in as a user? Read the later section “Becoming the RootUser” to find out how to perform administrative tasks while logged in as a user.For information on text editors that can read and modify text files, refer to the “EditingText Files” section in this chapter.TIPIf you are unsure of the type of a particular file, use the file commandto find out. If the file type is recognized, the file type will be displayed.Starting ApplicationsStarting an application from the command line is as easy as knowing the name of thecommand, typing it, and pressing the Enter key. For example, to start the application forconfiguring the X Window System, type the command system-config-display and pressEnter. If the command is executed from a terminal window within a graphical environment,the graphical version of the application is started as shown in Figure 4.4.If the application requires the root password to continue, a dialog window appears so thatthe correct root password can be used to authenticate the administrator. A few tools haveboth graphical and text-based versions. However, if you are in a non-graphical environmentand try to start a program that only has a graphical version, an error message suchas cannot open display or requires a currently running X server will be displayed.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!