Linux 命令 解析 大全.ppt_第1页
Linux 命令 解析 大全.ppt_第2页
Linux 命令 解析 大全.ppt_第3页
Linux 命令 解析 大全.ppt_第4页
Linux 命令 解析 大全.ppt_第5页
已阅读5页,还剩27页未读 继续免费阅读

下载本文档

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

文档简介

1、Linux Basic Knowledgeand command usage,Presenter: Juan Xu Company: WebEx China (Hefei),Whats Linux cd; cd oracle; pwd: Show current/working directory rm: Remove files or directories -f force delete file without prompt -I prompt befor any removel -r or R remove the contents of directories recursively

2、 - remove a file whose name starts with a -,ls cd pwd rm mv cp chmod chown df du top netstat route ping traceroute pstree pgrep/pkill ps kill date ln find locate env echo gdb mkdir cat more less tail touch,mv - move (rename) files cp - copy files and directories -R copy directories recursively chmod

3、 - change file access permissions file type: d directory l link s socket file b block file c char file p pipe file - genereal file dont belong to above files permission: OWNER GROUP OTHERS r read w write/change x/execute Change file access permissions have two modes: character mode: chmod +x file ab

4、solute mode: chmod 777 file r(4)w(2)x(1),ls cd pwd rm mv cp chmod chown df du top netstat route ping traceroute pstree pgrep/pkill ps kill date ln find locate env echo gdb mkdir cat more less tail touch,chown - change file owner and group chown R owner:owner file df - report filesystem disk space us

5、age -k, -kilobytes -i, -inodes -h, -human-readable du - estimate file space usage -a, -all -ls, -display only a total for each argument top - display top CPU processes space Update display N Sort by pid (Numerically) P Sort by CPU usage M Sort by resident memory usage T Sort by time / cumulative tim

6、e u (nobody) Show only a specific user n Set the number of process to show,ls cd pwd rm mv cp chmod chown df du top netstat route ping traceroute pstree pgrep/pkill ps kill date ln find locate env echo gdb mkdir cat more less tail touch,netstat -Print network connections, routing tables netstat rn =

7、route netstat -an route - show / manipulate the IP routing table route add -net netmask gw route add default gw and delete/del usuage just like add ping - send ICMP ECHO_REQUEST packets to network hosts traceroute - print the route packets take to ne

8、twork host pstree - display a tree of processes pgrep/pkill - look up or signal processes based on name and other attributes pgrep fl http pkill http ps - report process status ps eaf |grep http,ls cd pwd rm mv cp chmod chown df du top netstat route ping traceroute pstree pgrep/pkill ps kill date ln

9、 find locate env echo gdb mkdir cat more less tail touch,kill - terminate a process kill 9 processid date - print or set the system date and time date MMDDhhmm Systimezone change: cp /usr/share/zoneinfo/GMT /etc/localtime ln - make links between files ln s TARGET LINK_NAME find - search for files in

10、 a directory hierarchy find directory name filename locate - Enhanced version quickly search for files on your system env -show environment variable echo show variable contents gdb - The Debugger tool more - check file contents,ls cd pwd rm mv cp chmod chown df du top netstat route ping traceroute p

11、stree pgrep/pkill ps kill date ln find locate env echo gdb mkdir cat more less tail touch,mkdir mkdir - make directories -m, -mode=MODE set permission mode (as in chmod), not rwxrwxrwx umask -p, -parents no error if existing, make parent directories as needed cat cat - concatenate files and print on

12、 the standard output more more - file perusal filter for crt viewing less less - opposite of more touch touch - change file timestamps,VI command usage,VI is a text editor. It can be used to edit any ASCII text. It is especially useful for editing programs. Para. i - insert character to file Para. o

13、 - add a new next line Para. a - append character Para r - replace the character Para u - cancel action Para D - delete from last to cusor location Para 0 - return to the line first character Combination command: para tx move to next beginner character dw delete words db delete words to back ce chan

14、ge words and edit,VI command usage,para :$ to the last line para :line go to lines /string: move to right location one time ?string: move to left location one time n next string N previous string Ctrl b pageup Ctrl f pagedown :q quit vi :q! quit and dont save file :wq(:x) save file and quit :wq! Sav

