Some Unix Command Used
admin
2023-02-04 06:20:06
0

ls

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.

相关内容

热门资讯

急派超百名军医,美国准备地面战... 在加大空袭力度的同时,美军持续向中东增派战机、特种作战力量和后勤保障人员。与此同时,美军高层承认,单...
唐驳虎丨王虹、邓煜同获菲尔兹奖... 作者丨唐驳虎核心提要1. 本届国际数学家大会上,北大数院2007级校友王虹、邓煜同获菲尔兹奖,成为首...
菲尔兹奖获得者邓煜:爬山时破解... 作者:周盛楠 王僖妍·邓煜。(受访者供图)2026年7月23日,注定是改写中国数学历史的一天。邓煜、...
中国籍数学家王虹获菲尔兹奖 当地时间7月23日上午,2026年国际数学家大会在美国费城开幕,现场揭晓2026年菲尔兹奖得主。中国...
首次突破 屡创新高!一组数字解... 2026年上半年我国GDP同比增长4.7%经济韧性持续彰显在已经出炉的经济数据中更值得关注的还有“含...
男主播卖惨,66岁患癌老太花光... 今年3月,沈阳66岁的张阿姨在家养病期间刷视频时,被一名IP属地为湖北的男主播吸引。该主播主打演唱经...
松下智能马桶盖不喷水怎么回事 松下智能马桶盖不喷水怎么回事1、有时候新买的马桶在安装的时候工人有时候会不会告诉你需要开进水阀的,智...
松下智能马桶盖不喷水 1、有时候新买的马桶在安装的时候工人有时候会不会告诉你需要开进水阀的,智能马桶都是带有进水阀的,如果...
智能马桶盖不喷水故障维修方法 如果是出水口不喷水,先检查下是不是里面没水,或者水管出问题了,水管故障问题需找专业的维修师傅维修;若...
马桶水箱盖子碎了能换么 不能,建议更换整个水箱。方法:先检查排污管及产品内通道是否有异物;确定固定蹲便的安装位置、高度以及将...