linux command to view the contents of a file

Study notes, transferred from: http://blog.csdn.net/yuyongpeng/article/details/1818713

 

 

Watch archive content : cat, tac, more, less, head, tail, nl,

 

What we mentioned just now is only to display the appearance of the file, or to move and copy a file or directory, so if we want to inspect the content of a file, what should we do? ! There are quite a few interesting commands to share here: the most commonly used commands for displaying file contents are  cat  and  more  and  less  ! Also, what if we want to view a very large file (hundreds of megabytes ), but we only need a few lines from the backend? Ha ha! Use  tail  , in addition, the  tac  command can also be achieved! Well, let's talk about the purpose of each command!

 

cat starts to display the file content from the first line tac starts to display from the last line, it can be seen that  tac  is written backwards of  cat  ! more shows the contents of the file page by page. Less is similar to  more  , but better than  more  , he can turn pages forward! When head only looks at the first few lines, tail only looks at the tail, when nl is displayed, output the line number along the way! od reads the archive contents in binary!   
  
 
 
 
 
 
 
 
 
 
   
 
   

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326119358&siteId=291194637
Recommended