· learnings  · 3 min read

Linux学习日志 Ⅰ

总结一下所学的东西而已,都是linux里面比较基本的东西。 (本人所用平台是Fedora Core 5 + Xen virtual machine)

混混级  开机关机
启动到console用init 3, 回到xwindow, 用init 5 or startx (以下是各层对照表)
–    Level 0: Halt
–    Level 1: Single user mode
–    Level 2: Multi user mode without networking
–    Level 3: Full multi user mode
–    Level 5: Level 3 plus X11
–    Level 6: Reboot

关机命令 (不太清楚这么多有什么区别)
“poweroff”, “halt”, “reboot” and “shutdown”
Shutdown  now(立即)  –r(重启)  +3(3分钟后)  20:30&(定时关机)

S级 command line “man”
接触Linux最重要的东西就是man page, 学会迅速准确地从man page找出需要的命令,然后正确理解,那么在初学阶段基本是无敌了。

man –k,后面也可以加上grep用来精确定位
ex.
Create a directory
man –k directory | grep “create”

混混级command line “ls, rm”
–l           long listing of the files
–s          sorted by file size (largest to smallest file);
–r –s        sorted by file size (smallest to largest file);
–R          recursive listing of the files;
–d           within the directory and its subdirectories
–t           sorted by time of last modification, in chronological order.

rm –r filename
Delate the filename subdirectory and files

A级command line “ifconfig, route( add), traceroute, ping”
(勘查网络的极为重要的命令,ifconfig是设置网络interface的,route是管理routing table的)

显示interface所有状态 (displays status of all interfaces)
ifconfig -a

设置interface:
Ifconfig Ethernet inetnetmask<> broadcast<> up/down (activate/deactivate)
Ex.
Ifconfig eth0 inet 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255 up

添加route:
Route add –netnetmask<> gw(dev)

Ex.
Route add –net 192.168.50.0 netmask 255.255.255.0 gw 192.168.1.2 (dev eth0)

添加完route如果ping不通,还需以下命令(Make sure IP forwarding is enabled)
    echo 1 > /proc/sys/net/ipv4/ip_forward
*注意只有当所有机器都设置完之后才能ping通,因为有一方没设置好的话,响应无法回传

追踪route
traceroute

Ping命令
”ping -c” limits packet count

*************************************************************
Dial-Up/Broadband
ifconfiginetpointtopoint

Wireless
Use “iwconfig” command for setting wireless parameters
**************************************************************

General Network Interface and Routing Configuration Steps
1. Collect necessary information for your network/s, host IP addresses, network addresses, netmasks, broadcast addresses, gateway addresses, etc.
2. Configure and activate interfaces using “ifconfig”
3. Check status of configuration using “ifconfig”
4. Check local routes
5. Add any necessary remote routes using “route“
6. Add appropriate default route using “route”
7. Make sure IP forwarding is enabled
    # echo 1 > /proc/sys/net/ipv4/ip_forward
8. Check routing table using “route”
9. Check connectivity and routes using “ping” and “traceroute” respectively

    Share:
    Back to Blog