shell&vi

Shell

系统设置:

<!--[if !supportLists]-->1.   <!--[endif]-->tty                     显示当前的终端号

<!--[if !supportLists]-->2.   <!--[endif]-->stty                        显示和设置终端参数

stty –a                    附加显示参数

stty [command] ‘[key]’设置键值

<!--[if !supportLists]-->3.   <!--[endif]-->date                        显示日期

date –u MMddhhmm       修改时间到MMddhhmm

<!--[if !supportLists]-->4.   <!--[endif]-->time                        显示时间

<!--[if !supportLists]-->5.   <!--[endif]-->cal                     显示日历

cal [month] [year]      显示XX月日历,参数只有1个数字默认为年份

<!--[if !supportLists]-->6.   <!--[endif]-->who                     按字母顺序列出当前注册到计算机上的用户

who am i                    打印当前用户的信息

who –T                 附加显示用户终端状态

who –r                 显示系统的运行级

<!--[if !supportLists]-->7.   <!--[endif]-->w                       显示目前在线用户以及这些用户当前工作

<!--[if !supportLists]-->8.   <!--[endif]-->cu                      连接另一台unix主机

cu –s [speed] [num]        按照传输速度连接另一台unix主机

cu –l [port]           按照制定得通讯线路连接另一台unix主机

<!--[if !supportLists]-->9.   <!--[endif]-->finger                  显示用户信息

finger –T              (与who类似)

<!--[if !supportLists]-->10.  <!--[endif]-->news                        显示/usr/news目录中文件找到的系统新闻

news –a                    显示所有项

news –n                    只显示你没有看到的当前文件的名字

<!--[if !supportLists]-->11.  <!--[endif]-->man [title]             查看联机手册

man [–M path] [[section]title]    

path为所需手册数据库的路径,section为一个数字表示的手册分类,1代表可执行命令,2代表系统呼叫,3代表标准函数等等

man –k [keyword]       用来将含有keywordtitle列出来

<!--[if !supportLists]-->12.  <!--[endif]-->clear                   清楚终端屏幕

<!--[if !supportLists]-->13.  <!--[endif]-->lock                        给终端加锁

lock [-time]                给终端加锁多长时间

<!--[if !supportLists]-->14.  <!--[endif]-->passwd                  修改当前用户口令

<!--[if !supportLists]-->15.  <!--[endif]-->write [username]            向其他用户发送消息,不允许应答,*return结束

<!--[if !supportLists]-->16.  <!--[endif]-->hello [username]            unix系统普通用户使用与write相同,超级用户输入的内

容立即出现在对方屏幕上

<!--[if !supportLists]-->17.  <!--[endif]-->mesg [-y/-n]                控制终端是否可写

<!--[if !supportLists]-->18.  <!--[endif]-->mail [username]         发送,阅读电子邮件,quitexit退出

<!--[if !supportLists]-->19.  <!--[endif]-->wall                        发送消息到系统所有用户

<!--[if !supportLists]-->20.  <!--[endif]-->rwall                   发送消息到网络中所有用户

rwall –n [netgroup]        发送消息到netgroup中的所有用户

<!--[if !supportLists]-->21.  <!--[endif]-->su – [user]                切换到user用户

文件目录

<!--[if !supportLists]-->1.   <!--[endif]-->file    [name]              检查文件或目录并报告它的类型

<!--[if !supportLists]-->2.   <!--[endif]-->find [path] [-list] [file]     

path目录下按照list对应得file内容查找文件

<!--[if !supportLists]-->3.   <!--[endif]-->cd                      进入目录

cd ../[dir]             进入上级目录下的dir目录

cd ~                        进入当前用户主目录

cd -                        回到最后一次进入的目录

<!--[if !supportLists]-->4.   <!--[endif]-->pwd                     显示当前路径

<!--[if !supportLists]-->5.   <!--[endif]-->ls                      列出目录内容

ls –a                  列出的内容包括隐藏文件

ls –R                  递归地列出每个子目录的内容

