Linux常用到的命令

來源:互聯網
上載者:User

1. Ubuntu獲得root許可權

在終端中輸入:
sudo passwd root
Enter new UNIX password: (在這輸入你的密碼)
Retype new UNIX password: (確定你輸入的密碼)
passwd: password updated successfully

以後,如果在想獲得root許可權,只需進行如下的操作:
su root
Password
: (在此輸入你上面設定的密碼)

如果要再次禁用 root 帳號,

那麼可以執行 sudo passwd -l root

2. ifconfig

執行個體一:
比如我們用ifconfig 來調試 eth0網卡的地址
[root@linuxchao ~]#ifconfig eth0 down
[root@linuxchao ~]#ifconfig eth0 192.168.1.99 broadcast 192.168.1.255 netmask 255.255.255.0
[root@linuxchao ~]#ifconfig eth0 up
[root@linuxchao ~]#ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:03:0D:27:86:41
inet addr:192.168.1.99 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::203:dff:fe27:8641/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:618 errors:0 dropped:0 overruns:0 frame:0
TX packets:676 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:491238 (479.7 KiB) TX bytes:86286 (84.2 KiB)
Interrupt:5 Base address:0x8c00

註解: 上面的例子我們解說一下;

第一行:ifconfig eth0 down 表示如果eth0是啟用的,就把它DOWN掉。此命令等同於 ifdown eth0;
第二行:用ifconfig 來配置 eth0的IP地址、廣播位址和網路遮罩;
第三行:用ifconfig eth0 up 來啟用eth0 ; 此命令等同於 ifup eth0
第四行:用 ifconfig eth0 來查看 eth0的狀態;


3. 程式後台執行

方法1:

# ./pso > pso.file 2>&1 &

解釋:將pso直接放在後台運行,並把終端輸出存放在目前的目錄下的pso.file檔案中。

      當用戶端關機後重新登陸伺服器後,直接查看pso.file檔案就可看執行結果(命

令:#cat pso.file )。

  方法2在終端輸入命令:

# nohup 
./pso > pso.file 2>&1 &

解釋:nohup就是不掛起的意思,將pso直接放在後台運行,並把終端輸出存放在當前

目錄下的pso.file檔案中。當用戶端關機後重新登陸伺服器後,直接查看pso.file

檔案就可看執行結果(命令:#cat pso.file
)。

 方法3 如果不關心輸出資訊,可以直接Ctrl + Z



相關文章

聯繫我們

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