15、e file and force quit,RPM command usage,rpm is a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes h

16、elper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages Command: rpm -ivh - -nodeps -

17、- force *.rpm rpm -e - -allmtches WBXms-* rpm -qa|grep WBXms rpm -ql WBXms rpm -qf filename rpm -qpl jdk-1.3.1.i386.rpm,RPM command usage,-ivh Display package information and install packages process -qa Query all installed packages -ql Query and List files in package. -qf Query package owning FILE

18、-qpl Query rpm package contents -nodeps Dont check dependencies before uninstalling the packages -force force to install it if package have installed -allmatches Remove all versions of the package which match PACKAGE_NAME. Normally an error is issued if PACKAGE_NAME matches multiple packages.,Cronjo

19、b usage,crontab - maintain crontab files for individual users Crontab is the program used to install, deinstall or list the tables used to drive the cron daemon in Vixie Cron. Each user can have their own crontab, and though these are files in /var, they are not intended to be edited directly. cront

20、job format: Minutes(1-59) Hours(1-23 0 is midnight) Date(1-31) Months(1-12) Week(0-6 0 is Sunday) Command For Example: 30 21 * * * /apps/bin/cleanup.sh run /apps/bin directory s cleanup.sh with each night 21:30 45 4 1,10,22 * * /apps/bin/backup.sh run /apps/bin directorys backp.sh with each month da

21、te 1,10,22 4:45 10 1 * * 6,0 /apps/bin/cleanup.sh with each Saturday,Sunday 1:10 run cleanup.sh 0,30 18-23 * * * /apps/bin/dbcheck.sh each day from 18:00 to 23:00 and each 30 minutes run dbcheck,sh,Cronjob usage,How to edit and write: -l list cronjob files contents crontab l aa.sh then edit crontab,

22、 when edit finished run command: crontab aa.sh. Although cronjob it have the command e and r option, I dont recommend you do it like that.When you did wrong things, it can not recover it.,Pack and Unpack command: tar、gzip、gunzip、bzip2、bunzip2、compress、uncompress、zip、unzip、rar、unrar,An archiving prog

23、ram designed to store and extract files from an archive file known as a given filename. The final arguments are the names of the files or directories which should be archived. The use of a directory name always implies that the subdirectories below should be included in the archive We will see these

24、 names in common files like: .tar, .tar.gz, .gz, .tgz, .bz2, .Z, .zip, .rar .TAR : tar tf filename.tar list all files in the archive tar cvf filename.tar originationfile pack the original files tar -rf all.tar *.gif append *.gif to all.tar file tar -uf all.tar logo.gif upgrade the logo.gif file to a

25、ll.tar tar xvf aa.tar unpack the aa.tar file,Pack and Unpack command: tar、gzip、gunzip、bzip2、bunzip2、compress、uncompress、zip、unzip、rar、unrar,.TAR.GZ tar xvpzf aa.tar.gz tar cvpzf aa.tar.gz originalfile .TAR.bz2 tar xjvf aa.tar.bz2 very powefull pack tool tar cjvf aa.tar.bz2 originalfile .Z tar xZvf a

26、a.tar.Z tar cZvf aa.tar.Z orignialfile .BZ2 bzip2 -d all.bz2 bunzip2 all.bz2 .Z uncompress all.Z .zip zip all.zip *.jpg unzip all.zip .rar rar a all *.jpg unrar e all.rar,Others info,Mount 的使用 exports - NFS file systems being exported The file /etc/exports serves as the access control list for file

27、sys-tems which may be exported to NFS clients. mount ipaddress:/directory /localdirectory 时间的同步 ntpdate serverIP How to change Ipaddress by modify config files 1) vi /etc/hosts 2) vi /etc/resolv.conf 3) vi /etc/sysconfig/network 4) vi /etc/sysconfig/network-scripts/ifcfg-eth0 reboot that should be o