ls –F                  按列列出文件

ls –l                  显示文件,目录详细信息

ls –C                  输出时多列显示

<!--[if !supportLists]-->6.   <!--[endif]-->cat [filename]          filename文件的内容输出到屏幕

cat –n [filename]      给显示内容加上行号

<!--[if !supportLists]-->7.   <!--[endif]-->cp                      拷贝

cp [f1] [f2]                f1的内容拷贝到f2

cp [f1] [f2] [f3]…[dir]f1f2f3按相同文件名复制到dir目录中

cp –i [f1] [f2]            询问使用者是否覆盖

cp –r [dir1] [dir2]        dir1的内容全部复制到dir2

<!--[if !supportLists]-->8.   <!--[endif]-->mv                      文件改名或移动

mv [f1] [f2]                将文件f1改名为f2

mv [dir1] [dir2]            将文件夹dir1改名为dir2

mv [f1] [f2] [f3]…[dir]将文件f1f2f3移动到dir目录中

mv –i [f1] [f2]            询问使用者是否覆盖

mv –f [f1] [f2]            强迫移动,不提出警告信息

<!--[if !supportLists]-->9.   <!--[endif]-->rm [f1] [f2] [f3]…     删除指定文件

rm –f [f1]             删除时不提出警告信息

rm –i [f1]             询问是否删除

rm –r [dir]                递回式删除

<!--[if !supportLists]-->10.  <!--[endif]-->mkdir [dir1] [dir2]     创建文件目录

<!--[if !supportLists]-->11.  <!--[endif]-->chdir [dirname]         将当前目录移动到dirname

<!--[if !supportLists]-->12.  <!--[endif]-->rmdir [dir1] dir2]      删除空目录

<!--[if !supportLists]-->13.  <!--[endif]-->chmod [mode] [filename] 修改文件权限mode第一位为文件所有者权限,第二位为文

件组权限,第三位为一般用户权限

chmod –f [mode]            不理会失败动作

chmod –r [mode]            将所有子目录下所有档案改为mode模式

<!--[if !supportLists]-->14.  <!--[endif]-->tar                     存储和恢复文件

tar cvf [pack] [f1] [f2]f1f2的内容存储到pack文件中

    tar xvf [pack]          pack文件中的内容还原

处理指令

<!--[if !supportLists]-->1.   <!--[endif]-->bc                      运算器

bc –l                  可获取数学函数库

<!--[if !supportLists]-->2.   <!--[endif]-->banner [string]         打印字符

<!--[if !supportLists]-->3.   <!--[endif]-->ps                      显示目前进程或系统进程的状况

ps –e                  输出所有进程报告

ps –l                  显示一个长的输出报告,只是不包含STIME字段

