Linux tail command analysis 1. to view the first five lines of a file, you can use the head command, such as head-5/etc/passwd2. to view the last 10 lines of the file, you can use the tail command, such: tail-2/etc/passwd or
Linux Command tail and filtering function, linuxtail
The path and name of the tail-n rows-f folder, which can be appended to the log | grep + name used for filtering
Ps aux | grep file to view execution status
For example:
tail -n 40 -f /export/logs/main/monitor_D.log | gre
Original: http://www.cnblogs.com/peida/archive/2012/11/07/2758084.htmlThe AIL command writes the file to standard output starting at the specified point. Using the-f option of the tail command makes it easy to see the log files that are being changed, TAIL-F filename will di
damaged, you will not be able to take a backup of the transaction log from the disk. Another problem is that when your data is using the bulk-logged recovery model, the current transaction log includes only the minimized log transactions. In this case, a transaction log backup needs to store the modification of the d
bytesCommand:Head-c -32 Log2014.logOutput:[Email protected] test]# head-c -32 log2014.log2014-012014-022014-032014-042014-052014-062014-072014-082014-092014-102014-112014-12[[email protected] test]#Example 4: Output file except the last n rows of the entire contentCommand:Head-n-6 Log2014.logOutput:[Email protected] test]# Head-n-6 Log2014.log2014-012014-022014-032014-042014-052014-062014-07[[email protected] test]#I used the head command:HEAD-20 fileName: Displays the first 20 lines of the fil
less than 10 lines continue to 1000 reads, and so forth ~Specific implementation:#!/usr/bin/envpython#-*-coding:utf-8-*-"" "##authors:limanman# 51ctobg:http://xmdevops.blog.51cto.com/#purpose:# "" "From__future__importabsolute _import# Description: Import Public module importosimportsysimporttimeimportchardet# Description: Import other modules #if__name__== ' __main__ ':seekps=0; target= ' Data.txt ';try: # the pointer jumps to the end as the read position withopen ( target, ' r+b ') asf: F.se
giving file names--help display this Help and exit--version Output version information and exitCommon Command DisplayHead: Displays the first few lines of the file, the default 10 lines head-n 2/home/omc/h.txt==>head-n 3 = = Head-3 can be directly followed by the number of rows cat h.txt | grep-v "Hello" filter Off specific strings, inefficient, because there is a pipeline ==>grep-v "Hello" h.txt can be directly with the file name, efficient
==================head==================The first 10 lines of the default output file contentsNAME-Output the first part of the filesSynopsis (outline, abstract)-head [option] ... [File] ...Parameters-N Specify row-C--bytes-V Show file name-------------------------------#显示前5行Head-n 5/etc/inittabHead-5/etc/inittab #只需要掌握这条命令即可-------------------------------#显示前5个字节Head-c 5/etc/inittab-------------------------------#除去最后10行, all other content is outputHead-n -10/etc/inittab-----------------------
–r–v root:mail TestDirThe owner of "Testdir/log2014.log" has changed to Root:mailThe owner of "Testdir/linklog.log" has changed to Root:mailThe owner of "Testdir/log2015.log" has changed to Root:mailThe owner of "Testdir/log2013.log" has changed to Root:mailThe owner of "Testdir/log2012.log" has been reserved for Root:
Label:The SQL Server2008 database was restored with the following error message:System.Data.SqlClient.SqlError: Database After online access to the data, there are two ways to solve, only need to use one of the following two methods when restoring:1. When restoring the database, click on the option on the Select page, tick overwrite existing database (with REPLACE), click OK to restore the database successfully (recommend this method).2, when the restore operation, click the option on the Select
displaying the number of rows is 10.Options:-c,-bytes=size Displays the preceding SIZE bytes.The value of-n,-lines=number number specifies how many lines are displayed earlier. The default is 10 rows.-q,-quiet,--silent does not display the title of the given file.-v,-verbose always displays the title of the given file.Example:# head-5 file (shows the first 5 lines of the files)# head-v file (displays the contents of the files, and gives the filename title)# head-q file (displays the contents of
Linux---Tail commandTail command---in linux for viewing file contentsThe most basic are cat, more and less.1. If you want to see only the first 5 lines of the file, you can use the Head command, such as:Head-5/etc/passwd2. If you want to view the following 10 lines of the file, you can use the tail
Linux---Tail commandTail command---in linux for viewing file contentsThe most basic are cat, more and less.1. If you want to see only the first 5 lines of the file, you can use the Head command, such as:Head-5/etc/passwd2. If you want to view the following 10 lines of the file, you can use the tail
October 8, 2014 weather: Wind-free haze air Pollution index 452 serious pollution ①cat/etc/rc.d/rc.sysyinit Display all text content to the terminal Common Parameters-N Add display line numbers Shift+pageup front page Shift+pagedown back page Disadvantage: Dumping display data so you can only page back to view the data in the cache, if too much data can not display the previous data. A person who thinks fit to display little text, or very familiar text ②more/etc/rc.d/rc.sysyinit Support Split-
Head: View the contents of the file, the first 10 lines of content are displayed by default.Tail: View the contents of a file, which shows the following 10 lines by default.Head and tail if you want to display the contents of the specified number of rows, you can use the-n option.Option Description: Head-n Number: Displays the contents of the previous number line. Head-c number-bytes: Displays the contents of the preceding number of bytes. You can use
The tail command of a linux Command per day is used to display the last few lines of the file. The default value is 10 lines. It is generally used to view log files. The latest file content is continuously output based on log updates. You do not need to refresh the file to v
Background:Oracle is installed silently today and commands are issued at the command line./runinstaller-silent-responsefile/oracle/database/response/db_install.rspAs a result, there is no installation progress, only hints can be found from the/u01/app/orainventory/logs/installactions.....log results---> See here I think of in Linux is there a command to view a dy
repetition interval, -V,--verbose always outputs the header of the filename; --help Show help information and exit --version Outputs version information after exiting If the first character of n (bytes or lines) is ' + ', then the nth item starting at the beginning of each file is displayed, otherwise the last n of the file is displayed. n can have a multiple prefix: b means that 512,k means that 1024,m represents 1048576 (1 trillion). The first option,-value or +value, is treated as-n v
1. View logs for a certain period of time#cat Hdfs-audit.log | Sed-n '/2018-04-11 10:00:00/,/2018-04-11 10:01:00/p ' | More---Direct use time period#cat Hdfs-audit.log | Sed-n '/2018-04-11 09:[0-9][0-9]/,/2018-04-11 10:[0-9]:[0-9]/p ' | More---Use regular expressions#sed查看log时间段 (sed-n '/start/,/end/P ' p is printed out, D is deleted)2. View the end of the log 100 lines#
Use:Writes the file to standard output, starting at the specified point. Using the-f option of the tail command makes it easy to see the log files that are being changed, TAIL-F filename will display the most up-to-date content on the screen, and constantly refresh to keep you updated on the contents of the file.Gramma
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.