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
backcall0.1.0
backports.weakref1.0rc1
beautifulsoup44.7.1
bleach==1.5.0
tail -n 5 packages.txt
traitlets4.3.2
urllib31.24.1
wcwidth0.1.7
Werkzeug0.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