linux命令之使用篇【以後會不斷豐富】

來源:互聯網
上載者:User

以下所有的命令均在aix6.1.0.0下通過(查看aix版本資訊的命令為oslevel)

1、chown

參考網站

http://baike.baidu.com/view/1229019.htm

 

使用:

chown beps:beps  /cnaps2/rel/beps/bin/BE*

 

2、passwd檔案解析

網站:

http://www.dzsc.com/data/html/2009-8-5/78085.html

檔案一部分:

root:!:0:0::/:/usr/bin/ksh

解析:

使用者登入名稱:登入口令:使用者標識號:組標識號:使用者主目錄:命令解釋程式

 

3、su

網站

http://zhidao.baidu.com/question/142357453.html

 

應用執行個體

su - beps -c "cd /cnaps2/src/beps/source

 

man su的例子:

Examples
       1    To obtain root user authority, enter:

            su

            This command runs a subshell with the effective user ID and privileges of the root user. You will be asked for the
            root password. Press End-of-File, Ctrl+D key sequence, to end the subshell and return to your original shell
            session and privileges.
       2    To obtain the privileges of the jim user, enter:

            su jim

            This command runs a subshell with the effective user ID and privileges of jim.
       3    To set up the environment as if you had logged in as the jim user, enter: su - jim

            This starts a subshell using jim's login environment.
       4    To run the backup command with root user authority and then return to your original shell, enter:

            su root "-c /usr/sbin/backup -9 -u"

            This runs the backup command with root user authority within root's default shell. You must give the correct root
            password when queried for the command to execute.

3、ls

http://blog.csdn.net/freedom2028/article/details/7104014

4、grep 命令的實用外加解說

4.1 搜尋目前的目錄下帶wxp這個三個字元(不區分大小寫)的文本並標出其所在行號

grep -rin wxp *

4.2 在group 檔案中搜尋行尾帶root的行,同時在group檔案裡面搜尋行首為sys的行

說明:

'^':指匹配的字串在行首,
'$':指匹配的字串在行尾,

grep root$ group 

grep ^sys group


-r 遞迴遍曆目錄下的所有檔案夾

-i 不區分大小寫

-n 標出內容所在行號

結果如下:

mytest/wxp.txt:1:WXP
mytest/wxp.txt:2:wxp
x.txt:3:dddddddwxpi

5. vi 命令介紹

5.1 跳到一行的末尾 $

5.2 跳到一行的開始 ^

5.3 跳到檔案的末尾行shift+g(這個命令好像是跳到檔案末尾行的開始)

5.4  跳到檔案的開始行:0,然後斷行符號 

5.5 刪除游標所在行用dd

6 tar命令詳解  出處:鳥哥的私房菜(3版本)

tar 命令參數詳解

-c 建立打包檔案

-t 查看打包檔案的內容含有哪些檔案名稱

-x 解打包或解壓縮的功能

-v 在解壓縮過程中,將正在處理的檔案名稱顯示出來

-f filename -f後面要接被處理的檔案名稱 建議-f單獨寫一個參數

-C 壓縮的時候指定要壓縮的檔案路徑

前提:wxp目錄下的檔案屬主為ibps

wxp.tar 使用者的屬主為root

作業系統為aix

建立一個歸檔檔案

G2DBT1:/wxp#tar -cv -f wxp.tar ./
a ./
a ./301.txt 20 blocks.
a ./sml 1 blocks.
a ./test
a ./test/301.txt 20 blocks.
a ./test/sml 1 blocks.
wxp.tar same as archive file, not archived

查看歸檔檔案:

G2DBT1:/wxp#tar -tv -f wxp.tar
drwxr-xr-x 503 402       0 Apr 13 20:17:37 2013 ./
-rwxr-xr-x 503 402   10240 Apr 13 19:34:24 2013 ./301.txt
-rw-r--r-- 503 402      11 Apr 08 16:21:31 2013 ./sml
drwxr-xr-x 503 402       0 Apr 13 19:47:20 2013 ./test/
-rwxr-xr-x 503 402   10240 Apr 13 19:34:24 2013 ./test/301.txt
-rw-r--r-- 503 402      11 Apr 08 16:21:31 2013 ./test/sml

歸檔的時候會把檔案的使用者以及使用者組也儲存下來

解壓開歸檔檔案:

G2DBT1:/wxp/wxp_2#tar -xv -f ../wxp.tar 
x .
x ./301.txt, 10240 bytes, 20 media blocks.
x ./sml, 11 bytes, 1 media blocks.
x ./test
x ./test/301.txt, 10240 bytes, 20 media blocks.
x ./test/sml, 11 bytes, 1 media blocks.
G2DBT1:/wxp/wxp_2#ls
301.txt  sml      test

7 mount命令

 *    the node (if the mount is remote)
       *    the object mounted
       *    the mount point
       *    the virtual-file-system type
       *    the time mounted
       *    any mount options

8 檔案結束符的快速鍵

ctrl+d

9、ftp

1)、open 後跟IP就是串連到IP所在的機器上

2)、user 跟上使用者名稱,按斷行符號會提示輸入密碼,輸入密碼正確,串連主機成功

3)、pwd可以查看遠程主機的目前的目錄

4)、cd 可以切換遠程主機的目錄

5)、lcd dir  將本地工作目錄切換到dir下

6)、get  檔案   傳輸一個檔案

7)、mget 檔案清單  傳輸多個檔案

8)、bin  二進位傳輸檔案

9)、prompt off  關閉互動  比如上傳很多東西的時候,沒有該條指令,那麼就是傳一個檔案,就會提示一個輸入Y,以進行下一個檔案的傳輸

10)、close  與 open對應,中斷與遠程伺服器串連

11 )bye 退出ftp會話過程

10、 svmon

http://www.eygle.com/digest/2009/07/ibm_aix_svmon.html

11、ldd與nm

ldd  Lists dynamic dependencies.

nm Displays information about symbols in object files, executable files, and object-file libraries.

12、ps

-T pid

Displays the process hierarchy rooted at a given pid in a tree format using ASCII art. This flag can be used in combination with the -f, -F, -o, and -l flags.

IBPS_compiler1:/#ps -T 7733438
      PID    TTY  TIME CMD
  7733438      -  0:00 cics
  5963870      -  0:00    |\--cicsrl
  6881404      -  0:00    |\--cicsic
  7274532      -  0:00    |\--cicslm
 10485830      -  0:00    |    \--cicsip
 10158188      -  0:07    |\--cicsam
  7929960      -  0:00    |   |\--cicsas
  9240676      -  0:07    |   |\--cicsas
  9306152      -  0:00    |   |\--cicsas
  9437246      -  0:00    |   |\--cicsas
  9502766      -  0:00    |   |\--cicsas
  9633846      -  0:00    |   |\--cicsas
  9764914      -  0:00    |   |\--cicsas
  9830478      -  0:00    |   |\--cicsas
  9895992      -  0:02    |   |\--cicsas
  9961530      -  0:01    |   |\--cicsas
 10027068      -  0:01    |   |\--cicsas
 10092772      -  0:00    |   |\--cicsas
 10354758      -  0:00    |   |\--cicsas
 10420292      -  0:00    |   |\--cicsas
 10551372      -  0:00    |   |\--cicsas
 10616912      -  0:00    |   |\--cicsas
 10682452      -  0:00    |   |\--cicsas
 12517588      -  0:00    |   |\--cicsas
 12845266      -  0:00    |   |\--cicsas
 12976376      -  0:00    |    \--cicsas
 12779586      -  0:00     \--cicsld

13 ln

作用:

當我們需要在不同的目錄,用到相同的檔案時,我們不需要在每一個需要的目錄下都放一個必須相同的檔案,我們只要在某個固定的目錄,放上該檔案,然後在其它的目錄下用ln命令連結(link)它就可以,不必重複的佔用磁碟空間

永久連結

只適用於同一個檔案系統之下,且ln預設的操作(不加任何參數)為永久連結。特點:會在你選定的位置上產生一個和源檔案大小相同的檔案

軟連結:

可以跨檔案系統,ln -s 源檔案 目標檔案  特點:只會在你選定的位置上產生一個檔案的鏡像,不會佔用磁碟空間

共同點:

無論是符號連結還是永久連結,檔案都保持同步變化

不同點:

除了各自的特點外,永久連結結果是目標檔案與源檔案具有相同的i-node,而軟連結的結果是目標檔案與源檔案具有不相同的i-node,如果刪除源檔案,符號連結的目標檔案將不可用。


Sample:

81994 -rw-r--r--    2 cics     cics         171027 Jun 07
17:16 222
81994 -rw-r--r--    2 cics     cics         171027 Jun 07 17:16 IBPS_1
82011 lrwxrwxrwx    1 cics     cics              3 Jun 20 11:56 x -> 111

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.