Pergunta de entrevista da empresa PayPal

-What are the following Linux commands: more, less, pipe, grep (also a problem involving grep)?

Respostas da entrevista

Sigiloso

5 de fev. de 2012

more is a command to view (but not modify) the contents of a text file one screen at a time (terminal pager). more is a very basic pager, originally allowing only forward navigation through a file, though newer implementations do allow for limited backward movement. less is a terminal pager program on Unix, Windows, and Unix-like systems used to view (but not change) the contents of a text file one screen at a time. It is similar to more, but has the extended capability of allowing both forward and backward navigation through the file. The symbol | is the Unix pipe symbol that is used on the command line. What it means is that the standard output of the command to the left of the pipe gets sent as standard input of the command to the right of the pipe. grep is a command-line text-search utility originally written for Unix. The name comes from the ed command g/re/p (global / regular expression / print).[1][2] The grep command searches files or standard input globally for lines matching a given regular expression, and prints the lines to the program's standard output. Although grep is a very versatile command to know, it does have its limitations. One of the biggest limitations it has is that it can not search within binary files. That’s all fine, because your typical binary file would be searchable with the application that created said binary file. Grep also has a line limit of 2048 lines. This means if your file is beyond that, grep will stop searching at the line limit. http://www.ghacks.net/2010/09/06/get-to-know-linux-using-grep/

1

Sigiloso

5 de fev. de 2012

“Grep also has a line limit of 2048 lines. This means if your file is beyond that, grep will stop searching at the line limit.” Grep can handle more than 2048 lines. What it cannot do is, it cannot process more than 2048 characters in a line. http://www.ghacks.net/2010/09/06/get-to-know-linux-using-grep/

1