28、k,Others info,什么是Shell? 什么是shell?总之这个词好象总是出现在 Linux 里,但很多新用户并不清楚它的明确的含义。现给出一个确切而有简单的解释并说明为什么在Linux中它显得如此的重要 shell是你(用户)和Linux(或者更准确的说,是你和Linux内核)之间的接口程序。你在提示符下输入的每个命令都由shell先解释然后传给Linux内核。 shell 是一个命令语言解释器(command-language interpreter)。拥有自己内建的 shell 命令集。此外,shell也能被系统中其他有效的Linux 实用程序和应用程序(utilities a

29、nd application programs)所调用。 Shell的种类: 其中最常用的几种是Bourne shell(sh)、C shell(csh)和Korn shell(ksh)。三种shell各有优缺点、Bourne shell是UNIX最初使用的shell,并且在每种UNIX上都可以使用。Bourne shell在shell编程方面相当优秀,但在处理与用户的交互方面做得不如其他几种shell。Linux操作系统缺省的shell是Bourne Again shell,它是Bourne shell的扩展,简称Bash,与Bourne shell完全向后兼容,并且在Bourne shel

30、l的基础上增加、增强了很多特性。Bash放在/bin/bash中,它有许多特色,可以提供如命令补全、命令编辑和命令历史表等功能,它还包含了很多C shell和Korn shell中的优点,有灵活和强大的编程接口,同时又有很友好的用户界面。,Others info,C shell是一种比Bourne shell更适于编程的shell,它的语法与C语言很相似。 Linux为喜欢使用C shell的人提供了Tcsh。Tcsh是C shell的一个扩展版本。Tcsh包括命令行编辑、可编程单词补全、拼写校正、历史命令替换、作业控制和类似C语言的语法,它不仅和Bash shell是提示符兼容,而且还提供比

31、Bash shell更多的提示符参数。Korn shell集合了C shell和Bourne shell的优点并且和Bourne shell完全兼容。Linux系统提供了pdksh(ksh的扩展),它支持任务控制,可以在命令行上挂起、后台执行、唤醒或终止程序 用户在登录到Linux时由/etc/passwd文件来决定要使用哪个shell IPChains IPCHAINS是一个功能强大的防火墙 , IPCHAINS中最重要的是规则链,所谓规则链就是规定防火规则,既在规则链上定义一些规则,如:是否允许某个网段向发送信息.IPCHAINS中的有四种规则链:input链、output链、forwar

32、d链、用户自定义链,GCC编译器,Linux系统下的gcc(GNU C Compiler)是GNU推出的功能强大、性能优越的多平台编译器,是GNU的代表作品之一。gcc是可以在多种硬体平台上编译出可执行程序的超级编译器,其执行效率与一般的编译器相比平均效率要高20%30%。 gcc编译器能将C、C+语言源程序、汇程式化序和目标程序编译、连接成可执行文件,如果没有给出可执行文件的名字,gcc将生成一个名为a.out的文件。在Linux系统中,可执行文件没有统一的后缀,系统从文件的属性来区分可执行文件和不可执行文件。而gcc则通过后缀来区别输入文件的类别,并遵循的一定的约定规则。 gcc的执行过程

33、 虽然我们称gcc是C语言的编译器,但使用gcc由C语言源代码文件生成可执行文件的过程不仅仅是编译的过程,而是要经历四个相互关联的步骤预处理(也称预编译,Preprocessing)、编译(Compilation)、汇编(Assembly)和连接(Linking)。 只要执行gcc时,附加 -v 这个参数(switch),就能找出你所用的这版gcc,自动帮你定义了什么符号(symbols) gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs Configured with: ./configure -

34、prefix=/usr -mandir=/usr/share/man -infodir=/usr/share/info -enable-shared -enable-threads=posix -disable-checking -disable-libunwind-exceptions -with-system-zlib -enable-_cxa_atexit -host=i386-redhat-linux Thread model: posix gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7),安装Linux 参考文档,How to In

35、stall Redhat7.2 OS:Generic Installation Procedure for Red Hat 7.2 Linux SystemEditor: Juan Xu Last Modified: 01/21/2002 These are generic instructions for installing Red Hat Linux 7.2. After following this procedure, you may have to follow other procedures that are specific to the intended usage of

36、the system. For example, if you are installing a Linux system for use on our Production network, you need to follow additional directions specified by the Hosting and Security departments. NOTE: If you have never installed Red Hat before, you may want some help. This documentation assumes you are ge

