linux command line

linux command note


pipelines

ls /usr/bin | less

filter

ls -l /usr/bin | sort | less

uniq—Report or Omit Repeated Lines

ls -l liu/ liu3/liu | sort

-rw-r–r-- 1 yanan staff 975 Mar 19 23:54 packages.txt
-rw-r–r-- 1 yanan staff 975 Mar 20 04:16 packages.txt
-rw-r–r-- 1 yanan staff 18621557 Mar 19 23:54 word2Vec.bin
-rw-r–r-- 1 yanan staff 18621557 Mar 20 04:16 word2Vec.bin
-rw-r–r-- 1 yanan staff 73057383 Mar 19 17:32 vectors.kv
drwxr-xr-x 4 yanan staff 128 Mar 19 16:52 output
drwxr-xr-x 4 yanan staff 128 Mar 20 04:16 output
drwxr-xr-x 7 yanan staff 224 Mar 19 16:54 charcnn
drwxr-xr-x 7 yanan staff 224 Mar 20 04:18 charcnn
drwxr-xr-x 8 yanan staff 256 Mar 19 16:52 input
drwxr-xr-x 8 yanan staff 256 Mar 20 04:16 input
drwxr-xr-x 11 yanan staff 352 Mar 19 16:52 dic
drwxr-xr-x 11 yanan staff 352 Mar 20 04:16 dic
drwxr-xr-x 16 yanan staff 512 Mar 20 04:21 co_train
drwxr-xr-x 18 yanan staff 576 Mar 19 17:09 co_train
drwxr-xr-x 27 yanan staff 864 Mar 19 16:54 txtcnn
drwxr-xr-x 27 yanan staff 864 Mar 20 04:18 txtcnn

ls  liu/ liu3/liu | sort | uniq #  see list without duplicates

charcnn
co_train
dic
input
liu/:
liu3/liu:
output
packages.txt
txtcnn
vectors.kv
word2Vec.bin

ls  liu/ liu3/liu | sort | uniq -d #  see the list with duplicates

charcnn
co_train
dic
input
output
packages.txt
txtcnn
word2Vec.bin

wc—Print Line, Word, and Byte Counts

wc packages.txt

59 59 975 packages.txt

liu/ liu3/liu | sort |  uniq -d | wc 

8 8 67

liu/ liu3/liu | sort |  uniq  -d | wc 

8

grep—Print Lines Matching a Pattern

ls /bin /usr/bin | sort | uniq | grep zip

bunzip2
bzip2
bzip2recover
funzip
gunzip
gzip
unzip
unzipsfx
zip
zipcloak
zipdetails
zipdetails5.18
zipgrep
zipinfo
zipnote
zipsplit

head/tail—Print First/Last Part of Files

head -n 5 packages.txt

asn1crypto0.24.0
backcall
0.1.0
backports.weakref1.0rc1
beautifulsoup4
4.7.1
bleach==1.5.0

tail -n 5 packages.txt

traitlets4.3.2
urllib3
1.24.1
wcwidth0.1.7
Werkzeug
0.14.1
word2vec==0.10.2

ls liu/ | head -n 4

charcnn
co_train
dic
input

tail -f /var/log/messages

实时查看输出日志 参数-f

tee—Read from Stdin and Output to Stdout and Files

ls /usr/bin | tee ls.txt |grep zip
head -n 5 ls.txt

2to3-
2to3-2.7
AssetCacheLocatorUtil
AssetCacheManagerUtil
AssetCacheTetheratorUtil

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值