歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> SHELL編程 >> Linux shell 常用命令記錄

Linux shell 常用命令記錄

日期:2017/2/28 14:48:31   编辑:SHELL編程

最近為了方便管理托管的服務器,開始部署vmserver了。db服務器打算部署成linux的,目前采用的是Ubuntu,server版本的系統裝好之後傻了眼,全命令行的。。。所以開始大肆搜集有用到的命令,放在這裡做個備忘吧。

1、強制卸載、安裝網卡,用於強制從dhcp獲取ip

sudo ifdown eth0

sudo ifup eth0

(類似sudo dhclient -r之類的,目前使用情況來看,貌似沒生效。回頭發現什麼再補充吧。)

2、關機、重啟

sudo shutdown –p 0 在0秒後關機並關閉電源

sudo shutdown –r 0 在0秒後關機並重啟

3、ubuntu server設置靜態IP

$sudo vi /etc/network/interfaces 編輯IP設置文件

-------------------------------------------------分割線------------------------------------------------

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# This is a list of hotpluggable network interfaces.

# They will be activated automatically by the hotplug subsystem.

mapping hotplug

script grep

map eth0

# The primary network interface

auto eth0

iface eth0 inet static

address 192.168.0.100 # This is your IP

netmask 255.255.255.0

network 192.168.0.0

broadcast 192.168.0.255

gateway 192.168.0.1

-------------------------------------------------分割線------------------------------------------------

sudo /etc/init.d/networking restart 重啟網絡連接

4、解壓tar.gz包

tar –xzf 不打印解壓進度

tar –xvzf 打印解壓進度

5、移動文件夾或重命名文件夾

mv from to

6、新增用戶、用戶組

groupadd usergroup 增加用戶組

useradd –r – g user usergroup 增加用戶到組

7、變更文件夾所屬owner及 group(.表示所有文件及文件夾)

chown –R user .

chgrp –R user .

8、復制文件

cp from to

9、修改用戶密碼

passwd [username]

其他待續吧

Copyright © Linux教程網 All Rights Reserved