http://www.jianshu.com/p/44d3b8f713f2javascript
Mac OS是Unix系統的分支,有着強大的命令行功能。不少事情在命令行下處理會事半功倍,因此我就iOS程序員可能會用到的功能講述一下。css
Mac的終端有一個很關鍵的配置,就是「使用 Option 鍵做爲 Meta 鍵」。勾上這個選項以後,就可使用Emacs的編輯命令了。java
我發現有些人的終端沒有設置「平滑文本」,致使終端上的文字很難看。趕忙把這個選項勾上吧。node
經常使用的幾個快捷鍵以下。python
終端顏色高亮也不錯,看起來感受會更有感受。好比ls能夠看到目錄會是藍色的,普通文件是白色的,可執行程序會是綠色的。ios
具體設置能夠參考:讓Mac OS X的終端多姿多彩。c++
homebrew是一個很是有用包管理工具,經過homebrew能夠安裝更多有用的unix工具,好比wget、tree等等。git
目前最好的安裝方式都是下面這樣的,一句命令搞定。程序員
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
[~]$ brew install tree
==> Downloading http://mama.indstate.edu/users/ice/tree/src/tree-1.7.0.tgz Already downloaded: /Library/Caches/Homebrew/tree-1.7.0.tgz ==> make prefix=/usr/local/Cellar/tree/1.7.0 MANDIR=/usr/local/Cellar/tree/1.7.0/share/man/man1 CC=clang CFLAGS=-fomit-frame-pointer LD /usr/local/Cellar/tree/1.7.0: 7 files, 128K, built in 2 seconds
tree這個工具看目錄的內容很是直觀好看。github
[~/ilaiwang/LWShareTo]$ tree
.
├── LWShareTo
│ ├── LWShareContent.h
│ ├── LWShareContent.m
│ ├── LWShareTo-Prefix.pch
│ ├── LWShareTo.h
│ ├── LWShareTo.m
│ ├── LWShareToMacro.h
│ ├── LWShareToUtils.h
│ ├── LWShareToUtils.m
│ ├── ShareModule
│ │ ├── LWShareChannelService.h
│ │ ├── LWShareChannelService.m
│ │ ├── LWShareToBaseClass.h
│ │ ├── LWShareToBaseClass.m
│ │ ├── LWShareToClipboard.h
│ │ ├── LWShareToClipboard.m
│ │ ├── LWShareToDouban.h
│ │ ├── LWShareToDouban.m
│ │ ├── LWShareToInside.h
│ │ ├── LWShareToInside.m
│ │ ├── LWShareToLWFeed.h
│ │ ├── LWShareToLWFeed.m
│ │ ├── LWShareToLWSession.h
│ │ ├── LWShareToLWSession.m
│ │ ├── LWShareToOutside.h
│ │ ├── LWShareToOutside.m
│ │ ├── LWShareToQQSession.h
│ │ ├── LWShareToQQSession.m
│ │ ├── LWShareToQQZone.h
│ │ ├── LWShareToQQZone.m
│ │ ├── LWShareToRenren.h
│ │ ├── LWShareToRenren.m
│ │ ├── LWShareToSinaWeibo.h
│ │ ├── LWShareToSinaWeibo.m
│ │ ├── LWShareToTencentWeibo.h
│ │ ├── LWShareToTencentWeibo.m
│ │ ├── LWShareToWechatSession.h
│ │ ├── LWShareToWechatSession.m
│ │ ├── LWShareToWechatTimeline.h
│ │ └── LWShareToWechatTimeline.m
│ ├── WebviewRender.h
│ └── WebviewRender.m
├── LWShareTo.xcodeproj
│ └── project.pbxproj
└── LWShareToTests
├── LWShareToTests-Info.plist
├── LWShareToTests.m
└── en.lproj
└── InfoPlist.strings
5 directories, 44 files
GNU Coreutils包含了各類GNU好用的工具。根據個人觀察,我發現Mac預裝了Coreutils,只是版本比較低,建議本身安裝一下,否者sort連"-h"參數都沒有。具體安裝和配置的方法在讓Mac OS X的終端多姿多彩這篇文章裏面也有。
Xcode圖形化操做挺好用的,不過知道一些命令行的操做會更佳。在下面這個地方看到Xcode編譯的詳細過程。
若是在編譯的時候遇到連接錯誤,在命令行下檢查一下就很是有必要了。下面這個命令就是連接生成來往二進制程序的,能夠拷貝到終端裏面運行。若是連接出錯誤了,能夠仔細檢查一下這個命令。
Ld /Users/henshao/Library/Developer/Xcode/DerivedData/Laiwang-fxscnxkslrypubbeazdfkveysldy/Build/Products/Debug-iphoneos/Laiwang.app/Laiwang normal arm64
cd /Users/henshao/ilaiwang/LaiwangV3 export IPHONEOS_DEPLOYMENT_TARGET=6.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk -L/Users/henshao/Library/Developer/Xcode/DerivedData/Laiwang-fxscnxkslrypubbeazdfkveysldy/Build/Products/Debug-iphoneos -L/Users/henshao/ilaiwang/LaiwangV3/../Pods/LWComponentKits/LWComponentKits/AMAP/liboffset -L/Users/henshao/ilaiwang/LaiwangV3/../Pods/LWXiamiMusic/Output -L/Users/henshao/ilaiwang/LaiwangV3/../Pods/QupaiSDK/libQupaiSDK -L/Users/henshao/ilaiwang/LaiwangV3/../Pods/VoIPSDK/SDK/lib -F/Users/henshao/Library/Developer/Xcode/DerivedData/Laiwang-fxscnxkslrypubbeazdfkveysldy/Build/Products/Debug-iphoneos -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/AMap3DMap -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/AMapSearch -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/DevicePrint -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/TBSecuritySDK -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/SecurityGuardSDK -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/UserTrack -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/PLCrashReporter/iOS\ Framework -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/MtopSDK -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/SpeechRecognizer -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/TBScanLib -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/TBShortURL -F/Users/henshao/ilaiwang/LaiwangV3 -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/TencentOpenApiSDK/64Bit -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/huoyanSDK_laiwang -F/Users/henshao/ilaiwang/LaiwangV3/../Pods/mtopext -F/Users/henshao/ilaiwang/LaiwangV3/Laiwang/LWUIKits/AlipaySDK_2 -F. -FLaiwang -FLaiwangShare -FLaiwangTests -FLaiwang/BaseFrame -FLaiwang/BaseLogic -FLaiwang/Cache -FLaiwang/DataProvider -FLaiwang/DataSource -FLaiwang/DevTools -FLaiwang/H5_Slider_local -FLaiwang/Init -FLaiwang/Integration -FLaiwang/LWSafeMode -FLaiwang/LWUIKits -FLaiwang/PageViews -FLaiwang/SDK -FLaiwang/Sounds -FLaiwang/TestUtility -FLaiwang/UserControls -FLaiwang/Utils -FLaiwangTests/LWServiceTests -FLaiwangTests/Other -FLaiwang/BaseFrame/LWController -FLaiwang/BaseFrame/LWUISDK -FLaiwang/BaseFrame/URLCoordinator -FLaiwang/Cache/LWDataCache -FLaiwang/Cache/LWDB -FLaiwang/Cache/LWDBModel -FLaiwang/H5_Slider_local/app.slide -FLaiwang/Integration/LWService -FLaiwang/Integration/LWServiceTests -FLaiwang/LWUIKits/AlipaySDK_2 -FLaiwang/LWUIKits/LWAlbumPhotoPreview -FLaiwang/LWUIKits/LWCameraCaptureView -FLaiwang/LWUIKits/LWMovieView -FLaiwang/LWUIKits/MMDrawerController -FLaiwang/LWUIKits/TableViewCell -FLaiwang/PageViews/AlbumPage -FLaiwang/PageViews/ChatPage -FLaiwang/PageViews/DiscoveryExPage -FLaiwang/PageViews/EmotionBoxPage -FLaiwang/PageViews/EventPage -FLaiwang/PageViews/FeedPage -FLaiwang/PageViews/FriendPage -FLaiwang/PageViews/FriendRadarPage -FLaiwang/PageViews/IntroducePage -FLaiwang/PageViews/KnockPage -FLaiwang/PageViews/LoginPage -FLaiwang/PageViews/MinePage -FLaiwang/PageViews/MorePage -FLaiwang/PageViews/MoviePage -FLaiwang/PageViews/MusicPage -FLaiwang/PageViews/NearByPage -FLaiwang/PageViews/NewGuidePage -FLaiwang/PageViews/NotificationPage -FLaiwang/PageViews/OAuthPage -FLaiwang/PageViews/PhotoEditorPage -FLaiwang/PageViews/PhotoFilterPage -FLaiwang/PageViews/PostPage -FLaiwang/PageViews/PubAccountPage -FLaiwang/PageViews/SearchPage -FLaiwang/PageViews/SharedPage -FLaiwang/PageViews/ShareMsgPage -FLaiwang/PageViews/XiamiPage -FLaiwang/SDK/EggShell -FLaiwang/SDK/InternalSDK -FLaiwang/SDK/LWFileUploadManager -FLaiwang/SDK/LWHostService -FLaiwang/SDK/LWShareTo -FLaiwang/SDK/SSOApiEngine -FLaiwang/SDK/ViewModels -FLaiwang/SDK/VOIP -FLaiwang/Sounds/asr -FLaiwang/Sounds/radar -FLaiwang/TestUtility/APNSTest -FLaiwang/TestUtility/TimeCounter -FLaiwang/UserControls/BigImageControl -FLaiwang/UserControls/LWAsrBoard -FLaiwang/UserControls/LWAvatarView -FLaiwang/UserControls/LWBrowserViewController -FLaiwang/UserControls/LWCloudAudioPlayerBox -FLaiwang/UserControls/LWCustomUI -FLaiwang/UserControls/LWEasyInputView -FLaiwang/UserControls/LWEmotionView -FLaiwang/UserControls/LWLocationDirectionView -FLaiwang/UserControls/LWLocationDisplayView -FLaiwang/UserControls/LWNativeBridgeWebView -FLaiwang/UserControls/LWObjSelectControl -FLaiwang/UserControls/LWPicker -FLaiwang/UserControls/LWPictureViewer -FLaiwang/UserControls/LWProgressView -FLaiwang/UserControls/LWRichTextContentView -FLaiwang/UserControls/LWScrollTabBar -FLaiwang/UserControls/LWSettingsItem -FLaiwang/UserControls/LWTextZoomView -FLaiwang/UserControls/LWToastView -FLaiwang/UserControls/LWVoiceWidget -FLaiwang/UserControls/LWVoipView -FLaiwang/UserControls/LWWebImageView -FLaiwang/UserControls/LWWebViewController -FLaiwang/UserControls/LWXiamiBar -FLaiwang/UserControls/QBImagePicker -FLaiwang/Utils/ABContact -FLaiwang/Utils/ALAssetsLibrary-CustomPhotoAlbum -FLaiwang/Utils/ASR -FLaiwang/Utils/AWActionSheet -FLaiwang/Utils/Category -FLaiwang/Utils/CompatibleUtil -FLaiwang/Utils/GDataXMLNode -FLaiwang/Utils/Huoyan -FLaiwang/Utils/ImageDownloader -FLaiwang/Utils/LWAppURLNavigator -FLaiwang/Utils/LWBizSearch -FLaiwang/Utils/LWDataStore -FLaiwang/Utils/LWFav -FLaiwang/Utils/LWLocalPageURLRouter -FLaiwang/Utils/LWLocationManager -FLaiwang/Utils/LWMusic -FLaiwang/Utils/LWPushDispatcher -FLaiwang/Utils/LWStatistics -FLaiwang/Utils/NSStringAdditions -FLaiwang/Utils/OffLineSendUtil -FLaiwang/Utils/QupaiSDK -FLaiwang/Utils/SDWebImage -FLaiwang/Utils/SoundEffect -FLaiwang/Utils/UIImageAdditions -FLaiwang/Utils/UIImagePickerControllerAdditions -FLaiwang/Utils/UT -FLaiwang/BaseFrame/LWController/LWTabBarController -FLaiwang/H5_Slider_local/app.slide/css -FLaiwang/H5_Slider_local/app.slide/images -FLaiwang/H5_Slider_local/app.slide/js -FLaiwang/Integration/LWService/ios -FLaiwang/Integration/LWServiceTests/LWPackTests -FLaiwang/Integration/LWServiceTests/LWServiceTests -FLaiwang/LWUIKits/AlipaySDK_2/AlipaySDK.bundle -FLaiwang/PageViews/AlbumPage/Cells -FLaiwang/PageViews/AlbumPage/UserControls -FLaiwang/PageViews/ChatPage/BubbleDay -FLaiwang/PageViews/ChatPage/Cells -FLaiwang/PageViews/ChatPage/MessageSender -FLaiwang/PageViews/ChatPage/MomoChat -FLaiwang/PageViews/ChatPage/UserControls -FLaiwang/PageViews/EventPage/EventCommon -FLaiwang/PageViews/EventPage/EventCreate -FLaiwang/PageViews/EventPage/EventDeprecated -FLaiwang/PageViews/EventPage/EventList -FLaiwang/PageViews/EventPage/EventLottery -FLaiwang/PageViews/EventPage/EventMain -FLaiwang/PageViews/EventPage/EventNotification -FLaiwang/PageViews/EventPage/EventPostDetail -FLaiwang/PageViews/EventPage/EventRecent -FLaiwang/PageViews/EventPage/EventRecommend -FLaiwang/PageViews/EventPage/EventSearch -FLaiwang/PageViews/EventPage/EventSetting -FLaiwang/PageViews/EventPage/EventWall -FLaiwang/PageViews/EventPage/EventZan -FLaiwang/PageViews/EventPage/PubEventRecent -FLaiwang/PageViews/FeedPage/Cells -FLaiwang/PageViews/FeedPage/UserControls -FLaiwang/PageViews/FriendPage/Cells -FLaiwang/PageViews/FriendPage/UserControls -FLaiwang/PageViews/FriendRadarPage/PSCollectionView -FLaiwang/PageViews/FriendRadarPage/PulsingHalo -FLaiwang/PageViews/FriendRadarPage/RNBlurModalView -FLaiwang/PageViews/KnockPage/Answer -FLaiwang/PageViews/KnockPage/Browse -FLaiwang/PageViews/KnockPage/KnockList -FLaiwang/PageViews/KnockPage/SetQuestion -FLaiwang/PageViews/KnockPage/Setting -FLaiwang/PageViews/KnockPage/Statistic -FLaiwang/PageViews/KnockPage/UserControls -FLaiwang/PageViews/KnockPage/VoiceCard -FLaiwang/PageViews/MinePage/UserControls -FLaiwang/PageViews/MorePage/Cells -FLaiwang/PageViews/NotificationPage/Cells -FLaiwang/PageViews/NotificationPage/UserControls -FLaiwang/PageViews/PhotoEditorPage/DataProvider -FLaiwang/PageViews/PhotoEditorPage/DBModel -FLaiwang/PageViews/PhotoEditorPage/UserControls -FLaiwang/PageViews/PostPage/cells -FLaiwang/PageViews/PostPage/UserControls -FLaiwang/PageViews/PubAccountPage/Cells -FLaiwang/PageViews/PubAccountPage/PubToolBar -FLaiwang/PageViews/PubAccountPage/UserControls -FLaiwang/PageViews/SearchPage/SearchCell -FLaiwang/PageViews/SearchPage/SearchCellModel -FLaiwang/PageViews/SearchPage/SearchMsgListPage -FLaiwang/PageViews/SharedPage/Cells -FLaiwang/PageViews/SharedPage/UserControls -FLaiwang/PageViews/ShareMsgPage/UserControls -FLaiwang/SDK/InternalSDK/InternalModel -FLaiwang/SDK/InternalSDK/InternalService -FLaiwang/SDK/LWFileUploadManager/LWProgressObserverCenter -FLaiwang/SDK/LWHostService/BizTasks -FLaiwang/SDK/LWHostService/Utils -FLaiwang/SDK/LWShareTo/ShareModule -FLaiwang/SDK/LWShareTo/ShareRes -FLaiwang/SDK/LWShareTo/ShareService -FLaiwang/SDK/ViewModels/Friends -FLaiwang/SDK/ViewModels/Knock -FLaiwang/SDK/ViewModels/Others -FLaiwang/UserControls/LWProgressView/DACircularProgress -FLaiwang/UserControls/QBImagePicker/LWQBImagePicker+External -FLaiwang/Utils/LWFav/core -FLaiwang/Utils/LWFav/Images -FLaiwang/Utils/LWFav/libs -FLaiwang/Utils/LWFav/UI -FLaiwang/Utils/LWMusic/XiamiSDK -FLaiwang/Utils/NSStringAdditions/NSString_HTML -FLaiwang/Utils/UT/SinaWeibo.bundle -FLaiwang/Integration/LWService/ios/lwservice -FLaiwang/PageViews/EventPage/EventCommon/AttachmentView -FLaiwang/PageViews/EventPage/EventCommon/Comment -FLaiwang/PageViews/EventPage/EventSearch/LWBubbleView -FLaiwang/PageViews/EventPage/EventSearch/LWEventSearchCell -FLaiwang/PageViews/EventPage/EventWall/EventSignIn -FLaiwang/PageViews/KnockPage/Browse/KnockFlipTransition -FLaiwang/PageViews/KnockPage/Browse/LWKnockLocationManager -FLaiwang/Utils/LWFav/libs/CDClient -FLaiwang/Utils/LWFav/libs/file_hash -FLaiwang/Utils/LWFav/libs/GHKit -FLaiwang/Utils/LWFav/libs/PopoverView -FLaiwang/Utils/LWFav/UI/views -FLaiwang/Utils/LWMusic/XiamiSDK/Classes -FLaiwang/Utils/UT/SinaWeibo.bundle/images -FLaiwang/Integration/LWService/ios/lwservice/LaiwangRPC -FLaiwang/Utils/LWMusic/XiamiSDK/Classes/Player -F/Users/henshao/ilaiwang/LaiwangV3/Laiwang -filelist /Users/henshao/Library/Developer/Xcode/DerivedData/Laiwang-fxscnxkslrypubbeazdfkveysldy/Build/Intermediates/Laiwang.build/Debug-iphoneos/Laiwang.build/Objects-normal/arm64/Laiwang.LinkFileList -dead_strip -ObjC -lCNG -lG711 -lG729 -lPods-AMap3DMap -lPods-AMapSearch -lPods-CocoaAsyncSocket -lPods-DevicePrint -lPods-FLEX -lPods-HTTPDNS -lPods-JDStatusBarNotification -lPods-JSONKit -lPods-LWComponentKits -lPods-LWGPUImage -lPods-LWGraffiti -lPods-LWHttpDNSInterceptor -lPods-LWImageAssets -lPods-LWImageFilter -lPods-LWJSONKit -lPods-LWNetworkKit -lPods-LWPlugin -lPods-LWShareKit -lPods-LWXiamiMusic -lPods-MJRefresh -lPods-MtopSDK -lPods-NJKWebViewProgress -lPods-OpenUDID -lPods-PLCrashReporter -lPods-PSTCollectionView -lPods-QupaiSDK -lPods-Reachability -lPods-RegexKitLite -lPods-SDWebImage -lPods-SecurityGuardSDK -lPods-SpeechRecognizer -lPods-TBMstore -lPods-TBScanLib -lPods-TBSecuritySDK -lPods-TBShortURL -lPods-THLabel -lPods-TencentOpenApiSDK -lPods-UserTrack -lPods-VoIPSDK -lPods-ZipArchive -lPods-crossplay -lPods-huoyanSDK_laiwang -lPods-libextobjc -lPods-libwebp -lPods-lwsdk -lPods-mtopext -lQupaiSDK -laudio_coding_module -laudio_conference_mixer -laudio_decoder_interface -laudio_device -laudio_encoder_interface -laudio_processing -lavcodec -lavformat -lavutil -lbitrate_controller -lc++ -lcommon_audio -lcommon_video -lfield_trial_default -liSAC -liSACFix -licucore -lmedia_file -lmetrics_default -lneteq -loffset -lopus -lpaced_sender -lrbe_components -lred -lremote_bitrate_estimator -lrtc_base_approved -lrtc_sound -lrtp_rtcp -lsqlite3 -lsrtp -lstdc++ -lstdc++.6.0.9 -lswscale -lsystem_wrappers -ltbconf -lvideo_coding_utility -lvideo_engine_core -lvideo_processing -lvideo_render_module -lvideo_render_module_impl -lvideo_render_module_internal_impl -lvoice_engine -lwebrtc -lwebrtc_common -lwebrtc_h264 -lwebrtc_i420 -lwebrtc_opus -lwebrtc_utility -lwebrtc_video_coding -lx264 -lxiamiMusic -lxml2 -lyuv -lyuv_neon -lz -framework AMapSearchKit -framework AVFoundation -framework AudioToolbox -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreTelephony -framework CoreText -framework CrashReporter -framework DevicePrint -framework Foundation -framework GLKit -framework ImageIO -framework MAMapKit -framework MobileCoreServices -framework MtopSDK -framework OpenGLES -framework QuartzCore -framework Security -framework SecurityGuardSDK -framework SpeechRecognizer -framework SystemConfiguration -framework TBScanLib -framework TBSecuritySDK -framework TBShortURLResolve -framework TencentOpenAPI -framework UIKit -framework UT -framework huoyan -framework mtopext -weak_framework AdSupport -lstdc++ -ObjC -fobjc-arc -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework LocalAuthentication -framework GameKit -framework AddressBookUI -framework Accelerate -lstdc++.6.0.9 -lxml2 -framework MediaPlayer -framework GLKit -lz -framework SystemConfiguration -framework CoreTelephony -framework Security -framework MessageUI -framework AudioToolbox -framework MobileCoreServices -framework ImageIO -framework QuartzCore -lsqlite3 -lz.1.2.5 -lresolv -liconv -framework AlipaySDK -licucore -framework OpenGLES -framework MapKit -framework CFNetwork -framework AddressBook -framework AssetsLibrary -framework AVFoundation -framework CoreAudio -framework CoreData -framework ShareSDK -framework CoreLocation -framework CoreMedia -framework CoreVideo -framework CoreGraphics -framework UIKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/henshao/Library/Developer/Xcode/DerivedData/Laiwang-fxscnxkslrypubbeazdfkveysldy/Build/Intermediates/Laiwang.build/Debug-iphoneos/Laiwang.build/Objects-normal/arm64/Laiwang_dependency_info.dat -o /Users/henshao/Library/Developer/Xcode/DerivedData/Laiwang-fxscnxkslrypubbeazdfkveysldy/Build/Products/Debug-iphoneos/Laiwang.app/Laiwang
經常使用的工具以下。
[~/ilaiwang/LaiwangV3/Laiwang/PageViews]$ find . -maxdepth 1 -type d -print0 | xargs -0 -I {} sh -c 'echo $(find {} -type f | wc -l) {}' | sort -nr 914 . 167 ./EventPage 92 ./ChatPage 91 ./KnockPage 88 ./FriendPage 86 ./PubAccountPage 54 ./FeedPage 47 ./SharedPage 44 ./PostPage 29 ./SearchPage 29 ./PhotoEditorPage 29 ./MorePage 28 ./NearByPage 26 ./FriendRadarPage 15 ./LoginPage 14 ./MinePage 14 ./AlbumPage 12 ./PhotoFilterPage 10 ./EmotionBoxPage 9 ./ShareMsgPage 8 ./XiamiPage 8 ./NotificationPage 4 ./IntroducePage 2 ./OAuthPage 2 ./NewGuidePage 2 ./MusicPage 2 ./MoviePage 2 ./DiscoveryExPage
grep,搜索文本。結合正則表達式,分析日誌什麼的,很是之強大。grep有幾個有用的選項,分別是「-r」遞歸搜索目錄;「-i」,忽略大小寫;「-c」,統計符合搜索條件的文本的行數;「--color」,高亮搜索結果。
du,統計目錄大小。好比我想知道來往圖片資源的狀況。能夠看出圖片資源一共有8.2MB,其中共享的圖片佔到2.1MB,其次是聊天的圖片佔了1.4MB。
[~/iOS_release/lwimageassets]$ du -sh LWImageAssets
8.2M LWImageAssets [~/iOS_release/lwimageassets/LWImageAssets]$ du -sh * | sort -hr 2.1M shared_img 1.4M chat_img 636K event_img 528K icon_default 524K feed_img 472K post_img 464K knock_img 392K radar_img 284K profile_img 264K friend_img 236K pub_account_map_img 140K editor_img 132K yifa_img 132K emotion_img 84K neighbour_img 80K lwuikits_img 76K discovery_img 72K graffiti_img 72K asr_img 60K login_img 52K video_guide_img 44K qr_img 40K more_img 36K share_msg_img 32K my_img 20K slide_img 16K animal_img 12K xiamibar_img 4.0K search_img 4.0K movie_img
$ file libxiamiMusic.a
libxiamiMusic.a: Mach-O universal binary with 4 architectures libxiamiMusic.a (for architecture armv7): current ar archive random library libxiamiMusic.a (for architecture i386): current ar archive random library libxiamiMusic.a (for architecture x86_64): current ar archive random library libxiamiMusic.a (for architecture arm64): current ar archive random library $ file Laiwang Laiwang: Mach-O 64-bit executable
$ strings Laiwang | head -n 10 kSearchTextKey kSearchedPersonKey invalid_token user_in_black_list user_blocked expired_token invalid_grant refreshed_token client_id client_secret
$ nm Laiwang | head -n 10 00000001001425e4 t +[ABContact addressWithStreet:withCity:withState:withZip:withCountry:withCode:] 0000000100142484 t +[ABContact arrayForProperty:inRecord:] 0000000100146438 t +[ABContact contactWithData:] 000000010014591c t +[ABContact contactWithDictionary:] 000000010014191c t +[ABContact contactWithRecord:] 0000000100141984 t +[ABContact contactWithRecordID:] 0000000100141b70 t +[ABContact contact] 000000010014252c t +[ABContact dictionaryWithValue:andLabel:] 0000000100141c50 t +[ABContact localizedPropertyName:] 00000001001424e8 t +[ABContact objectForProperty:inRecord:]
[~]$ otool -L /Users/henshao/Library/Developer/Xcode/DerivedData/CloudConsoleApp-gszptqenpqtwraajgpawanvtjtny/Build/Products/Debug-iphonesimulator/CloudConsoleApp.app/CloudConsoleApp
/Users/henshao/Library/Developer/Xcode/DerivedData/CloudConsoleApp-gszptqenpqtwraajgpawanvtjtny/Build/Products/Debug-iphonesimulator/CloudConsoleApp.app/CloudConsoleApp:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 237.2.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 55.1.0) /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 216.7.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) @rpath/AFNetworking.framework/AFNetworking (compatibility version 1.0.0, current version 1.0.0) @rpath/ALYUIKit.framework/ALYUIKit (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AVFoundation.framework/AVFoundation (compatibility version 1.0.0, current version 2.0.0) /System/Library/Frameworks/AVKit.framework/AVKit (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Accounts.framework/Accounts (compatibility version 1.0.0, current version 0.0.0) /System/Library/Frameworks/AddressBook.framework/AddressBook (compatibility version 1.0.0, current version 30.0.0) /System/Library/Frameworks/AddressBookUI.framework/AddressBookUI (compatibility version 1.0.0, current version 33.0.0)
[~]$ lsof -i:443 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME AliLang 910 henshao 9u IPv4 0x3db3574b61c3c44b 0t0 TCP 10.65.155.189:55448->42.156.140.98:https (ESTABLISHED) AliLang 910 henshao 11u IPv4 0x3db3574b61c3c44b 0t0 TCP 10.65.155.189:55448->42.156.140.98:https (ESTABLISHED) AliLang 910 henshao 26u IPv4 0x3db3574b61a3225b 0t0 TCP 10.65.155.189:52167->140.205.224.47:https (ESTABLISHED) AliLang 910 henshao 31u IPv4 0x3db3574b61a3225b 0t0 TCP 10.65.155.189:52167->140.205.224.47:https (ESTABLISHED) node 33986 henshao 32u IPv4 0x3db3574b602f525b 0t0 TCP 30.9.158.49:53822->ec2-54-235-138-91.compute-1.amazonaws.com:https (ESTABLISHED) nwjs 77209 henshao 129u IPv4 0x3db3574b6360d06b 0t0 TCP 10.65.155.189:54516->140.205.32.75:https (ESTABLISHED) ^C [~]$ ps aux | grep 910 henshao 910 0.0 0.2 2728464 20204 ?? S 1 716 10:55.29 /Applications/AliLang.app/Contents/MacOS/AliLang
$ xcrun swift-demangle __TFFC15CloudConsoleApp31ALYDomainNewOwnerViewController7confirmFPs9AnyObject_T_U_FGSQGVs10DictionaryCSo8NSObjectPS1____T_ _TFFC15CloudConsoleApp31ALYDomainNewOwnerViewController7confirmFPs9AnyObject_T_U_FGSQGVs10DictionaryCSo8NSObjectPS1____T_ ---> CloudConsoleApp.ALYDomainNewOwnerViewController.(confirm (Swift.AnyObject) -> ()).(closure #1)
作簡單的文本編輯和分析,vim是很是方便的。最簡單有用的配置以下。在HOME目錄下建立.vimrc隱藏文件,把下面的內容拷貝進去便可。
syntax on #支持語法高亮,看源代碼文件會很舒服。 set hls #使用 / 查找內容的時候,會高亮字符串。 set ic #搜索的時候忽略大小寫
CocoaPods的源都安裝在"~/.cocoapods/repos"目錄下,有時候找不到pod、版本有問題、或者想肯定一下pod的信息,均可以來這個地方翻一翻。
[~/.cocoapods/repos]$ ls TBMainClientSpecs/ alibaba/ master/ [~/.cocoapods/repos]$ ls TBMainClientSpecs/ AMPSDK/ TBCalendar/ TBLoginCenter/ TBScanCode/ TBWeiTao/ AccsSDK/ TBCalendarService/ TBLoginService/ TBScanCodeService/ TBWeiTaoService/ [~]$ pod search swiftyjson -> AISwiftyJSON (1.0.6) AISwiftyJSON makes it easy to deal with JSON data in Swift . pod 'AISwiftyJSON', '~> 1.0.6' - Homepage: https://github.com/asiainfomobile/AISwiftyJSON - Source: git@mirror.git.alibaba-inc.com:asiainfomobile/AISwiftyJSON.git - Versions: 1.0.6, 1.0.3 [master repo] -> SwiftyJSON (2.3.2) SwiftyJSON makes it easy to deal with JSON data in Swift pod 'SwiftyJSON', '~> 2.3.2' - Homepage: https://github.com/SwiftyJSON/SwiftyJSON - Source: git@mirror.git.alibaba-inc.com:SwiftyJSON/SwiftyJSON.git - Versions: 2.3.2, 2.3.1, 2.3.0, 2.2.1, 2.2.0, 2.1.3 [master repo]
爲了方便執行pod update --verbose
,能夠設置一個別名,好比pu
,這樣能夠快得飛起。
$ echo "alias pu='pod update --verbose'" >> ~/.bash_profile && . ~/.bash_profile $ pu
Mac自帶了sqlite命令行工具。小工具用起來很快很方便。因此簡單介紹一下怎麼使用這個工具。其實".help"講得很詳細啦。
[~/Downloads]$ sqlite3 laiwang.sqlite3
SQLite version 3.8.5 2014-08-15 22:37:57 Enter ".help" for usage hints. sqlite> .tables lw_messages lw_session_event_post lw_offline_post2 lw_sessions sqlite> .schema lw_sessions CREATE TABLE lw_sessions (primaryKey INTEGER primary key autoincrement, sessionId TEXT, userId TEXT, title TEXT, icon TEXT, content TEXT, sourceType TEXT, data BLOB, actionType TEXT, actionContent TEXT, senderId TEXT, settings BLOB, unreadCount INTEGER, pushEnnabled INTEGER, lastModify TEXT, ancientStampInDB TEXT, recentStampInDB TEXT, sortIndex INTEGER, background TEXT, members BLOB); CREATE UNIQUE INDEX idx_sessions_SidUidSt ON lw_sessions(sessionId, userId, sourceType); CREATE INDEX idx_sessions_UidStSiLm ON lw_sessions(userId, sourceType, sortIndex, lastModify); sqlite> select * from lw_sessions limit 1; 1|2651304|2921438|新浪新聞|http://i01.lw.aliimg.com/tfs/T1vldnFFXbXXbKnNzJLAIWANGtebus_73957a0c_180_180.60x60.jpg||pubmessage|||{"type":""}|||0|0|1429026489000|||0||
SimpleHTTPServer模塊絕對是Python最有用的一個模塊(另一個多是json)。一個命令就能啓動一個Web服務器,作演示或者mock接口,不要太方便了。
[~]$ python -m SimpleHTTPServer 9876 Serving HTTP on 0.0.0.0 port 9876 ...
nomad houston這個工具支持在命令行下給APP推送信息,感受蠻不錯的。詳細介紹請看:使用Houston給iOS APP推送信息。