Linux常用命令

2021-04-29 07:04:01 字數 3061 閱讀 1761

1,檢視核心版本命令:

cat   /proc/version

[bash-3.00]$ cat   /proc/version

linux version 2.6.9-22.elsmp ([email protected]) (gcc version 3.4.4 20050721 (red hat 3.4.4-2)) #1 smp mon sep 19 18:32:14 edt 2005

uname   -a

uname   -r cat   /etc/issue

man   uname

2,檢視linux版本:抄錄如下:

1) 登入到伺服器執行 lsb_release -a ,即可列出所有版本資訊,例如:

adapter-suse10:/etc # cat /etc/suse-release

suse linux enterprise server 10 (i586)

version = 10

adapter-suse10:/etc # lsb_release -a

lsb version: core-2.0-noarch:core-3.0-noarch:core-2.0-ia32:core-3.0-ia32:desktop-3.1-ia32:desktop-3.1-noarch:graphics-2.0-ia32:graphics-2.0-noarch:graphics-3.1-ia32:graphics-3.1-noarch

distributor id: suse linux

description:    suse linux enterprise server 10 (i586)

release:        10

codename:       n/a

這個命令適用於所有的linux,包括redhat、suse、debian等發行版。

2) 登入到unix執行cat /etc/*-release ,例如如下:

[bash-3.00]$ cat /etc/redhat-release

red hat enterprise linux es release 4 (nahant update 2)

這種方式下可以直接看到具體的版本號,比如 as4 update 2

[adapter-suse10:/etc] # cat /etc/suse-release

suse linux enterprise server 10 (i586)

version = 10

3)登入到linux執行rpm -q redhat-release ,例如如下

bash-3.00$ rpm -q redhat-release

redhat-release-4es-3

這種方式下可看到乙個所謂的release號,比如上邊的例子是3

這個release號和實際的版本之間存在一定的對應關係,如下:

redhat-release-3as-1 -> redhat enterprise linux as 3

redhat-release-3as-7.4 -> redhat enterprise linux as 3 update 4

redhat-release-4as-2 -> redhat enterprise linux as 4

redhat-release-4as-2.4 -> redhat enterprise linux as 4 update 1

redhat-release-4as-3 -> redhat enterprise linux as 4 update 2

redhat-release-4as-4.1 -> redhat enterprise linux as 4 update 3

redhat-release-4as-5.5 -> redhat enterprise linux as 4 update 4

注意:此種方法只對redhat linux有效

#檢視開機執行時間

uptime

09:44:45 up 67 days, 23:32,  ...

:-) ,看來剛才確實是網段的問題,我的機器還是67天前開機的。

#系統資源使用情況

vmstat 1 -s m

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------

r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st

0  0      0    233    199    778    0    0     4    25    1    1  3  0 96  0  0

0  0      0    233    199    778    0    0     0     0 1029  856 13  1 86  0  0

這個還是專門分一片文章來描述吧

今天使用svn進行系統遷移,結果發現最初的路徑寫錯了,導致無法訪問源伺服器,檢視 .svn/entries 大致了解了一下裡面的內容。重新遷移時間太久了,還是直接把檔案替換掉吧

for f in $(find ./ -type f -name 'entries')

dosed -i "s/202/.68/.134/.18/202/.68/.134/.34/g" $f

done

sed 簡單說明:

sed "s/sourcestring/newstring/g" $f

把 $f 檔案中的 sourcestring 換成 newstring,輸出到終端。s 表示搜尋替換,/g表示全域性。

sed -i $f

表示直接在 $f 中修改。

sed -iback $f

表示修改後的檔案另存為 $fback

sed 中所有正規表示式都必須使用嚴格的轉義符 / 來限定

sed 的正則比較嚴格: " / / ! 都需要分別用 /" // // /! 轉義。

/n 表示換行

Linux常用命令之Linux常用命令實戰知識點

在在複習linux,這是以前做的筆記,分享一下。linux系統 一切皆檔案 操作檔案就是操作linux系統 一 linux版本 1 redhat 企業版 收費 2 centos redhat的社群版 免費 3 ubuntu 4 紅旗 二 linux的特點 1 多使用者 多工 2 豐富的網路功能 3 ...

LINUX常用命令

一 目錄結構 目錄名稱 意 義 vmlinuz 該目錄中存放的是系統核心 bin 該目錄中存放linux的常用命令,在有的版本中是一些和根目錄下相同的目錄。boot 該目錄下存放的都是系統啟動時要用到的程式,當用lilo引導linux時,會用到這裡的一些資訊 dev 該目錄包含了linux系統中使用...

linux 常用命令

ssh 連線 eg.ssh l mike www.mydomain.com or 192.168.0.1 scp 複製 本地 遠端 scp localfile username tohost newfile 遠端 本地 scp username tohost remotefile local 把tx...