Chinaunix首页 | 论坛 | 博客
  • 博客访问: 493313
  • 博文数量: 118
  • 博客积分: 5003
  • 博客等级: 大校
  • 技术积分: 1213
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-07 20:29
文章存档

2011年(8)

2010年(4)

2009年(12)

2008年(85)

2007年(9)

我的朋友

分类: LINUX

2007-05-07 20:36:36

1、当我们有一个文本文件需要进行修改,而该文本文件的权限是管理员:

sudo gedit source.list
这样就可以保存对该文件的修改了。

2、
Debian是最早的Linux发行版之一。它能引起公众注意就因为它让安装与卸载软件非常简单。在其他发行版还陷在依赖性的泥潭里时,Debian用户因为有更好的包管理系统而免受这些困扰。

所有基于Debian的发行都使用这个包管理系统。Deb包可以把一个应用的文件包在一起,大体就如同Windows上的安装文件。这里要介绍的就是如何使用安装包处理软件来达到我们的目的。

用apt -get的第一步就是引入必需的软件库,Debian的软件库也就是所有Debian软件包的集合,它们存在互联网上的一些公共站点上。把它们的地址加 入,apt-get就能搜索到我们想要的软件。/etc/apt/sources.list是存放这些地址列表的配置文件,其格式如下:
deb [web或ftp地址] [发行版名字][main/contrib/non-free]
比如Ubuntu是一个基于Debian的发行,它的Sources.list可以是这样的:
deb breezy main restrcted
你可以自己加上自己的地址。apt-get.org 上面有一些不错的地址列表。
我们安装完系统之后,将sources.list文件修改为:
deb dapper main restricted universe multiverse
deb-src dapper main restricted universe multiverse
deb dapper-updates main restricted universe multiverse
deb-src dapper-updates main restricted universe multiverse
deb dapper-backports main restricted universe multiverse
deb-src dapper-backports main restricted universe multiverse
deb dapper-security main restricted universe multiverse
deb-src dapper-security main restricted universe multiverse
deb dapper main multiverse restricted universe
这样可以基本上找到所有的网上给出的安装文件。
修改这个文件的时候需要使用下面的命令:
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

sudo gedit /etc/apt/sources.list
第一个是保存备份,第二条命令是以管理员的权限去打开sources.list以方便修改。
然后将上面的替换到文件中就可以了。保存退出,然后使用下面的命令,更新源即可。
sudo apt-get update


3、查看内核版本信息等的命令
查看版本信息:
uname -r
2.6.15-27-386
显示所有信息:包括机器名,机器内型,内核版本等。
uname --all
Linux tonylinux 2.6.15-27-386 #1 PREEMPT Sat Sep 16 01:51:59 UTC 2006 i686 GNU/Linux


4、当我们知道一个命令的名称,但是不知道其存放的地址的时候,可以使用which命令
ty@tonylinux:~$ which chmsee
/usr/bin/chmsee
我们就可以查找到该命令的位置,然后将气类型的文件就可以用其打开了。


5、查看pci总线上的所有设备!
可以使用命令:lspci
ty@tonylinux:/proc$ lspci
0000:00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
0000:00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03)
0000:00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 03)
0000:00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 03)
0000:00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 03)
0000:00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 03)
0000:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 83)
0000:00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 03)
0000:00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 03)
0000:00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 03)
0000:00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 03)
0000:00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 03)
0000:01:00.0 VGA compatible controller: ATI Technologies Inc RV350 [Mobility Radeon 9600 M10]
0000:02:04.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
0000:02:06.0 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller
0000:02:06.1 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller
0000:02:06.2 System peripheral: O2 Micro, Inc. OZ711Mx 4-in-1 MemoryCardBus Accelerator
0000:02:06.3 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller
0000:02:0e.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5705M_2 Gigabit Ethernet (rev 03)
还有一个命令:lspci-v,按照模块将硬件分开。
ty@tonylinux:~$ lspci -v
0000:00:00.0 Host bridge: Intel Corporation 82855PM Processor to I/O Controller (rev 03)
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, fast devsel, latency 0
        Memory at b0000000 (32-bit, prefetchable) [size=256M]
        Capabilities:

