📄 linux指令参考.htm
字号:
target_path #将文件file.tgz解压到target_path目录下<BR>tar cfzv file.tgz
source_path #将文件source_path压缩为file.tgz<BR>tar c directory >
directory.tar #将目录directory打包成不压缩的directory.tar<BR>gzip
directory.tar #将覆盖原文件生成压缩的 directory.tar.gz<BR>gunzip
directory.tar.gz #覆盖原文件解压生成不压缩的 directory.tar。<BR>tar xf
directory.tar #可将不压缩的文件解包</P>
<P>----------------------------------------------------------------------
<BR>dmesg #显示kernle启动及驱动装载信息<BR>uname #显示操作系统的类型<BR>uname -R
#显示操作系统内核的version</P>
<P>----------------------------------------------------------------------
<BR>strings file 显示file文件中的ASCII字符内容</P>
<P>----------------------------------------------------------------------
<BR>rpm -ihv program.rpm #安装程序program并显示安装进程<BR>rpm2targz
program.rpm program.tgz #将rpm格式的文件转换成tarball格式</P>
<P>----------------------------------------------------------------------
<BR>su root #切换到超级用户<BR>sulogin /dev/tty4
#在tty4即alt+F4终端等待用户登陆或直接登陆开启一个shell<BR>chmod a+x file
#将file文件设置为可执行,脚本类文件一定要这样设置一个,否则得用bash file才能执行<BR>chmod 666
file #将文件file设置为可读写<BR>chown user /dir #将/dir目录设置为user所有</P>
<P>----------------------------------------------------------------------
<BR>mknod /dev/hda1 b 3 1
#创建块设备hda1,主设备号为3,从设备号为1,即master硬盘的的第一个分区<BR>mknod /dev/tty1 c
4 1 #创建字符设备tty1,主设备号为4,众设备号为1,即第一个tty终端</P>
<P>----------------------------------------------------------------------
<BR>touch /tmp/running #在/tmp下创建一个临时文件running,重新启动后消失</P>
<P>----------------------------------------------------------------------
<BR>sleep 9 #系统挂起9秒钟的时间</P>
<P>----------------------------------------------------------------------
<BR>lpd stop 或 cups stop #停止打印服务程序<BR>lpd start 或 cups start
#启动打印服务程序<BR>lpd restart 或 cups restart #重新启动打印服务程序<BR>lpr
file.txt #打印文件file.txt</P>
<P>----------------------------------------------------------------------
<BR>fdisk /dev/hda #就像执行了dos的fdisk一样<BR>cfdisk /dev/hda
#比fdisk界面稍为友好些<BR>mount -t ext2 /dev/hda1 /mnt #把/dev/hda1装载到
/mnt目录<BR>df #显示文件系统装载的相关信息 <BR>mount -t iso9660 /dev/cdrom
/mnt/cdrom #将光驱加载到/mnt/cdrom目录<BR>mount-t smb
//192.168.1.5/sharedir /mnt -o
username=tomlinux,password=tomlinux
#将windows的的共享目录加载到/mnt/smb目录,用户名及密码均为tomlinux<BR>mount -t nfs
192.168.1.1:/sharedir /mnt
#将nfs服务的共享目录sharedir加载到/mnt/nfs目录<BR>umount /mnt
#将/mnt目录卸载,/mnt目录必须处于空闲状态<BR>umount /dev/hda1
#将/dev/hda1设备卸载,设备必须处于空亲状态<BR>sync
#将cache中的内容与磁盘同步,在Linux中复制文件,一般要系统空闲才去写文件<BR>e2fsck /dev/hda1
#检查/dev/hda1是否有文件系统错误,提示修复方式<BR>e2fsck -p
/dev/hda1#检查/dev/hda1是否有错误,如果有则自动修复<BR>e2fsck -y
/dev/hda1#检查错误,所有提问均于yes方式执行<BR>e2fsck -c
/dev/hda1#检查磁盘是否有坏区<BR>mkfs /dev/hda1
#格式化/dev/hda1为ext2格式<BR>mkfs.minix /dev/hda1
#格式化/dev/hda1为minix格式文件系统<BR>mfks /dev/hda9
#格工化/dev/hda9为Linux swap格式<BR>swapon /dev/hda9
#将swap分区装载当作内存来用<BR>swapoff /dev/hda9 #将swap分区卸载</P>
<P>----------------------------------------------------------------------
<BR>lilo #运行lilo程序,程序自动查找/etc/lilo.conf并按该配置生效<BR>lilo -C
/root/lilo.conf #lilo程序按/root/lilo.conf配置生效<BR>grub #在Linux
shell状态下运行boot loader设置程序<BR>grub-install
#安装grub磁盘引导程序,成功后升级内核无须像lilo一样要重新启动系统,只需修改/etc/grub.conf即可实现新引导配置<BR>rdev
bzImage #显示kernel的根分区信息<BR>rdev bzImage /dev/hda1
#将kernel的根分区设置为/dev/hda1,这在没有lilo等引导程序的系统中非常重要.</P>
<P>----------------------------------------------------------------------
<BR>dd if=/dev/fd0 of=floppy.fd
#将软盘的内容复制成一个镜像,功能与旧石器时代常用的hd-copy相同<BR>dd if=/dev/zero
of=root.ram bs=1024,count=1024
#生成一个大小为1M的块设备,可以把它当作硬盘的一个分区来用<BR>mkfs root.ram
#将块设备格式化为ext2格式<BR>dd if=root.ram of=/dev/ram0
#将init.rd格式的root.ram的内容导入内存<BR>mount /dev/ram0 /mnt #ramdisk
/dev/ram0装载到/mnt 目录</P>
<P>----------------------------------------------------------------------
<BR>gcc hello.c #将hello.c编译成名为a.out二进制执行文件<BR>gcc hello.c -o
hello #将hello.c编译成名为hello的二进制执行文件<BR>gcc -static -o hello
hello.c #将hello.c编译成名为hello的二进制静态执行文件<BR>ldd program
#显示程序所使用了哪些库<BR>objcopy -S program
#将程序中的符号表及无用的调试信息去掉,可以小很多</P>
<P>----------------------------------------------------------------------
<BR>strace netscape
#跟踪程序netscape的执行,看调用的库,环境变量设置,配置文件,使用的设备,调用的其它应用程序等,在strace下,程序干了什么东东一目了然。<BR>ps
#显示当前系统进程信息<BR>ps –ef #显示系统所有进程信息<BR>kill -9 500
#将进程编号为500的程序干掉<BR>killall -9 netscape
#将所有名字为netscape的程序杀死,kill不是万能的,对僵死的程序则无效。<BR>top
#显示系统进程的活动情况,按占CPU资源百分比来分<BR>free #显示系统内存及swap使用情况<BR>time
program #在program程序结束后,将计算出program运行所使用的时间</P>
<P>----------------------------------------------------------------------
<BR>chroot . #将根目录切换至当前目录,调试新系统时使用<BR>chroot /tomlinux
#将根目录切换至/tomlinux目录<BR>chroot /tomlinux sbin/init
#将根目录切换至/tomlinux并执行sbin/init<BR>adduser id
#增加一个叫id的用户<BR>userdel id #增除叫id的用户<BR>userlist
#显示已登陆的用户列表<BR>passwd id #修改用户id的密码<BR>passwd -d root
#将root用户的密码删除<BR>chown id /work #指定/work目录为id用户所拥有</P>
<P>----------------------------------------------------------------------
<BR>ifconfig eth0 192.168.1.1 netmask 255.255.255.0
#设置网卡1的地址192.168.1.1,掩码为255.255.255.0,不写netmask参数则默认为255.255.255.0<BR>ifconfig
eth0:1 192.168.1.2 #捆绑网卡1的第二个地址为192.168.1.2<BR>ifconfig eth0:x
192.168.1.x #捆绑网卡1的第二个地址为192.168.1.x<BR>ifconfig down eth1
#关闭第二块网卡,使其停止工作<BR>hostname -F tomlinux.com
#将主机名设置为tomlinux.com<BR>route #显示当前路由设置情况<BR>route add default
gw 192.168.1.1 metric 1 #设置192.168.1.1为默认的路由<BR>route del
default #将默认的路由删除<BR>dhcp #启动dhcp服务<BR>dhclient
#启动dhcp终端并自动获取IP地址<BR>ping 163.com #测试与163.com的连接<BR>ping
202.96.128.68 #测试与IP 202。96.128.68的连接 </P>
<P>----------------------------------------------------------------------
<BR>probe rtl8139 #检查驱动程序rtl8139.o是否正常工作<BR>lsmod
#显示已装载的驱动程序<BR>insmod rtl8139.o #装载驱动程序rtl8139.o<BR>insmod
sb.o io=0x280 irq=7 dma=3 dma16=7 mpu_io=330
#装载驱动程序并设置相关的irq,dma参数<BR>rmmod rtl8139
#删除名为rtl8139的驱动模块<BR>gpm -k #停止字符状态下的mouse服务<BR>gpm -t ps2
#在字符状态下以ps2类型启动mouse的服务</P>
<P>----------------------------------------------------------------------
<BR>telnet 192.168.1.1 #登陆IP为192.168.1.1的telnet服务器<BR>telnet
iserver.com #登陆域名为iserver.com的telnet服务器<BR>ftp 192.168.1.1 或
ftp iserver.com #登陆到ftp服务 </P></TD>
<TD>
<DIV align=center></DIV></TD></TR></TBODY></TABLE>
<DIV align=right></DIV>
<TABLE border=0 cellPadding=0 cellSpacing=2 class=bfont><!--DWLayoutTable-->
<TBODY>
<TR>
<TD height=0 width=284></TD>
<TD width=290></TD>
<TD width=2></TD>
<TD width=3></TD>
<TD width=1></TD>
<TD width=4></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD bgColor=#eeeeee colSpan=4 vAlign=top>
<DIV align=left><B>相关产品</B> </DIV></TD></TR>
<TR>
<TD> </TD>
<TD><!--DWLayoutEmptyCell--> </TD>
<TD colSpan=2 vAlign=top><STRONG><A
href="http://www.hzlitai.com.cn/product/arm-ii.asp"><FONT
color=#660099>ARMSYS-II型嵌入式系统教学实验平台</FONT></A><IMG height=16
src="Linux指令参考.files/new.gif" width=33></STRONG></TD></TR>
<TR>
<TD width=30> </TD>
<TD width=22><!--DWLayoutEmptyCell--> </TD>
<TD colSpan=2 vAlign=top><A
href="http://www.hzlitai.com.cn/product/cheap.asp"><FONT
color=#660099><STRONG>ARMSYS经济型嵌入式系统开发板</STRONG></FONT></A><IMG
height=13 src="Linux指令参考.files/hot.gif" width=20></TD></TR>
<TR>
<TD> </TD>
<TD><!--DWLayoutEmptyCell--> </TD>
<TD colSpan=2 vAlign=top><A
href="http://www.hzlitai.com.cn/product/HOHUAARM.asp"><FONT
color=#660099><STRONG>ARMSYS豪华型嵌入式系统开发板</STRONG></FONT></A><IMG
height=13 src="Linux指令参考.files/hot.gif" width=20></TD></TR>
<TR>
<TD> </TD>
<TD><!--DWLayoutEmptyCell--> </TD>
<TD colSpan=2 vAlign=top><A
href="http://www.hzlitai.com.cn/product/armsys-b.asp"><FONT
color=#660099><STRONG>ARMsys超值型嵌入式系统开发板</STRONG></FONT></A><IMG
height=13 src="Linux指令参考.files/hot.gif" width=20> </TD></TR>
<TR>
<TD> </TD>
<TD><!--DWLayoutEmptyCell--> </TD>
<TD vAlign=top width=510><A
href="http://www.hzlitai.com.cn/download/linux/arm2000ii.asp"><FONT
color=#660099><STRONG>ARMsys-I型嵌入式系统教学实验平台</STRONG></FONT></A><STRONG><IMG
height=13 src="Linux指令参考.files/hot.gif" width=20></STRONG></TD>
<TD> </TD></TR></TBODY></TABLE></TD>
<TD></TD></TR>
<TR vAlign=top>
<TD height=2 vAlign=top>
<TD></TD>
<TD></TD>
<TD></TD>
<TD></TD></TR></TBODY></TABLE>
<HR align=center noShade SIZE=1 width=778>
<TABLE align=center border=0 cellPadding=0 cellSpacing=0 class=bfont width=644><!--DWLayoutTable-->
<TBODY>
<TR>
<TD height=35 vAlign=top width=105>
<DIV align=center>
<P align=center> </P></DIV></TD>
<TD vAlign=top width=105>
<DIV align=center><IMG height=30 src="Linux指令参考.files/tubao1.jpg"
width=30></DIV></TD>
<TD vAlign=top width=217>
<DIV align=center>版权所有<FONT
face=Verdana>©</FONT>杭州立宇泰电子有限公司<BR>Email:office@hzlitai.com.cn<BR></DIV></TD>
<TD vAlign=top width=217><!--DWLayoutEmptyCell--> </TD></TR>
<TR>
<TD colSpan=4 height=13> </TD></TR></TBODY></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -