1.終端查看ip: ifconfig
MumusMacBook-Pro:~ yangjie$ ifconfig
2.刪除文件夾: rm 參數(shù) 刪除文件路徑
MumusMacBook-Pro:~ yangjie$ rm -r -f /Users/yangjie/Desktop/apktool.sh
參數(shù)-rf 表示遞歸和強(qiáng)制周崭,千萬要小心使用玫镐,如果執(zhí)行了 "rm -rf /" 你的系統(tǒng)就全沒了
3.拷貝: cp 文件路徑 目的路徑
MumusMacBook-Pro:~ yangjie$ cp /Users/Desktop/jpush.zip /User/yangjie/Document/Users/
4.查看當(dāng)前目錄 ls 參數(shù)
MumusMacBook-Pro:~ yangjie$ ls -ls
參數(shù)說明
-a 列出目錄下的所有文件,包括以 . 開頭的隱含文件页慷。
-l 列出文件的詳細(xì)信息。
-s 在每個(gè)文件名后輸出該文件的大小。
-w 顯示中文.
-r 遍歷子目錄.
5.關(guān)閉指定端口 lsof -i: 端口號(hào) & kill 進(jìn)程號(hào)
例受楼,關(guān)閉端口8080。
1.查看端口8080的進(jìn)程PID
MumusMacBook-Pro:~ yangjie$ lsof -i:8080
如圖:
2.關(guān)閉該P(yáng)ID
MumusMacBook-Pro:~ yangjie$ kill 1129
6.設(shè)置文件(夾)權(quán)限 sudo chmod 參數(shù) 用戶組權(quán)限 目標(biāo)文件(夾)
注:sudo 是獲取管理員權(quán)限呼寸。命令執(zhí)行時(shí)需要輸入密碼.
例:
MumusMacBook-Pro:Catalina yangjie$ sudo chmod -R 777 localhost
其中777分別表示User艳汽、Group、及Other的權(quán)限对雪。 localhost為目標(biāo)文件夾.
r=4(讀)河狐,w=2(寫),x=1(執(zhí)行)
若要rwx屬性則4+2+1=7瑟捣;
若要rw-屬性則4+2=6馋艺;
若要r-x屬性則4+1=5。
7. 查看當(dāng)前目錄下各個(gè)文件大小 du -ah (包括隱藏文件)
本例子拿一個(gè)git 倉庫做示范
MumusMacBook-Pro:ChatDemo yangjie$ du -ah
8.0K ./.DS_Store
0B ./.git/branches
4.0K ./.git/COMMIT_EDITMSG
a參數(shù)是將文件大小轉(zhuǎn)換成k 或者M(jìn) 讓我們能輕松看懂文件大小
推薦一個(gè)清除git倉庫垃圾的命令$git gc --prune=now
要先cd 到git倉庫路徑下迈套。
du -sh * 查看 當(dāng)前文件夾下的文件大小 (不包括隱藏文件)
MumusMacBook-Pro:ChatDemo yangjie$ du -sh *
3.0M 0204_customerService
120K 0204_customerService.xcodeproj
8.0K 0204_customerServiceTests
8.查看當(dāng)前靜態(tài)庫支持的指令集 lipo
iOS中真機(jī)為armv7(兼容armv7s)
or arm64
模擬器為x86_64
mumusMBP:Debug-iphoneos yangjie$ lipo -info libGPUImage.a
Architectures in the fat file: libGPUImage.a are: armv7 arm64
//下面為模擬器靜態(tài)庫文件
mumusMBP:Debug-iphonesimulator yangjie$ lipo -info libGPUImage.a
input file libGPUImage.a is not a fat file
Non-fat file: libGPUImage.a is architecture: x86_64
合并模擬器和真機(jī)靜態(tài)庫文件
lipo -create
真機(jī)庫路徑 模擬器路徑-output
輸出路徑
lipo -create /Users/yangjie/Downloads/GPUImage-master/build/Debug-iphoneos/libGPUImage.a /Users/yangjie/Downloads/GPUImage-master/build/Debug-iphonesimulator/libGPUImage.a -output /Users/yangjie/Desktop/tmp/libGPUImage.a
mumusMBP:tmp yangjie$ lipo -info libGPUImage.a
Architectures in the fat file: libGPUImage.a are: armv7 x86_64 arm64
這里順便引用一個(gè)使用GPUImage的簡書 iOS 使用GPUImage實(shí)現(xiàn)濾鏡效果