|
Linux Commands Training Quick Tips - Using the Linux Less & More Commands to View Files - Red Hat
Article Word Count: 471 [View Summary] Comments (0) |
|
The Linux more and less Commands
Both of these commands can be used to view the contents of a file, such as a text file. Linux scripts and system and server configuration files are examples of text files.
- Linux Commands Training Tips: A Linux text file contains only text (letters, numbers and other characters found on your keyboard) and does not contain any formatting, such as left and right margins, bold or underline.
The Linux more Command Example
Run the following command example to display the contents of the inittab configuration file in the etc directory, which is below the / (root) directory.
- $ more /etc/inittab
This shows the first "page" or "screenful" of the file.
Now press the spacebar to see the next "screenful".
Now press the up arrow key and then the down arrow key and see that these keys don't work!
Press q to quit out of the Linux more command.
The Linux less Command Example
This Linux command does everything that more does - and better - this is when less is more!
(A little (very little) Linux programmer humor ;).
Do the following steps to run the less command example below and display the contents of the inittab configuration file again:
Press the up arrow key once, press the Home key, press the Delete key four times to remove "more" and type in "less" (without the quotes). Your command should look like below. Press Enter. Cool.
- $ less /etc/inittab
This shows the first "page" or "screenful" of the file.
Now press the spacebar to see the next "screenful".
Then press the down arrow a few times and the up arrow.
Then press the Page Down key a few times and then the Page Up key.
Press the End key to go to the end of this Linux text file and then Home to go to the top.
Searching for Text in a File When Using the Linux less Command
Need to quickly find some text in a text file? No problem.
You can easily search for text by pressing the / (slash) key and then typing the text you need to find.
Press Home to go to the top of the file and type in the following: /runlevel and all occurrences of this text appears highlighted.
To move to the next occurrence of the text you're searching for, type the letter n and to go to the previous occurrence type the letter p. Easy!
Press q to quit out of the less command.
This "Linux Commands Training Quick Tips" show the use of the more and less commands, which are GNU Linux commands. And these commands are the "core" set of commands in ALL Linux distributions.
These "Linux Commands Training - Quick Tips" work in Ubuntu, Red Hat, SUSE, openSUSE, Debian, Slackware, Fedora - and ALL other Linux distros.
|
By the way...do you want to learn exactly how to use Linux and run Linux commands for Linux System Administration and get real, practical Linux training experience by running hundreds of examples of Linux commands? Just click to download my free new Linux commands training course book and Linux audio podcast (.mp3) files here: Linux Commands Training Mini-Course Clyde Boom says "Learn how to use Linux commands with easy, self-paced Linux training materials that show you how to run hundreds of examples of the essential Linux System Administration commands - and get that new and better job, promotion, raise - or keep your current job!" You can get your instant access to my free Linux commands training course at: http://www.LinuxCommandsTrainingCourse.com Article Source: http://EzineArticles.com/?expert=Clyde_E._Boom |
|
This article has been viewed 235 time(s).
Article Submitted On: November 27, 2008
-
MLA Style Citation:
Boom, Clyde E. "Linux Commands Training Quick Tips - Using the Linux Less & More Commands to View Files - Red Hat." Linux Commands Training Quick Tips - Using the Linux Less & More Commands to View Files - Red Hat. 27 Nov. 2008 EzineArticles.com. 9 Feb. 2010 <http://ezinearticles.com/?Linux-Commands-Training-Quick-Tips---Using-the-Linux-Less-and-More-Commands-to-View-Files---Red-Hat&id=1735932>.
-
APA Style Citation:
Boom, C. E. (2008, November 27). Linux Commands Training Quick Tips - Using the Linux Less & More Commands to View Files - Red Hat. Retrieved February 9, 2010, from http://ezinearticles.com/?Linux-Commands-Training-Quick-Tips---Using-the-Linux-Less-and-More-Commands-to-View-Files---Red-Hat&id=1735932
-
Chicago Style Citation:
Boom, Clyde E. "Linux Commands Training Quick Tips - Using the Linux Less & More Commands to View Files - Red Hat." Linux Commands Training Quick Tips - Using the Linux Less & More Commands to View Files - Red Hat EzineArticles.com. http://ezinearticles.com/?Linux-Commands-Training-Quick-Tips---Using-the-Linux-Less-and-More-Commands-to-View-Files---Red-Hat&id=1735932