ps –f                  在第一栏进程显示所有者的名字(不是UID

ps –a                  用来显示包括其他用户的进程情况

ps –u                  显示面向用户的进程

ps –x                  显示包括没有终端控制的进程

ps –w                  使用较宽的显示模式来显示进程状况

<!--[if !supportLists]-->4.   <!--[endif]-->kill                        杀进程

<!--[if !supportLists]-->5.   <!--[endif]-->kill [-signal] pid      signal给进程,signal值为031,其中9sigkill

用来杀掉一些无法正常结束的讯号

    kill –l                    查看可替代signal号码的数目字

<!--[if !supportLists]-->6.   <!--[endif]-->grep    [string] f1 f2      过滤器

grep –n [string] file  把所找到的行在行前加上行号列出

grep –v [string] file  把不包含string的行列出

<!--[if !supportLists]-->7.   <!--[endif]-->fgrep [string] –f f1 f2过滤器,在file1中存放要搜寻的字串

网络指令

<!--[if !supportLists]-->1.   <!--[endif]-->rlogin host [-l name]   远程登陆,host为主机名或ip,默认用户为本机当前用户;

若远程登陆用户与当前用户不同,用-l制定远程登陆用户

<!--[if !supportLists]-->2.   <!--[endif]-->rsh                     在远程机器上执行命令,结果传回本机器

rsh host [-l name] [com]不输入com则相当于rlogin

<!--[if !supportLists]-->3.   <!--[endif]-->telnet [name/ip] [port] 远程登陆   

<!--[if !supportLists]-->4.   <!--[endif]-->ftp [ip]                    文件传输

 

数据操作

<!--[if !supportLists]-->1.   <!--[endif]-->echo                        回显用户系统参数

echo –n                    显示完之后无跳行动作

<!--[if !supportLists]-->2.   <!--[endif]-->head                        将标准输入中的前10行(默认)内容输出到屏幕上

head –n [num] [file]   file文件中的前num行输出到屏幕上

head [-num] [file]      file文件中的前num行输出到屏幕上

<!--[if !supportLists]-->3.   <!--[endif]-->tail                        将标准输入中的后10行内容输出到屏幕上,参数同head

<!--[if !supportLists]-->4.   <!--[endif]-->more [filename]         分屏将filename文件的内容输出到屏幕,按q退出

more –n [filename]     给显示内容加上行号

<!--[if !supportLists]-->5.   <!--[endif]-->pg                      显示文件并按屏幕读取

pg [-number]                指定每个窗口显示的行数

pg [-p] [string]            将字符串的内容输出到屏幕上

<!--[if !supportLists]-->6.   <!--[endif]-->pr                      给文件分页

<!--[if !supportLists]-->7.   <!--[endif]-->awk                     在输入航上扫描模式并执行动作

<!--[if !supportLists]-->8.   <!--[endif]-->sed                     非交互式编辑文件

<!--[if !supportLists]-->9.   <!--[endif]-->sort                        按字母顺序排列并合并文件

<!--[if !supportLists]-->10.  <!--[endif]-->split                   将文件分为等长的部分

<!--[if !supportLists]-->11.  <!--[endif]-->tee                     将标准输入通过管道传到标准输出和指定文件中

<!--[if !supportLists]-->12.  <!--[endif]-->uniq                        打印每个输入行

<!--[if !supportLists]-->13.  <!--[endif]-->lp+

 

VI

<!--[if !supportLists]-->1.   <!--[endif]-->~                       大小写转换

<!--[if !supportLists]-->2.   <!--[endif]-->0                       到当前行行首

<!--[if !supportLists]-->3.   <!--[endif]-->$                       到当前行末尾

<!--[if !supportLists]-->4.   <!--[endif]-->a                       在光标所在位置后插入文本

<!--[if !supportLists]-->5.   <!--[endif]-->A                       在光标所在位置行的最后字符后加入文本

<!--[if !supportLists]-->6.   <!--[endif]-->w                       移动到下一个单词

<!--[if !supportLists]-->7.   <!--[endif]-->W                       将除空格外的所有字符看作一个字

<!--[if !supportLists]-->8.   <!--[endif]-->b                       移动到上一个单词

<!--[if !supportLists]-->9.   <!--[endif]-->i                       在光标所在位置前插入文本

<!--[if !supportLists]-->10.  <!--[endif]-->I                       在光标所在位置行的第一个字符前插入文本

<!--[if !supportLists]-->11.  <!--[endif]-->o                       在光标所在位置下一行插入文本

<!--[if !supportLists]-->12.  <!--[endif]-->O                       在光标所在位置上一航插入文本

<!--[if !supportLists]-->13.  <!--[endif]-->C                       删除光标到当前行末尾的内容并进入编辑状态

<!--[if !supportLists]-->14.  <!--[endif]-->cc                      删除光标所在行字符并进入文本编辑状态

<!--[if !supportLists]-->15.  <!--[endif]-->cw                      删除光标所在单词并进入文本编辑状态

<!--[if !supportLists]-->16.  <!--[endif]-->r                       新文本替代旧文本,一一替代

<!--[if !supportLists]-->17.  <!--[endif]-->R                       新文本替代旧文本,直到退出文本编辑状态

<!--[if !supportLists]-->18.  <!--[endif]-->x                       删除光标所在字符

<!--[if !supportLists]-->19.  <!--[endif]-->[n]x                        剪切n个字符

<!--[if !supportLists]-->20.  <!--[endif]-->dd                      删除光标所在行字符

<!--[if !supportLists]-->21.  <!--[endif]-->dw                      删除光标所在单词

<!--[if !supportLists]-->22.  <!--[endif]-->[n]yy                   复制光标所在行以下n

<!--[if !supportLists]-->23.  <!--[endif]-->yw                      复制光标所在单词

<!--[if !supportLists]-->24.  <!--[endif]-->D                       删除光标到当前行末尾的内容

<!--[if !supportLists]-->25.  <!--[endif]-->s                       删除光标所在字符并进入文本编辑状态

<!--[if !supportLists]-->26.  <!--[endif]-->[n]s                    替换n个字符

<!--[if !supportLists]-->27.  <!--[endif]-->S                       删除光标所在行字符并进入文本编辑状态

<!--[if !supportLists]-->28.  <!--[endif]-->G                       到文件末尾

<!--[if !supportLists]-->29.  <!--[endif]-->h                       左移光标

<!--[if !supportLists]-->30.  <!--[endif]-->j                       下移光标

<!--[if !supportLists]-->31.  <!--[endif]-->k                       上移光标

<!--[if !supportLists]-->32.  <!--[endif]-->l                       右移光标

<!--[if !supportLists]-->33.  <!--[endif]-->Ctrl+f                  向下滚动一屏

<!--[if !supportLists]-->34.  <!--[endif]-->Ctrl+b                  向上滚动一屏

<!--[if !supportLists]-->35.  <!--[endif]-->Ctrl+d                  向下滚动半屏

<!--[if !supportLists]-->36.  <!--[endif]-->Ctrl+u                  向上滚动半屏

<!--[if !supportLists]-->37.  <!--[endif]-->Ctrl+g                  显示当前文件名称,总行树,所在行数

<!--[if !supportLists]-->38.  <!--[endif]-->:set nu                 显示行号

<!--[if !supportLists]-->39.  <!--[endif]-->:set nonu               隐藏行号

<!--[if !supportLists]-->40.  <!--[endif]-->:[n]                        移动到文件的第n

<!--[if !supportLists]-->41.  <!--[endif]-->:g/[str1]/s//[str2]/g   将文件中的所有str1替换成str2

<!--[if !supportLists]-->42.  <!--[endif]-->mk                      块拷贝,定义块首

“ay’k                 块拷贝,定义块尾,根据寄存器不同可存贮多个块

“ap                        块粘贴

<!--[if !supportLists]-->43.  <!--[endif]-->mk                      块剪切,定义块首

“ad’k                 块剪切,定义块尾

<!--[if !supportLists]-->44.  <!--[endif]-->:w                      保存

<!--[if !supportLists]-->45.  <!--[endif]-->:e                      刷新

<!--[if !supportLists]-->46.  <!--[endif]-->:q                      退出

<!--[if !supportLists]-->47.  <!--[endif]-->Ctrl+z                  不存盘退出

<!--[if !supportLists]-->48.  <!--[endif]-->:e [filename]           编辑另一个文件

:e#                 返回前一文件

<!--[if !supportLists]-->49.  <!--[endif]-->[n]>                        标所在行以下n行右移一个制表符位置

<!--[if !supportLists]-->50.  <!--[endif]-->[n]<                        标所在行以下n行左移一个制表符位置

<!--[if !supportLists]-->51.  <!--[endif]-->%                       查找对应的括号

<!--[if !supportLists]-->52.  <!--[endif]-->{{

<!--[if !supportLists]-->53.  <!--[endif]-->}}

<!--[if !supportLists]-->54.  <!--[endif]-->.

猜你喜欢

转载自muma521biz-yeah-net.iteye.com/blog/1135373
vi
今日推荐