Linux bright red, I began to learn Linux, learning to make me happy, everyone together to learn ...
1. Install the SOFTWARE command
sudo apt-get apache2 installation Apache, installed in the default path, the specified path installation, in fact, for the Linux system, there is no need to specify the path, just for good management, specify path installation also need research
Reboot required after installation because you know the installation did not start it
Sudo/etc/init.d/apache2 restart
2. Check the Software Installation path (The following two are the installation path to view the software, any one can be selected)
Dpkg-l apache2
Locate Apache2
3. Completely uninstall the package
Apt-get--purge Remove Apache2
4. View the project log
CD to project logs use the view command to view the log
A. Viewing post 20 of a log tail-n Xxx.log
B.cat command, display the entire log content, cat Xxx.log
B1. Review the post 10 logs and monitor the automatic acquisition of the latest log tail-f Xxx.log
View logs 50 days after, and monitor automatically get latest log display tail-n 50-f xxx.log
CTRL + C Force quit
B2. Search for log content containing a field/xxx, query the log containing the XXX field
C. Morecommand: View the log as a percentage.
More Xx.log
More features like cat, the Cat command is the entire contents of the file displayed on the screen from top to bottom. More will be a page-by-page display to facilitate users to read pages, and the most basic instruction is to press the blank key (space) on the next page, press the B key will be back to a page, but also the function of the search string. The more command reads the file backwards from the front, so it loads the entire file at startup.
+n starting from joys N rows
-N defines the screen size as n rows
+/pattern searches for the string before each file is displayed, and then starts from the first two lines of the string
-C clear the screen from the top and then display
-D hint "press space to continue, ' Q ' To quit (press SPACEBAR to continue, pressing Q key to exit)", disable the ringing function
-L ignores Ctrl+l (page break) characters
-p to page a file by clearing the window instead of scrolling, similar to the-C option
-S displays a contiguous number of empty rows as a row
-U Remove the line from the contents of the file
Q exit
D, less command: similar to more functions, but less support to scroll through the files before and after
Less Xx.log
Less directive
The less tool is also a tool for paging through files or other output, which is a very powerful tool for Linux to view the contents of a file. The usage of less is more resilient than more. In more, we have no way to turn front, can only look back, but if use less, you can use [PageUp] [PageDown] and other key functions to go to look at the file, more easily used to view the contents of a file! In addition, in less you can have more search function, not only to search down, but also to search upward.
1. Command format:
Less [parameter] file
2. Command function:
Less is similar to more, but you can browse files at will with less, and more can only move forward, but not backwards, and no will load the entire file before viewing it.
3. Command parameters:
-B < buffer size > Set buffer size
-e When the file display is finished, automatically leave
-F forcing special files to be opened, such as peripheral code, directories, and binaries
-G only flags the last keyword searched
-I ignores case when searching
-m shows a percentage similar to the more command
-N Displays the line number of each line
-o < file name > save less output in the specified file
-Q does not use warning tones
-S displays a row of continuous empty behavior
-S line too long will be out of the partial discard
-X < number > Displays the "tab" key as a specified number space
/string: Search down the function of "string"
String: The ability to search up "string"
N: Repeat the previous search (with/or?). About
N: Reverse repeats the previous search (and/or?) About
b Turn back one page
D Turn back half a page
H Display Help interface
Q Exit less command
U scroll forward Half page
Y Scrolls forward one line
SPACEBAR Scrolls one line
Enter key to scroll one page
[PageDown]: Flip one PAGE Down
[PageUp]: Flip one page Up
Head command:
Head-n Example.txt Display the first 20 lines of the file example.txt;
Ubuntu apt-get Install, uninstall software commands and how to view logs