189 8069 5689

SomeUnixCommandUsed

ls

成都创新互联长期为成百上千客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为同仁企业提供专业的成都网站设计、做网站,同仁网站改版等技术服务。拥有十载丰富建站经验和众多成功案例,为您定制开发。

list directory contents
$ ls
64320131230-REPORTID.log                  64320140106-REPORTID.log                  ORP643ICL1021D2014-01-09-10-46-32.txt
64320131230.log                           64320140106.log                           ORP643ICL1030D2014-01-09-10-46-36.txt
64320131231-REPORTID.log                  64320140107-REPORTID.log                  ORPToOnDemand1.sh
64320131231.log                           64320140107.log                           backup
64320140101-REPORTID.log                  64320140108-REPORTID.log                  logs
64320140101.log                           64320140108.log                           ndm_binary_send.ksh
64320140102-REPORTID.log                  643_app.cfg                               rep_bundle.cfg
64320140102.log                           ARUCDBFT1U.20140108.192315.ORP.078.UNX    scripts
64320140103-REPORTID.log                  ARUODRECORPU.20140108.192315.ORP.078.REC
64320140103.log                           FileSeqNumberFile643

ls -l

use a long listing format
$ ls -l
total 81820
-rw-r--r--    1 udwhapp1 udwhapp         180 Dec 30 18:23 64320131230-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         360 Dec 30 18:23 64320131230.log
-rw-r--r--    1 udwhapp1 udwhapp        1230 Dec 31 18:32 64320131231-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         360 Dec 31 18:32 64320131231.log
-rw-r--r--    1 udwhapp1 udwhapp         945 Jan 01 12:42 64320140101-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp          90 Jan 01 12:42 64320140101.log
-rw-r--r--    1 udwhapp1 udwhapp         690 Jan 02 15:49 64320140102-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         180 Jan 02 15:49 64320140102.log
-rw-r--r--    1 udwhapp1 udwhapp        2722 Jan 03 22:11 64320140103-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         720 Jan 03 22:11 64320140103.log
-rw-r--r--    1 udwhapp1 udwhapp       22335 Jan 06 18:33 64320140106-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         270 Jan 06 18:33 64320140106.log
-rw-r--r--    1 udwhapp1 udwhapp       11370 Jan 07 21:34 64320140107-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         540 Jan 07 21:34 64320140107.log
-rw-r--r--    1 udwhapp1 udwhapp       13260 Jan 08 19:23 64320140108-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         720 Jan 08 19:23 64320140108.log
-rwxr-xr-x    1 udwhapp1 udwhapp          69 Nov 29 10:47 643_app.cfg
-rw-r--r--    1 udwhapp1 udwhapp     1943579 Jan 08 19:23 ARUCDBFT1U.20140108.192315.ORP.078.UNX
-rw-r--r--    1 udwhapp1 udwhapp         225 Jan 08 19:23 ARUODRECORPU.20140108.192315.ORP.078.REC
-rw-r--r--    1 udwhapp1 udwhapp          13 Jan 08 19:23 FileSeqNumberFile643
-rw-r--r--    1 udwhapp1 udwhapp         711 Jan 09 10:50 ORP643ICL1021D2014-01-09-10-46-32.txt
-rw-r--r--    1 udwhapp1 udwhapp    39731385 Jan 09 11:02 ORP643ICL1030D2014-01-09-10-46-36.txt
-rwxr-xr-x    1 udwhapp1 udwhapp       51683 Nov 29 10:46 ORPToOnDemand1.sh
drwxrwxr-x    2 udwhapp1 udwhapp       65536 Jan 08 19:23 backup
drwxrwxr-x    2 udwhapp1 udwhapp        2048 Dec 10 11:41 logs
-rwxr-xr-x    1 udwhapp1 udwhapp         330 Nov 29 10:45 ndm_binary_send.ksh
-rwxr-xr-x    1 udwhapp1 udwhapp           3 Nov 29 10:45 rep_bundle.cfg
drwxrwxr-x    2 udwhapp1 udwhapp        2048 Dec 10 11:41 scripts