37、nerally familiar with the Red Hat installation procedure. Unless otherwise indicated use defaults for everything! Using the two (2) Red Hat 7.2 Linux installation CDs, perform a server installation. Choose to use UTC to store the correct date/time. Set the time and proper timezone. Use Disk Druid to

38、 create these partitions (or use some other partitioning if youve been asked to do so): /boot 100MB swap 1024 MB / the rest of the boot disk For now, choose the lowest security level. This can be changed later with the lokkit command. Install Class X window System, X window System, Gnome and Anonymo

39、us ftp server packages. Use Lilo as the boot loader.A standard installation is usually fairly simple, and takes about an hour. Be sure to use bash for roots shell (this is the default). Install Extra PackagesNow install the RPMs, below, from disk1 and disk2. To install an RPM, put the disk into the

40、CDROM drive, mount /dev/cdrom /mnt/cdrom cd /mnt/cdrom/RedHat/RPMS rpm i - -force xyz.rpm compat-libstdc+* (disk1) compat* (disk2) linuxconf-1* (disk2) Network ConfigurationOnce you have completed the basic installation, use linuxconf for networking setup. (Get help if you dont know how to do this p

41、roperly.) Youll need one more more officially-assigned static IP addresses on the subnet that youre connected to. Youll need to set up Basic Host Information, your gateway, DNS servers, host resolution order (hosts, DNS), and possibly IP aliases, use command: linuxconf. Once youve done this make sur

42、e the new network configuration is active: /etc/rc.d/init.d/network stop /etc/rc.d/init.d/network start Now may be a wise time to reboot your system. Now, enable telnet and ftp. Edit /etc/xinetd.d/telnet, and change disable=yes - disable=no. Edit /etc/*ftp*, and change disable=yes - disable=no. /etc

43、/rc.d/init.d/xinetd restart Configure and Enable NTPvi /etc/ntp.conf Remove the server and fudge lines, and specify which NTP server this machine will be slaved to. In most cases, you should use the IP address of your router. So, for example, now we might add a line like this: server 2 T

44、hen we need start ntpd service: chkconfig -level 345 ntpd on /sbin/service ntpd start Now check and reset the date, if needed. Disable uninteresting daemons:chkconfig -level 2345 apmd off chkconfig -level 2345 lpd off (others may be added to this list in the future) Fix the number of files suportedA

45、dd ulimit -n 8192 command line to /root/.bash_profileAdd this at the bottom of /etc/rc.d/rc.local: sysctl -w fs.file-max=50000 echo 10240 /proc/sys/kernel/rtsig-max Now as root, execute this script: /etc/rc.d/rc.local delete two lines in /etc/profile:# No core files by defaultulimit -S -c 0 /dev/nul

46、l 2&1Build server lib env. in root user:/sbin/ldconfig Now you can remove any temporary files that you may have created. You have now successfully installed Red Hat Linux 7.2 for use as a WebEx Server! (If you have any questions or suggestions and corrections, Please contact with me: Juan How to set

47、up Linux8.0 These are generic instructions for installing Red Hat Linux 8.0. After following this procedure, you may have to follow other procedures that are specific to the intended usage of the system. For example, if you are installing a Linux system for use on our Production network, you need to

48、 follow additional directions specified by the Hosting and Security departments. NOTE: If you have never installed Red Hat before, you may want some help. This documentation assumes you are generally familiar with the Red Hat installation procedure. Unless otherwise indicated use defaults for everyt

49、hing! Using the two (2) Red Hat 8.0 Linux installation CDs, perform a server installation. Choose to use UTC to store the correct date/time. Set the time and proper timezone. Use Disk Druid to create these partitions (or use some other partitioning if youve been asked to do so): /boot 100MB swap 102

50、4 MB / the rest of the boot disk For now, choose the lowest security level. This can be changed later with the lokkit command. Install X window System, Gnome Desktop Enviroment and Server Configuration Tools, FTP server and Network Servers. Use Lilo as the boot loader.A standard installation is usually fairly simple, and takes about 20 minutes. Be sure to use bash for roots shell (this is the default). Network ConfigurationOnce you

温馨提示

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

评论

0/150

提交评论