linux基础命令

本文档介绍了Linux系统中常用命令的快速查询方法,包括查看内存信息、硬盘挂载情况、分区信息等操作,并提供了网络配置的具体步骤。对于初学者及日常运维人员来说,这些命令非常实用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一 .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
.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值