ls -r  

reverse order while sorting
$ ls -lr
total 81820
drwxrwxr-x    2 udwhapp1 udwhapp        2048 Dec 10 11:41 scripts
-rwxr-xr-x    1 udwhapp1 udwhapp           3 Nov 29 10:45 rep_bundle.cfg
-rwxr-xr-x    1 udwhapp1 udwhapp         330 Nov 29 10:45 ndm_binary_send.ksh
drwxrwxr-x    2 udwhapp1 udwhapp        2048 Dec 10 11:41 logs
drwxrwxr-x    2 udwhapp1 udwhapp       65536 Jan 08 19:23 backup
-rwxr-xr-x    1 udwhapp1 udwhapp       51683 Nov 29 10:46 ORPToOnDemand1.sh
-rw-r--r--    1 udwhapp1 udwhapp    39731385 Jan 09 11:02 ORP643ICL1030D2014-01-09-10-46-36.txt
-rw-r--r--    1 udwhapp1 udwhapp         711 Jan 09 10:50 ORP643ICL1021D2014-01-09-10-46-32.txt
-rw-r--r--    1 udwhapp1 udwhapp          13 Jan 08 19:23 FileSeqNumberFile643
-rw-r--r--    1 udwhapp1 udwhapp         225 Jan 08 19:23 ARUODRECORPU.20140108.192315.ORP.078.REC
-rw-r--r--    1 udwhapp1 udwhapp     1943579 Jan 08 19:23 ARUCDBFT1U.20140108.192315.ORP.078.UNX
-rwxr-xr-x    1 udwhapp1 udwhapp          69 Nov 29 10:47 643_app.cfg
-rw-r--r--    1 udwhapp1 udwhapp         720 Jan 08 19:23 64320140108.log
-rw-r--r--    1 udwhapp1 udwhapp       13260 Jan 08 19:23 64320140108-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         540 Jan 07 21:34 64320140107.log
-rw-r--r--    1 udwhapp1 udwhapp       11370 Jan 07 21:34 64320140107-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         270 Jan 06 18:33 64320140106.log
-rw-r--r--    1 udwhapp1 udwhapp       22335 Jan 06 18:33 64320140106-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         720 Jan 03 22:11 64320140103.log
-rw-r--r--    1 udwhapp1 udwhapp        2722 Jan 03 22:11 64320140103-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         180 Jan 02 15:49 64320140102.log
-rw-r--r--    1 udwhapp1 udwhapp         690 Jan 02 15:49 64320140102-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp          90 Jan 01 12:42 64320140101.log
-rw-r--r--    1 udwhapp1 udwhapp         945 Jan 01 12:42 64320140101-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         360 Dec 31 18:32 64320131231.log
-rw-r--r--    1 udwhapp1 udwhapp        1230 Dec 31 18:32 64320131231-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         360 Dec 30 18:23 64320131230.log
-rw-r--r--    1 udwhapp1 udwhapp         180 Dec 30 18:23 64320131230-REPORTID.log

ls -t

