现在的位置: 首页 > 综合 > 正文

linux基础命令

2017年08月24日 ⁄ 综合 ⁄ 共 2092字 ⁄ 字号 评论关闭

一 .man man

DESCRIPTION
man is the system's manual pager. Each page argument given to man is normally the name of a program,
utility or function. The manual page associated with each of these arguments is then found and dis‐
played. A section, if provided, will direct man to look only in that section of the manual. The default
action is to search in all of the available sections, following a pre-defined order and to show only the
first page found, even if page exists in several sections.

The table below shows the section numbers of the manual followed by the types of pages they contain.

1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conven‐
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]

A manual page consists of several sections.

man + 文档类型 + 被查询的命令

常用:

第一类 普通用户常用的命令;

第二类 系统调用;

第三类 库函数;

二、常用命令

2.1 查看内存信息

free -m
total used free shared buffers cached
Mem: 2013 845 1167 0 74 289
-/+ buffers/cache: 480 1532
Swap: 1905 0 1905

2.2 查看当前系统硬盘挂载情况

df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda7 50G 37G 11G 79% /
none 1003M 348K 1003M 1% /dev
none 1007M 884K 1006M 1% /dev/shm
none 1007M 228K 1007M 1% /var/run
none 1007M 0 1007M 0% /var/lock
none 1007M 0 1007M 0% /lib/init/rw

2.3 查看硬盘分区信息

fdisk -l

2.4 挂载分区

mount /dev/sda6 /mnt

unmout /mnt

2.5 查看文件或目录大小

du -h 1.txt
8.0K 1.txt

du -h --max-depth=1
42M ./busybox-1.17.3
8.0K ./test
626M

2.6 查找

find ./ -name usb.c -o -name usb.h
./arch/mips/include/asm/mach-pnx8550/usb.h
./arch/arm/plat-omap/usb.c
./arch/arm/plat-omap/include/mach/usb.h
./arch/arm/plat-mxc/include/mach/usb.h

2.7 查看当前所有进程

ps -aux

pstree

2.8 网络配置

vim /etc/network/interfaces

uto lo
iface lo inet loopback

#动态分配ip
#auto eth0
#iface eth0 inet dhcp

#静态分配ip
auto eth0
iface eth0 inet static
address 192.168.0.3
netmask 255.255.255.0
gateway 192.169.0.1

sudo /etc/init.d/networking restart
* Reconfiguring network interfaces... SIOCDELRT: No such process
Ignoring unknown interface wlan0=wlan0.
SIOCADDRT: No such process
Failed to bring up eth0.

检查网线是否连通
sudo mii-tool
eth0: negotiated 100baseTx-FD flow-control, link ok

检查路由配置

route -n
内核 IP 路由表
目标 网关 子网掩码 标志 跃点 引用 使用 接口
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 2 0 0 wlan0
.

【上篇】
【下篇】

抱歉!评论已关闭.