linux常用commod_第1页
linux常用commod_第2页
linux常用commod_第3页
linux常用commod_第4页
linux常用commod_第5页
已阅读5页,还剩35页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Start To Play ,Open Your VM (Of Cause!),First Step is?,Then,Wait, if we already have a server,You can use different toolsPuttyVNC,Putty,Normally, we can use this tool,VNC,How about we already have the desktop, can we use that?,Example: VNC Viewer,Easy way ,Example: VNC Sever Configuration,But, before we can use this tool, we need to configure our server.,Installyuminstalltigervnc-serverStart and set password: vncserver:1 Configure: vim/etc/sysconfig/vncserversAdd a line VNCSERVERS=1:root“Restart the VNC serverservice vncserver restartIf we want the SVN server starts automaticallychkconfig vncserver on,Play With Linux ,cd, ls Were already mentioned,Navigate,Normally, we have to use command line,I dont want to re-type the same word,Try to use history:history!lineNumCtrl + R,What if my command typing is wrong ?,Command line editingIn this case, you need command line editingMovingCtrl-a Move cursor to the beginning of the line.Ctrl-e Move cursor to the end of the line.Ctrl-f Move cursor forward one character; same as the right arrow key.Ctrl-b Move cursor backward one character; same as the left arrow key.Alt-f Move cursor forward one word.Alt-b Move cursor backward one word.Ctrl-l Clear the screen and move the cursor to the top left corner. The clear command does the same thing.,Command line editingEditingCtrl-d Delete the character at the cursor locationCtrl-t Transpose(exchange)the character at the cursor location with the one preceding it.Alt-t Transpose the word at the cursor location with the one preceding it.Alt-l Convert the characters from the cursor location to the end of the word to lowercase.Alt-u Convert the characters from the cursor location to the end of the word to uppercase.,What if my command typing is wrong (Con.) ?,Command line editingCut And PasteCtrl-k Kill text from the cursor location to the end of line.Ctrl-u Kill text from the cursor location to the beginning of the line.Alt-d Kill text from the cursor location to the end of the current word.Alt-Backspace Kill text from the cursor location to the beginning of the word. If the cursor is at the beginning of a word, kill the previous word.Ctrl-y Paste the text at the cursor location.,What if my command typing is wrong (Con.) ?,Command: ls, cd sh startStore.sh, ./startStore.sh,Execute command / script,Normally, it is the easiest part,But, some exceptions are also exist ,Exceptions You May Meet,Env variables issueSet the required environment variablesFormat issuedos2unixCommand not foundInstall the required softwaresAccess rightsu, sudo, chown, chgrp, chmod,How To Install The Required Softwares (1),Almost all software for a Linux system can be found on the Internet. How will them be provided:Most of them are package filesRest of them are source code,How To Install The Required Softwares (2),Most distributions belong to one of two camps of packaging technologiesThe Debian “.deb” campDebian, Ubuntu, Xandros, LinspireThe Red Hat “.rpm” campFedora, CentOS, Red Hat Enterprise Linux, OpenSUSE, Mandriva, PCLinuxOS,How To Manage The Required Softwares On Debian,Through repository:apt-get install package_nameapt-get remove package_nameThrough package:dpkg -install package_fileapt-get remove package_name,How To Manage The Required Softwares On Red Hat,Through repository:yum install package_nameyum erase package_nameThrough package:rpm -i package_fileyum erase package_name,How To Install The Required Softwares From Source Code,Dowload: wgetftpUnpackedtar xzf diction-1.11.tar.gzBuild./configmake install,Got Errors ?,Check log: VI, cat, lessPipeSearch,Now, I can execute the scripts, but I got errors after I execute them,VI Introduction,Start - vi filenameQuit - :q! / wqCommand mode VS Input modeInitially, Command modeFrom Command mode to Input mode - Type “i”From Input mode to Command mode Type “Esc”,Move Cursor In VI,numberGTo line number. For example, 1G moves to the first line of the file.GTo the last line of the file.Ctrl-f or Page Down Down one page.Ctrl-b or Page Up Up one page.0 (zero)To the beginning of the current line$To the end of the current line.,Basic Editing In VI,aEnter Input mode and move cursor beyond the current location of cursor.A Enter Input mode and move cursor beyond the end of the line.oEnter Input mode and open a line below the current line.OEnter Input mode and pen a line above the current line.,Deleting In VI,ddDelete the current line. 5dd The current line and the next 4 lines.dG From the current line to the end of the file.d$ From the cursor position to the end of the current line.d0 From the cursor position to the beginning of the current line.uUndo,Cutting, Copying And Pasting In VI,dThe d command will be used as both delete and cut.p/PTo copy the text after/before the cursor.yyCopy the current line.5yyCopy the current line and the next 4 lines.ySCopy from the current cursor to the end of line.y0Copy from the current cursor to the begin of the line.yG Copy from the current cursor to the end of the file.JContact the lines below to the current line.,Finding And Replacing In VI,fFind character in one line. Type semicolon to repeat./Find in the whole file. Type “n” to repeat.:%s/Line/line/gReplace. % is a shortcut meaning from the first line to the last line. Alternately, the range could have been specified 1, 5.s Specifies the operation. In this case, substitution (search and replace)g means “global”, if omitted, only the first instance of the search string on each line is replaced,Common Search Methods,locateIt look up path in database. updatedb To update the database for locate.find Find files base on different conditions.,I/O Redirect,The result of commands: stdoutStatus and error messages: stderrThe default output is connect to screenThe inputs are from the standard input: stdinThe default input is connect to the keyboardI/O Redirect allows us to change the direction of outputs and inputs,STDOUT Redirect,Operator “”Examplesls -l /usr/bin ls-output.txt test.txt Empty the file or create a new file.echo “sh startStorefront.sh” startStore.sh3. Operator “” Append content instead of empty the content.,STDERR Redirect,A program can produce output on any of several numbered file streams. We have referred to the first three of these file streams as standard input, output and error, the shell references them internally as file descriptors zero, one and two, respectively.Examplels -l /bin/usr 2 ls-error.txtRedirect the second file stream which refers to the stderror to the file.,Get Together,ls -l /bin/usr ls-output.txt 2&1There are two redirect:Redirect output to ls-output.txtRedirect STDERR to STDOUTNewer way for this task: ls -l /bin/usr & ls-output.txtRedirect STDERR and STDOUT to the ls-output.txt through “&”,If we can output both STDOUT and STDERR into the same file,Exception,ls -l /bin/usr 2 /dev/null/dev/nullThis file is a system device called a bit bucket which accepts input and does nothing with it.,If we write a script, and the there are too many log which we want to ignore,STDIN Redirect,catcat movie.mpeg.0* movie.mpegConcact filescat lazy_dog.txtCreate new file through the STDIN“”cat lazy_dog.txtRead content from file and output to screen,Pipelines,Operator “|” The standard output of one command can be piped into the standard input of another.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论