sort by modification time
$ ls -lrt
total 81820
-rwxr-xr-x    1 udwhapp1 udwhapp         330 Nov 29 10:45 ndm_binary_send.ksh
-rwxr-xr-x    1 udwhapp1 udwhapp           3 Nov 29 10:45 rep_bundle.cfg
-rwxr-xr-x    1 udwhapp1 udwhapp       51683 Nov 29 10:46 ORPToOnDemand1.sh
-rwxr-xr-x    1 udwhapp1 udwhapp          69 Nov 29 10:47 643_app.cfg
drwxrwxr-x    2 udwhapp1 udwhapp        2048 Dec 10 11:41 scripts
drwxrwxr-x    2 udwhapp1 udwhapp        2048 Dec 10 11:41 logs
-rw-r--r--    1 udwhapp1 udwhapp         180 Dec 30 18:23 64320131230-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         360 Dec 30 18:23 64320131230.log
-rw-r--r--    1 udwhapp1 udwhapp         360 Dec 31 18:32 64320131231.log
-rw-r--r--    1 udwhapp1 udwhapp        1230 Dec 31 18:32 64320131231-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp          90 Jan 01 12:42 64320140101.log
-rw-r--r--    1 udwhapp1 udwhapp         945 Jan 01 12:42 64320140101-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         180 Jan 02 15:49 64320140102.log
-rw-r--r--    1 udwhapp1 udwhapp         690 Jan 02 15:49 64320140102-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp        2722 Jan 03 22:11 64320140103-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         720 Jan 03 22:11 64320140103.log
-rw-r--r--    1 udwhapp1 udwhapp         270 Jan 06 18:33 64320140106.log
-rw-r--r--    1 udwhapp1 udwhapp       22335 Jan 06 18:33 64320140106-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp       11370 Jan 07 21:34 64320140107-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         540 Jan 07 21:34 64320140107.log
drwxrwxr-x    2 udwhapp1 udwhapp       65536 Jan 08 19:23 backup
-rw-r--r--    1 udwhapp1 udwhapp          13 Jan 08 19:23 FileSeqNumberFile643
-rw-r--r--    1 udwhapp1 udwhapp     1943579 Jan 08 19:23 ARUCDBFT1U.20140108.192315.ORP.078.UNX
-rw-r--r--    1 udwhapp1 udwhapp       13260 Jan 08 19:23 64320140108-REPORTID.log
-rw-r--r--    1 udwhapp1 udwhapp         225 Jan 08 19:23 ARUODRECORPU.20140108.192315.ORP.078.REC
-rw-r--r--    1 udwhapp1 udwhapp         720 Jan 08 19:23 64320140108.log
-rw-r--r--    1 udwhapp1 udwhapp         711 Jan 09 10:50 ORP643ICL1021D2014-01-09-10-46-32.txt
-rw-r--r--    1 udwhapp1 udwhapp    39731385 Jan 09 11:02 ORP643ICL1030D2014-01-09-10-46-36.txt

uname -a

get the unix version

$ uname -a
AIX rdcgcgboxaa01u 1 6 00F621BB4C00

id

get current user id and group id

$ id
uid=14042(udwhapp1) gid=14042(udwhapp)

grep
Searches for a pattern in a file.

$ grep 'REPORT DATE  :  12/31/2013' *txt
ORP643ICL1049D2014-01-09-16-23-06.txt: REPORT DATE  :  12/31/2013
ORP643ICL1051D2014-01-09-16-23-07.txt: REPORT DATE  :  12/31/2013
ORP643ICL1056D2014-01-09-15-52-12.txt: REPORT DATE  :  12/31/2013
ORP643ICL1070D2014-01-09-16-23-02.txt: REPORT DATE  :  12/31/2013
ORP643LCL1071D2014-01-09-16-23-05.txt: REPORT DATE  :  12/31/2013
ORP643LNE1174D2014-01-09-14-56-21.txt: REPORT DATE  :  12/31/2013
ORP643LNE1182W2014-01-09-14-58-44.txt: REPORT DATE  :  12/31/2013

grep ...|wc -l

Returns the search result count

wc -l

Counts the number of lines

$ grep 'REPORT DATE  :  12/31/2013' *txt |wc -l
     96

head

Displays the first few lines of a file.

line

Reads one line from the standard input. Can be used to avoid account timeout logoff.

ls –lrt|tail -10

Displays the last 10 files of current directory.

tail

Displays the last few lines of a file.


本文题目:SomeUnixCommandUsed
标题来源:http://jkwzsj.com/article/pesgop.html

其他资讯