linux常用命令小記

來源:互聯網
上載者:User

  有時在進行目錄操作的時候,經常接觸到命令,於是就要翻手冊,或上網問狗狗哥了,這裡我把平時碰到的常用的不常用的都陸續列出來,供以後學習參考……

一般規則:指令  選項  參數

cd  .    ..   

rm  -f       -rf

pwd      /home/xing   使用者主目錄

date   cal

touch 建立檔案 或更新時間

mkdir    rmdir  -r -f

uname  -n 主機名稱 -a詳細資料 系統 時間

ls -la目前的目錄所以檔案  ls -l    ll          目錄:深藍色   檔案:白色

sort -k -n -o

who | wc -l -w -c   計數  組合命令

read -p "please enter your name" -t 30 name     把輸入存放到一個變數中 ,寫bash指令碼時用

cat -v 讀取輸入,顯示Ctrl+D

**** >>fileName  儲存輸出結果  >

  ls   --help

  man  ls    詳細

  info ls    更加詳細

man 1  man 5 

q退出

useradd  name  

passwd name 啟用使用者

gnome-panel  面板重新出現

ifconfig

ssh   ps -ef | grep ssh    主機

 

df -h   查看磁碟分割情況

/proc   為虛擬目錄,記憶體裡內容的一個映射,開機後自動產生,包含系統各種資訊

cat /proc/cpuinfo   CPU資訊              

sudo lshw   硬體資訊

檢測cpu溫度,命令 sensors  名字install lm-sensors

sudo apt-get install lm-sensors sensors-applet

手動設定感應器

sudo sensors-detect

裝其他監視軟體

sudo apt-get install xsensors

sudo apt-get install gdesklets gkrellm

sudo apt-get install hddtemp

圖形化介面:

 xsensors

過濾器

/dev/std*

輸入輸出重新導向  0 stdin   1 stdout   2  stderror

 

cat > listfile.txt <<*    *位結束標誌符  從鍵盤讀取資料

tr 'A-Z' 'a-z' < listfile.txt 

ls -l > listfile.txt

ls -l 2> listfile.txt  錯誤資訊重新導向到檔案

ls -l >> listfile.txt   不會覆蓋

find /etc -name passwd 2>err.txt > listfile.txt

find /etc -name passwd &> listfile.txt 所有資訊輸入到一個檔案

 

管道 |  

ls -l | more

ls -l /etc |more | grep fstab     多重管道

cat < err.txt >listfile.txt     前一個檔案內容拷貝到後一個

echo 'STRIND ' > file.txt     

cat file.* > file    合并到一個檔案中

cat filea fileb > file

檔案尋找與管理

 

可執行檔   which ls    系統路徑 echo $PATH

whereis ls  更完整

slocate 檔案名稱

find -user -group -nouser -nogroup name perm size type 

find /etc/ -user root

find /home   -size +1000k      -100k

type  類型  d l b 

find /home -perm 0644   讀寫 讀 讀   -exec

 

wc -l -w -c file    統計  行  字 字元

grep -n -v  匹配關鍵字的行

sort -r -t -k3     排序 

diff comp   uniq   cut -c4-8 file  paste垂直拼接 cat水平

 

壓縮

gzip 檔案   gunzip     .gz

zcat

bzip2     bunzip2     .bz2

bzcat  

tar   c檔案備份   v過程輸出  x 從一個檔案解出備份  f指定打包檔案

xvf     xvf   

tar tf x.tar   查看打包檔案 

tar zcvf new.tar.gz   old

tar jcvf test.tar.bz2 Ubuntu\ One/

tar jxvf test.tar.bz2 

 

dump 備份    restore

身份

who  groups  id   finger    whoami     w

使用者  useradd xiangzi     passwd   usermod

/etc/passwd   login name:passwd:uid:gid:full name:home directory:shell   root  :  x  :  

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.