在OutPut显示在Linux后,我如何从开始看

这是我的输出使用system.out.println我在Linux服务器。 问题是,我无法查看序列号1的输出,因为下面占用了整个屏幕。

请告诉我如何滚动到顶部?

341:allitems: tq_relation 342:allitems: tr_num 343:allitems: trader_id 344:allitems: tradetick 345:allitems: trading_state 346:allitems: treas_shrs 347:allitems: treas_stk 348:allitems: treasury_yield 349:allitems: trend 350:allitems: uask_quote 351:allitems: uask_quote_date 352:allitems: ubid_quote 353:allitems: ubid_quote_date 354:allitems: under_cusip 355:allitems: undersymbol 356:allitems: unique_symbol 357:allitems: unit_measure 358:allitems: unpriced 359:allitems: unsolicited 360:allitems: valoren 361:allitems: value_pr_shortinterest 362:allitems: value_shortinterest 363:allitems: vega 364:allitems: vl 365:allitems: vol 366:allitems: volatility12 367:allitems: vwap 368:allitems: wanted_off_bid_ind 369:allitems: wk52hi 370:allitems: wk52hidate 371:allitems: wk52hidate_t 372:allitems: wk52lo 373:allitems: wk52lodate 374:allitems: wk52lodate_t 375:allitems: wkinprog 376:allitems: xchg 377:allitems: xdate 378:allitems: xday 379:allitems: xmonth 380:allitems: xyear 381:allitems: yield 

Linux的强大之处在于,您可以将某些命令重定向到其他命令并将其输出到其他命令中,如使用程序1的输出作为程序2的输入。可以使用以下命令进行归档:

 program1|program2 

更具体的你可以使用一个寻呼机或少或多。 使用less命令,您可以前后滚动并搜索输出中的特定模式。 more命令显示明智的输出页面。 按下回车键显示文件的下一页。 为了你的目的,你只需要使用。

 myprogram|less 

要么

 myprogram|more 

不管你喜欢什么 另一种方法是将输出重定向到一个文件。 您可以使用重定向操作符>和

 myprogramm > log.txt 

会记录输出log.txt。

甚至有使用脚本命令的第三种方法。 当你打字

 script log.txt 

至少在bash中会打开一个子shell,每个输入和输出都会被记录到log.txt中。 您可以关闭并使用退出访问logile。 在最后两种情况下,您可以使用您最喜爱的文本编辑器或传呼机查看log.txt文件。

您可以将程序的输出重定向到一个文本文件:

 $ ./myprogram >output.txt 

然后用任何你喜欢的文本编辑器查看文本文件。

您也可以将结果传递给more命令:

 $ ./myprogram | more