0000:00:01.0 PCI bridge: Intel Corporation 82855PM Processor to AGP Controller (rev 03) (prog-if 00 [Normal decode])
        Flags: bus master, 66MHz, fast devsel, latency 64
        Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
        I/O behind bridge: 00002000-00002fff
        Memory behind bridge: 90300000-903fffff
        Prefetchable memory behind bridge: 98000000-9fffffff

0000:00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 03) (prog-if 00 [UHCI])
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, medium devsel, latency 0, IRQ 10
        I/O ports at 38c0 [size=32]

0000:00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 03) (prog-if 00 [UHCI])
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, medium devsel, latency 0, IRQ 10
        I/O ports at 38e0 [size=32]

0000:00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 03) (prog-if 00 [UHCI])
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, medium devsel, latency 0, IRQ 10
        I/O ports at 3c00 [size=32]

0000:00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 03) (prog-if 20 [EHCI])
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, medium devsel, latency 0, IRQ 10
        Memory at a0000000 (32-bit, non-prefetchable) [size=1K]
        Capabilities:

0000:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 83) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=02, subordinate=05, sec-latency=32
        I/O behind bridge: 00004000-00005fff
        Memory behind bridge: 90000000-902fffff
        Prefetchable memory behind bridge: 50000000-56ffffff

0000:00:1f.0 ISA bridge: Intel Corporation 82801DBM (ICH4-M) LPC Interface Bridge (rev 03)
        Flags: bus master, medium devsel, latency 0

0000:00:1f.1 IDE interface: Intel Corporation 82801DBM (ICH4-M) IDE Controller (rev 03) (prog-if 8a [Master SecP PriP])
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, medium devsel, latency 0, IRQ 10
        I/O ports at
        I/O ports at
        I/O ports at
        I/O ports at
        I/O ports at 3c20 [size=16]
        Memory at 57000000 (32-bit, non-prefetchable) [size=1K]

0000:00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 03)
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: medium devsel
        I/O ports at 1200 [size=32]

0000:00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 03)
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, medium devsel, latency 0, IRQ 11
        I/O ports at 3000 [size=256]
        I/O ports at 3880 [size=64]
        Memory at a0100000 (32-bit, non-prefetchable) [size=512]
        Memory at a0180000 (32-bit, non-prefetchable) [size=256]
        Capabilities:

0000:00:1f.6 Modem: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller (rev 03) (prog-if 00 [Generic])
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: medium devsel, IRQ 11
        I/O ports at 3400 [size=256]
        I/O ports at 3800 [size=128]
        Capabilities:

0000:01:00.0 VGA compatible controller: ATI Technologies Inc RV350 [Mobility Radeon 9600 M10] (prog-if 00 [VGA])
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 10
        Memory at 98000000 (32-bit, prefetchable) [size=128M]
        I/O ports at 2000 [size=256]
        Memory at 90300000 (32-bit, non-prefetchable) [size=64K]
        Expansion ROM at 90320000 [disabled] [size=128K]
        Capabilities:

0000:02:04.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)
        Subsystem: Compaq Computer Corporation: Unknown device 00e5
        Flags: bus master, medium devsel, latency 168, IRQ 11
        Memory at 90080000 (32-bit, non-prefetchable) [size=64K]
        Capabilities:

0000:02:06.0 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, stepping, slow devsel, latency 168, IRQ 10
        Memory at 90100000 (32-bit, non-prefetchable) [size=4K]
        Bus: primary=02, secondary=03, subordinate=04, sec-latency=176
        Memory window 0: 50000000-51fff000 (prefetchable)
        Memory window 1: 58000000-59fff000
        I/O window 0: 00004000-000040ff
        I/O window 1: 00004400-000044ff
        16-bit legacy interface ports at 0001

