Tag: command line

  • How to override the path of PHP to use the MAMP path?

    最近在學習 Laravel Framework 的使用,現在 PHP 許多 Library、Framework 都改用了 composer.phar 這個套件管理功能。 其中許多管理功能需要在 command line 輸入指令,但是 Mac 其實也有內建 PHP,卻缺了許多常用的套件。 與其去補安裝套件,不如改用 MAMP 的 PHP 還比較省事。 在 ~/.bash_profile 加入以下指令: export PATH=”/Applications/MAMP/bin/php/php5.5.3/bin:$PATH” 這樣使用 PHP 指令就會自動選用 MAMP 下的版本和套件,其中紅字請改為您使用的版號。

  • How to find out CPU model on Mac?

    一時好奇如何查詢自己 Mac 上的 CPU 型號是什麼,在 Google 上找到了解答,只需要在 Terminal 下個指令就可以了。 sysctl -n machdep.cpu.brand_string 得到以下字串 Intel(R) Core(TM) i5-2415M CPU @ 2.30GHz 查看完整的 CPU 資訊 system_profiler SPHardwareDataType 得到以下資訊 Hardware Overview: Model Name: MacBook Pro Model Identifier: MacBookPro8,1 Processor Name: Intel Core i5 Processor Speed: 2.3 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per…

  • SVN: How to get list of files changed between two revisions

    公司在更新客戶的程式碼時慣例上是只傳送有變動的程式碼。 老實說我覺得還挺麻煩的,不是每個 SVN Client 都有提供這方面的功能,目前我還只會手動處理,希望能有更方便的方法匯出特定版本區間的變動檔案。 列出 x 與 y 兩個版本區間的變動檔案列表 svn diff -r x:y –summarize 打包變動過的檔案 zip patch_vXXX.zip `svn diff -r x:y –summarize . | grep . | awk ‘{print $2}’ | grep -E -v ‘^\.$’` 列出資料夾裡的所有檔案 find . -type f 計算檔案數量 find . -type f | wc -l

  • How to use the MAMP Mysql command line client in a terminal

    這篇是寫給自己的筆記,因為我老忘了路徑…. Mac 用 Terminal 登入 MAMP MySQL 的路徑如下 /Applications/MAMP/Library/bin/mysql -uroot -p

  • Windows 如何找到佔用 port 的程式?

    最近要在桌機上安裝 nginx for windows 時,發現一直啟動失敗,但是 config 測試是 OK 的。想說可能會是 port 80 被佔用了。在 Windows 上要查出 port 被哪支程式佔用並不難,只消兩行指令就可以了。 先進入命令提示列 (Command Prompt)。輸入 C:\>netstat -ano | findstr 0.0:80 得到如下的字串 TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       1860 其中 1860 就是佔用 port 的程式 PID,再輸入 C:\>tasklist | findstr 1860 得到如下的資訊 httpd.exe                  1860 Services                0      4,148 K 表示佔用的是 httpd.exe,也就是 Apache Server 還開著。關掉 httpd.exe 再啟動 nginx…

  • Windows Vista / 7 檔案複製、移動、同步指令:robocopy

    最近在整理外接硬碟的檔案,想把整顆 500GB 硬碟的資料複製到另一顆新硬碟,想起以前看過 Windows 7 有個內建指令可以加速這個工作:robocopy。 這指令名字很好記,跟【機器戰警】RoboCop 只差了一個字 XD。實際上這個指令從 Windows Vista 就開始內建了,其他 Windows 作業系統則要另外安裝微軟提供的套件才有。

  • 如何使用 nslookup 驗證 DNS 設定?

    每次要查 DNS 設定都會忘記那個指令叫啥? “那個不太常用,但有時候很實用的指令” 是 Windows Console 下的 nslookup。這篇寫作教學,實際上是給自己筆記的。 windows console 就是命令列,在 開始 » 執行 輸入 cmd 就可以進入 console 模式。

Exit mobile version