linux常用命令解決辦法

來源:互聯網
上載者:User
linux常用命令
系統資訊 arch 顯示機器的處理器架構(1) uname -m 顯示機器的處理器架構(2) uname -r 顯示正在使用的核心版本 dmidecode -q 顯示硬體系統組件 - (SMBIOS / DMI) hdparm -i /dev/hda 羅列一個磁碟的架構特性 hdparm -tT /dev/sda 在磁碟上執行測試性讀取操作


系統資訊
arch 顯示機器的處理器架構(1)
uname -m 顯示機器的處理器架構(2)
uname -r 顯示正在使用的核心版本
dmidecode -q 顯示硬體系統組件 - (SMBIOS / DMI)
hdparm -i /dev/hda 羅列一個磁碟的架構特性
hdparm -tT /dev/sda 在磁碟上執行測試性讀取操作
cat /proc/cpuinfo 顯示CPU info的資訊
cat /proc/interrupts 顯示中斷
cat /proc/meminfo 校正記憶體使用量
cat /proc/swaps 顯示哪些swap被使用
cat /proc/version 顯示核心的版本
cat /proc/net/dev 顯示網路介面卡及統計
cat /proc/mounts 顯示已載入的檔案系統
lspci -tv 羅列 PCI 裝置
lsusb -tv 顯示 USB 裝置
date 顯示系統日期
cal 2007 顯示2007年的日曆表
date 041217002007.00 設定日期和時間 - 月日時分年.秒
clock -w 將時間修改儲存到 BIOS



關機 (系統的關機、重啟以及登出 )
shutdown -h now 關閉系統(1)
init 0 關閉系統(2)
telinit 0 關閉系統(3)
shutdown -h hours:minutes & 按預定時間關閉系統
shutdown -c 取消按預定時間關閉系統
shutdown -r now 重啟(1)
reboot 重啟(2)
logout 登出



檔案和目錄
cd /home 進入 '/ home' 目錄'
cd .. 返回上一級目錄
cd ../.. 返回上兩級目錄
cd 進入個人的主目錄
cd ~user1 進入個人的主目錄
cd - 返回上次所在的目錄
pwd 顯示工作路徑
ls 查看目錄中的檔案
ls -F 查看目錄中的檔案
ls -l 顯示檔案和目錄的詳細資料
ls -a 顯示隱藏檔案
ls *[0-9]* 顯示包含數位檔案名稱和目錄名
tree 顯示檔案和目錄由根目錄開始的樹形結構(1)
lstree 顯示檔案和目錄由根目錄開始的樹形結構(2)
mkdir dir1 建立一個叫做 'dir1' 的目錄'
mkdir dir1 dir2 同時建立兩個目錄
mkdir -p /tmp/dir1/dir2 建立一個分類樹
rm -f file1 刪除一個叫做 'file1' 的檔案'
rmdir dir1 刪除一個叫做 'dir1' 的目錄'
rm -rf dir1 刪除一個叫做 'dir1' 的目錄並同時刪除其內容
rm -rf dir1 dir2 同時刪除兩個目錄及它們的內容
mv dir1 new_dir 重新命名/移動 一個目錄
cp file1 file2 複製一個檔案
cp dir/* . 複製一個目錄下的所有檔案到當前工作目錄
cp -a /tmp/dir1 . 複製一個目錄到當前工作目錄
cp -a dir1 dir2 複製一個目錄
ln -s file1 lnk1 建立一個指向檔案或目錄的軟連結
ln file1 lnk1 建立一個指向檔案或目錄的物理連結
touch -t 0712250000 file1 修改一個檔案或目錄的時間戳記 - (YYMMDDhhmm)
file file1 outputs the mime type of the file as text
iconv -l 列出已知的編碼
iconv -f fromEncoding -t toEncoding inputFile > outputFile creates a new from the given input file by assuming it is encoded in fromEncoding and converting it to toEncoding.
find . -maxdepth 1 -name *.jpg -print -exec convert "{}" -resize 80x60 "thumbs/{}" \; batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.