0000:02:06.1 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, stepping, slow devsel, latency 168, IRQ 10
        Memory at 90180000 (32-bit, non-prefetchable) [size=4K]
        Bus: primary=02, secondary=05, subordinate=08, sec-latency=176
        Memory window 0: 52000000-53fff000 (prefetchable)
        Memory window 1: 5a000000-5bfff000
        I/O window 0: 00004800-000048ff
        I/O window 1: 00004c00-00004cff
        16-bit legacy interface ports at 0001

0000:02:06.2 System peripheral: O2 Micro, Inc. OZ711Mx 4-in-1 MemoryCardBus Accelerator
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: slow devsel, IRQ 10
        Memory at 90200000 (32-bit, non-prefetchable) [size=4K]
        Capabilities:

0000:02:06.3 CardBus bridge: O2 Micro, Inc. OZ711M3/MC3 4-in-1 MemoryCardBus Controller
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, stepping, slow devsel, latency 168, IRQ 10
        Memory at 90280000 (32-bit, non-prefetchable) [size=4K]
        Bus: primary=02, secondary=09, subordinate=0c, sec-latency=176
        Memory window 0: 54000000-55fff000 (prefetchable)
        Memory window 1: 5c000000-5dfff000
        I/O window 0: 00005000-000050ff
        I/O window 1: 00005400-000054ff
        16-bit legacy interface ports at 0001

0000:02:0e.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5705M_2 Gigabit Ethernet (rev 03)
        Subsystem: Hewlett-Packard Company nc6000 laptop
        Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 11
        Memory at 90000000 (64-bit, non-prefetchable) [size=64K]
        Expansion ROM at 56000000 [disabled] [size=64K]
        Capabilities:

这样可以看到大部分的硬件信息。

6、查看系统中使用的字体,使用的字体很大程度上会影响程序的执行
xlsfonts

7、debian操作系统的字体安装软件:
defoma:defoma是Debian Font Manager 的简称,


8、目录拷贝:
mkdir linux-2.6.16
cp -r /home/ty/kernel/linux-2.6.16/ linux-2.6.16/


9、非空目录强制删除
rm -rf linux-2.6.16/
加上f选项之后,在每删除一个的时候就将不进行提示了。

10、将终端切换到root权限模式下:
有两种办法:办法1
sudo -s
办法2:
fakeroot
办法二要安装fakeroot

11、有一个很简单的办法将系统变成英文系统:
修改/etc/environment:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/home/ty/software/taglib/bin:/home/ty/software/audacious/bin:/home/ty/software/audacious-plugin/bin:/home/ty/software/audacious-plugin-ugly/bin"
#export GST_ID3_TAG_ENCODING=GBK:UTF-8:GB2312
#export GST_ID3V2_TAG_ENCODING=GBK:UTF-8:GB2312
GST_ID3_TAG_ENCODING=gbk
GST_ID3V2_TAG_ENCODING=gbk
LANG="en_US.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
将LANGUAGE的设置取消掉,这样系统默认启动之后进入UTF-8的状态,就是英文状态。


