Linux insmod(英文全拼:install module)命令用于载入模块。
Linux有许多功能是通过模块的方式,在需要时才载入kernel。如此可使kernel较为精简,进而提高效率,以及保有较大的弹性。这类可载入的模块,通常是设备驱动程序。
insmod [-fkmpsvxX][-o <模块名称>][模块文件][符号名称 = 符号值]
参数说明:
加载模块
# insmod led.o //向内核加载模块
Linux rpm 命令用于管理套件。
rpm(英文全拼:redhat package manager) 原本是 Red Hat Linux 发行版专门用来管理 Linux 各项套件的程序,由于它遵循 GPL 规则且功能强大方便,因而广受欢迎。逐渐受到其他发行版的采用。RPM 套件管理方式的出现,让 Linux 易于安装,升级,间接提升了 Linux 的适用度。
rpm [-acdhilqRsv][-b<完成阶段><套间档>+][-e<套件挡>][-f<文件>+][-i<套件档>][-p<套件档>+][-U<套件档>][-vv][--addsign<套件档>+][--allfiles][--allmatches][--badreloc][--buildroot<根目录>][--changelog][--checksig<套件档>+][--clean][--dbpath<数据库目录>][--dump][--excludedocs][--excludepath<排除目录>][--force][--ftpproxy<主机名称或IP地址>][--ftpport<通信端口>][--help][--httpproxy<主机名称或IP地址>][--httpport<通信端口>][--ignorearch][--ignoreos][--ignoresize][--includedocs][--initdb][justdb][--nobulid][--nodeps][--nofiles][--nogpg][--nomd5][--nopgp][--noorder][--noscripts][--notriggers][--oldpackage][--percent][--pipe<执行指令>][--prefix<目的目录>][--provides][--queryformat<档头格式>][--querytags][--rcfile<配置档>][--rebulid<套件档>][--rebuliddb][--recompile<套件档>][--relocate<原目录>=<新目录>][--replacefiles][--replacepkgs][--requires][--resign<套件档>+][--rmsource][--rmsource<文件>][--root<根目录>][--scripts][--setperms][--setugids][--short-circuit][--sign][--target=<安装平台>+][--test][--timecheck<检查秒数>][--triggeredby<套件档>][--triggers][--verify][--version][--whatprovides<功能特性>][--whatrequires<功能特性>]
参数说明:
安装软件
# rpm -hvi dejagnu-1.4.2-10.noarch.rpm 警告:dejagnu-1.4.2-10.noarch.rpm: V3 DSA 签名:NOKEY, key ID db42a60e 准备... ########################################### [100%]
显示软件安装信息
# rpm -qi dejagnu-1.4.2-10.noarch.rpm 【第1次更新 教程、类似命令关联】
Linux grpconv(group convert to shadow password)命令用于开启群组的投影密码。
Linux系统里的用户和群组密码,分别存放在/etc目录下的passwd和group文件中。因系统运作所需,任何人都得以读取它们,造成安全上的破绽。投影密码将文件内的密码改存在/etc目录下的shadow和gshadow文件内,只允许系统管理者读取,同时把原密码置换为"x"字符。投影密码的功能可随时开启或关闭,您只需执行grpconv指令就能开启群组投影密码。
grpconv
Linux pwunconv命令用于关闭用户的投影密码。
执行pwunconv指令可以关闭用户投影密码,它会把密码从shadow文件内,重回存到passwd文件里。
pwunconv
关闭用户的投影密码
# pwunconv
Linux export 命令用于设置或显示环境变量。
在 shell 中执行程序时,shell 会提供一组环境变量。export 可新增,修改或删除环境变量,供后续执行的程序使用。export 的效力仅限于该次登陆操作。
export [-fnp][变量名称]=[变量设置值]
参数说明:
列出当前所有的环境变量
# export -p //列出当前的环境变量值 declare -x HOME=“/root“ declare -x LANG=“zh_CN.UTF-8“ declare -x LANGUAGE=“zh_CN:zh“ declare -x LESSCLOSE=“/usr/bin/lesspipe %s %s“ declare -x LESSOPEN=“| /usr/bin/lesspipe %s“ declare -x LOGNAME=“root“ declare -x LS_COLORS=““ declare -x MAIL=“/var/mail/root“ declare -x OLDPWD declare -x PATH=“/opt/toolchains/arm920t-eabi/bin:/opt/toolchains/arm920t-eabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games“ declare -x PWD=“/root“ declare -x SHELL=“/bin/bash“ declare -x SHLVL=“1“ declare -x SPEECHD_PORT=“6560“ declare -x SSH_CLIENT=“192.168.1.65 1674 22“ declare -x SSH_CONNECTION=“192.168.1.65 1674 192.168.1.3 22“ declare -x SSH_TTY=“/dev/pts/2“ declare -x TERM=“XTERM“ declare -x USER=“root“ declare -x XDG_SESSION_COOKIE=“93b5d3d03e032c0cf892a4474bebda9f-1273864738.954257-340206484“
定义环境变量
# export MYENV //定义环境变量 # export -p //列出当前的环境变量 declare -x HOME=“/root“ declare -x LANG=“zh_CN.UTF-8“ declare -x LANGUAGE=“zh_CN:zh“ declare -x LESSCLOSE=“/usr/bin/lesspipe %s %s“ declare -x LESSOPEN=“| /usr/bin/lesspipe %s“ declare -x LOGNAME=“root“ declare -x LS_COLORS=““ declare -x MAIL=“/var/mail/root“ declare -x MYENV declare -x OLDPWD declare -x PATH=“/opt/toolchains/arm920t-eabi/bin:/opt/toolchains/arm920t-eabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games“ declare -x PWD=“/root“ declare -x SHELL=“/bin/bash“ declare -x SHLVL=“1“ declare -x SPEECHD_PORT=“6560“ declare -x SSH_CLIENT=“192.168.1.65 1674 22“ declare -x SSH_CONNECTION=“192.168.1.65 1674 192.168.1.3 22“ declare -x SSH_TTY=“/dev/pts/2“ declare -x TERM=“XTERM“ declare -x USER=“root“ declare -x XDG_SESSION_COOKIE=“93b5d3d03e032c0cf892a4474bebda9f-1273864738.954257-340206484“
定义环境变量赋值
# export MYENV=7 //定义环境变量并赋值 # export -p declare -x HOME=“/root“ declare -x LANG=“zh_CN.UTF-8“ declare -x LANGUAGE=“zh_CN:zh“ declare -x LESSCLOSE=“/usr/bin/lesspipe %s %s“ declare -x LESSOPEN=“| /usr/bin/lesspipe %s“ declare -x LOGNAME=“root“ declare -x LS_COLORS=““ declare -x MAIL=“/var/mail/root“ declare -x MYENV=“7“ declare -x OLDPWD declare -x PATH=“/opt/toolchains/arm920t-eabi/bin:/opt/toolchains/arm920t-eabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games“ declare -x PWD=“/root“ declare -x SHELL=“/bin/bash“ declare -x SHLVL=“1“ declare -x SPEECHD_PORT=“6560“ declare -x SSH_CLIENT=“192.168.1.65 1674 22“ declare -x SSH_CONNECTION=“192.168.1.65 1674 192.168.1.3 22“ declare -x SSH_TTY=“/dev/pts/2“ declare -x TERM=“XTERM“ declare -x USER=“root“ declare -x XDG_SESSION_COOKIE=“93b5d3d03e032c0cf892a4474bebda9f-1273864738.954257-340206484“
Linux eval命令用于重新运算求出参数的内容。
eval可读取一连串的参数,然后再依参数本身的特性来执行。
eval [参数]
参数说明:参数不限数目,彼此之间用分号分开。
连接多个命令
# eval enable;ls //连接多个命令 enable . enable : enable [ enable alias enable bg enable bind enable break enable builtin enable caller enable cd enable command enable compgen enable complete enable compopt enable continue enable declare enable dirs enable disown enable echo enable enable enable eval enable exec enable exit enable export enable false enable fc enable fg enable getopts enable hash enable help enable history enable jobs enable kill enable let enable local enable logout enable mapfile enable popd enable printf enable pushd enable pwd enable read enable readarray enable readonly enable return enable set enable shift enable shopt enable source enable suspend enable test enable times enable trap enable true enable type enable typeset enable ulimit enable umask enable unalias enable unset enable wait
Linux enable命令用于启动或关闭 shell 内建指令。
若要执行的文件名称与shell内建指令相同,可用enable -n来关闭shell内建指令。若不加-n参数,enable可重新启动关闭的指令。
enable [-n][-all][内建指令]
参数说明:
显示shell内置命令
# enable //显示shell命令 enable . enable : enable [ enable alias enable bg enable bind enable break enable builtin enable caller enable cd enable command enable compgen enable complete enable compopt enable continue enable declare enable dirs enable disown enable echo enable enable enable eval enable exec enable exit enable export enable false enable fc enable fg enable getopts enable hash enable help enable history enable jobs enable kill enable let enable local enable logout enable mapfile enable popd enable printf enable pushd enable pwd enable read enable readarray enable readonly enable return enable set enable shift enable shopt enable source enable suspend enable test enable times enable trap enable true enable type enable typeset enable ulimit enable umask enable unalias enable unset enable wait
Linux dmesg(英文全称:display message)命令用于显示开机信息。
kernel 会将开机信息存储在 ring buffer 中。您若是开机时来不及查看信息,可利用 dmesg 来查看。开机信息亦保存在 /var/log 目录中,名称为 dmesg 的文件里。
dmesg [-cn][-s <缓冲区大小>]
参数说明:
显示开机信息
# dmesg |less WARNING: terminal is not fully functional [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Linux version 2.6.32-21-generic (buildd@rothera) (gcc version 4.4.3 (Ub untu 4.4.3-4ubuntu5) ) #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 (Ubuntu 2.6.32-21.3 2-generic 2.6.32.11+drm33.2) [ 0.000000] KERNEL supported cpus: [ 0.000000] Intel GenuineIntel [ 0.000000] AMD AuthenticAMD [ 0.000000] NSC Geode by NSC [ 0.000000] Cyrix CyrixInstead [ 0.000000] Centaur CentaurHauls [ 0.000000] Transmeta GenuineTMx86 [ 0.000000] Transmeta TransmetaCPU [ 0.000000] UMC UMC UMC UMC [ 0.000000] BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f800 (usable) [ 0.000000] BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved) [ 0.000000] BIOS-e820: 00000000000ca000 - 00000000000cc000 (reserved) [ 0.000000] BIOS-e820: 00000000000dc000 - 00000000000e0000 (reserved) [ 0.000000] BIOS-e820: 00000000000e4000 - 0000000000100000 (reserved) [ 0.000000] BIOS-e820: 0000000000100000 - 000000003fef0000 (usable) [ 0.000000] BIOS-e820: 000000003fef0000 - 000000003feff000 (ACPI data) [ 0.000000] BIOS-e820: 000000003feff000 - 000000003ff00000 (ACPI NVS) ……省略部分内容
显示开机信息
#pwd //查看当前所在目录 /home/hnlinux/ # dmesg > boot.msg //将开机信息保存到 boot.msg文件中 #ls //显示当前目录文件 boot.msg
Linux depmod命令用于分析可载入模块的相依性。
depmod(depend module)可检测模块的相依性,供modprobe在安装模块时使用。
depmod [-adeisvV][-m <文件>][--help][模块名称]
参数说明:
显示可用模块
# depmod -a //显示可用模块
Linux declare命令用于声明 shell 变量。
declare为shell指令,在第一种语法中可用来声明变量并设置变量的属性([rix]即为变量的属性),在第二种语法中可用来显示shell函数。若不加上任何参数,则会显示全部的shell变量与函数(与执行set指令的效果相同)。
declare [+/-][rxi][变量名称=设置值] 或 declare -f
参数说明:
声明整数型变量
# declare -i ab //声明整数型变量 # ab=56 //改变变量内容 # echo $ab //显示变量内容 56
改变变量属性
# declare -i ef //声明整数型变量 # ef=1 //变量赋值(整数值) # echo $ef //显示变量内容 1 # ef="wer" //变量赋值(文本值) # echo $ef 0 # declare +i ef //取消变量属性 # ef="wer" # echo $ef wer
设置变量只读
# declare -r ab //设置变量为只读 # ab=88 //改变变量内容 -bash: ab: 只读变量 # echo $ab //显示变量内容 56
声明数组变量
# declare -a cd='([0]="a" [1]="b" [2]="c")' //声明数组变量 # echo ${cd[1]} b //显示变量内容 # echo ${cd[@]} //显示整个数组变量内容 a b c
显示函数
# declare -f command_not_found_handle () { if [ -x /usr/lib/command-not-found ]; then /usr/bin/python /usr/lib/command-not-found -- $1; return $?; else if [ -x /usr/share/command-not-found ]; then /usr/bin/python /usr/share/command-not-found -- $1; return $?; else return 127; fi; fi }