常見命令格式:命令 [-options] [參數(shù)]
配置用戶
git config --global user.name "自已的名字"
git config --global user.email "自已的郵箱地址"
pwd (Print Working Directory) 查看當(dāng)前目錄
cd (Change Directory) 切換目錄筛谚,如 cd /etc
ls (List) 查看當(dāng)前目錄下內(nèi)容址遇,如 ls -al
mkdir (Make Directory) 創(chuàng)建目錄,如 mkdir blog
touch 創(chuàng)建文件,如 touch index.html
wc (Word Count) 字?jǐn)?shù)信息統(tǒng)計邪乍,如 wc index.html
wc -l filename 報告行數(shù)wc -c filename 報告字節(jié)數(shù)
wc -m filename 報告字符數(shù)wc -w filename 報告單詞數(shù)
cat 查看文件全部內(nèi)容宙帝,如 cat index.html
more less 查看文件秤朗,如more /etc/passwd丹莲、less /etc/passwd
rm (remove) 刪除文件,如 rm index.html朗涩、rm -rf ?blog
rmdir (Remove Directory) 刪除文件夾忽孽,只能刪除空文件夾,不常用
mv (move) 移動文件或重命名,如 mv index.html ./demo/index.html
cp (copy) 復(fù)制文件兄一,cp index.html ./demo/index.html
head 查看文件前幾行厘线,如 head -5 index.html
tail 查看文件后幾行 –n –f,如 tail index.html出革、tail -5 index.html?
tab 自動補(bǔ)全造壮,連按兩次會將所有匹配內(nèi)容顯示出來
history 查看操作歷史
ssh 遠(yuǎn)程登錄,如ssh root@gitlab.study.com
> 和 >>重定向骂束,如echo hello world! > README.md耳璧,>覆蓋 >>追加
把原來輸入的內(nèi)容,自己指定到別的地方展箱。
把原本輸出到屏幕上的內(nèi)容旨枯,寫入到指定的文件當(dāng)中。如果文件不存在混驰,會自動幫你創(chuàng)建文件攀隔。
wget 下載,如wget https://nodejs.org/dist/v4.4.0/node-v4.4.0.tar.gz
tar 解壓縮栖榨,如tar zxvf node-v4.4.0.tar.gz
curl 網(wǎng)絡(luò)請求昆汹,如curl http://www.baidu.com
who am i 查看當(dāng)前用戶
| 管道符
把上一次的結(jié)果當(dāng)做下一次的參數(shù)。
grep 匹配內(nèi)容治泥,一般結(jié)合管道符使用