12、如何查看系统的环境变量的值:小方法,echo
ty@tonylinux:~/tools/02_micro_card_reader/OZSCR_2.0.3_Kern_2.6$ echo $LANG
en_US.UTF-8
注意使用的是美元符号而不是地址符号。
查看系统的所有的环境变量使用的命令是:env
ty@tonylinux:/disk_ty$ env
SSH_AGENT_PID=19229
TERM=xterm
DESKTOP_STARTUP_ID=
SHELL=/bin/bash
GST_ID3V2_TAG_ENCODING=GB2312
GTK_RC_FILES=/etc/gtk/gtkrc:/home/ty/.gtkrc-1.2-gnome2
WINDOWID=54526028
OLDPWD=/home/ty
USER=ty
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:
LIBGL_DRIVERS_PATH=/usr/lib/dri
GNOME_KEYRING_SOCKET=/tmp/keyring-opAmF1/socket
SSH_AUTH_SOCK=/tmp/ssh-eQaDO19180/agent.19180
SESSION_MANAGER=local/tonylinux:/tmp/.ICE-unix/19180
USERNAME=ty
DESKTOP_SESSION=gnome
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/home/ty/software/taglib/bin:/home/ty/software/audacious/bin:/home/ty/software/audacious-plugin/bin:/home/ty/software/audacious-plugin-ugly/bin
QT_IM_MODULE=scim
GDM_XSERVER_LOCATION=local
PWD=/disk_ty
XMODIFIERS=@im=SCIM
LANG=en_US.UTF-8
GDMSESSION=gnome
HISTCONTROL=ignoredups
HOME=/home/ty
SHLVL=1
LANGUAGE=zh_CN:zh:en_US:en
GNOME_DESKTOP_SESSION_ID=Default
LOGNAME=ty
GST_ID3_TAG_ENCODING=GB2312
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YUZ89TAwJl,guid=bb338a45033a6acd863f6f312f7c5200
LESSOPEN=| /usr/bin/lesspipe %s
DISPLAY=:0.0
GTK_IM_MODULE=scim
LESSCLOSE=/usr/bin/lesspipe %s %s
COLORTERM=gnome-terminal
XAUTHORITY=/tmp/.gdmlBXzYK
_=/usr/bin/env




13、如何运行linux下的.bin文件?
方法其实很简单的:对文件加入执行权限:
chmod +x a.bin
然后执行./a.bin


14、当你使用apt-get命令安装各个软件时,系统会自动将软件的安装包放在/var/cache/apt/archives/和
/var/cache/apt/archives/partial目录下,可以清除这两个目录下的文件,清空空间。


15、有些命令使用普通帐户运行的话,没有任何的输出,也不会提示错误,
但是以管理员的身份来运行的话,就是ok的。
ty@tonylinux:~$ sudo fdisk -l

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        1912    15358108+   c  W95 FAT32 (LBA)
Partition 1 does not end on cylinder boundary.
/dev/hda2            1913        9729    62790052+   f  W95 Ext'd (LBA)
/dev/hda5            1913        2422     4093708+  83  Linux
/dev/hda6            2422        3505     8701528+  83  Linux
/dev/hda7            3505        3824     2562808+  82  Linux swap / Solaris
/dev/hda8            3825        6374    20480008+   7  HPFS/NTFS
/dev/hda9            6374        9729    26951368+   7  HPFS/NTFS
ty@tonylinux:~$ fdisk -l
ty@tonylinux:~$

15、创建文件touch
touch ttt;创建文件ttt

16、检查firefox安装了那些插件的方法:
有时候我们安装了很多插件,但是不知道是否安装成功,可以在firefox的地址里输入:about:plugins

17、linux下4个工作区切换的快捷键:
ctrl+alt+箭头

18、如何修改网卡的硬件地址:
首先切换到管理员用户,sudo -s
然后停止想要修改硬件地址的网卡:ifconfig eth down
然后修改硬件地址:ifconfig eth0 hw ether 00:0f:fe:af:56:ec
最后将网卡激活:ifconfig eth0 up
用dhcp协议获得ip地址:dhclient eth0


19、如何查看系统支持的文件系统:
cat /proc/filesystem

ty@tonylinux:/sys$ cat /proc/filesystems
nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc
nodev   sockfs
nodev   securityfs
nodev   pipefs
nodev   futexfs
nodev   tmpfs
nodev   inotifyfs
nodev   eventpollfs
nodev   devpts
        cramfs
nodev   ramfs
nodev   mqueue
nodev   usbfs
        ext3
        vfat
        ntfs
nodev   rpc_pipefs
nodev   nfsd

20、如何查看系统的启动参数?
这种启动参数的修改可以让我们不用重新编译内核来完成从多种途径来启动系统的目的。
cat /proc/cmdline
root@tonylinux:/proc# cat cmdline
root=/dev/hda5 ro quiet splash
阅读(1407) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~