`

初涉linux(一)

阅读更多
所有的文档命令都基于Fedora8
1. linux命令基础     2009-02-23  by hayabusa
1.1  讲义
    1.1.1.linux的内核版本 格式为主版本号:次版本号:末版本号 比如:2.3.36,奇数次版本号为开发版本,偶数次版本号为稳定版本
    1.1.2.切换终端 Ctrl+Alt+F[1-7]或者chvt n(顺便鄙视下自己,前种方式要按住一两秒,与手机关机有点像)
    1.1.3.clear
      reboot
      init 0   // shun down
      init 6   // same as reboot
    1.1.4.date   
    date -d "20090223 09:12:12" +%F" "%T //echo:2009-02-23 09:12:12
    date -d "10000 days ago" +%D     //echo:10/08/81
    1.1.5.
      w 
      who
      whoami
      who am I(i) //与前一种区别:whoami 只显示当前用户。
   1.1.6.
     pwd //  the current directory
   1.1.7.
     id
     groups
   1.1.8.
     System->Administration->Users and Groups // add/list users or groups
     System->Peferences->About me->Change password //change your password
     passwd
   1.1.9.
      vi
      vi test.txt // edit test.txt
  when editing test.txt :
      <ESC> //from the insert mode to the command mode
      :wq!   //w:save q:exit !:force exit
      : x     //same as :wq!
      :w filename //save as filename
      :set nu   //add the line number for each
      :N      //go to the line N
      :/search   //search ,using n/N going to the next/previous searched phrase
      dd    //delete a line
      Nd    //delete N line
      yy    //copy a line
      p     //stick up the copied content
      dw    //delete a phrase
      k,j,h,l  //move up,down,left,right
      u    //undo
      i    //from the command mode to the insert mode
     1.1.10.history
      history
      modify the histsize to 50:
        su - root
        cd /etc/
        vi profile
        HISTSIZE=50//modify HISTSIZE=50
        cd /etc/skel/
        //edit .bash_logout,add the command:rm -f $HOME/.bash_history
        reboot
      1.1.11.
         cal filename //echo the content of the file
      1.1.12.
        hostname
          vi /etc/hosts
         //modify localhost:localdomain to myhost:mydomain
         //the same action in the /etc/sysconfig/network
     1.1.13.
       touch {a,b}{c,d}
     1.1.14.
.tar
   tar cvf test.tar *.txt
   tar xvf test.tar   //zip/unzip the .tar file
  
   tar zcvf test.tar.gz *.txt
   tar zxvf test.tar.gz  //zip/unzip the .tar.gz file
   
   tar jcvf test.tar.bz2 *.txt
   tar jxvf test.tar.bz2 //zip/unzip  the .tar.bz2 file

  解包: tar xvf FileName.tar
  打包:tar cvf FileName.tar DirName
  (注:tar是打包,不是压缩!)
  ---------------------------------------------
  .gz
  解压1:gunzip FileName.gz
  解压2:gzip -d FileName.gz
  压缩:gzip FileName
  .tar.gz 和 .tgz
  解压:tar zxvf FileName.tar.gz
  压缩:tar zcvf FileName.tar.gz DirName
  ---------------------------------------------
  .bz2
  解压1:bzip2 -d FileName.bz2
  解压2:bunzip2 FileName.bz2
  压缩: bzip2 -z FileName
  .tar.bz2
  解压:tar jxvf FileName.tar.bz2
  压缩:tar jcvf FileName.tar.bz2 DirName
  ---------------------------------------------
  .bz
  解压1:bzip2 -d FileName.bz
  解压2:bunzip2 FileName.bz
  压缩:未知
  .tar.bz
  解压:tar jxvf FileName.tar.bz
  压缩:未知
  ---------------------------------------------
  .Z
  解压:uncompress FileName.Z
  压缩:compress FileName
  .tar.Z
  解压:tar Zxvf FileName.tar.Z
  压缩:tar Zcvf FileName.tar.Z DirName
  ---------------------------------------------
  .zip
  解压:unzip FileName.zip
  压缩:zip FileName.zip DirName
  ---------------------------------------------
  .rar
  解压:rar a FileName.rar
  压缩:r ar e FileName.rar
  
  rar请到:http://www.rarsoft.com/download.htm 下载!
  解压后请将rar_static拷贝到/usr/bin目录(其他由$PATH环境变量指定的目录也可以):
  [root@www2 tmp]# cp rar_static /usr/bin/rar
  ---------------------------------------------
  .lha
  解压:lha -e FileName.lha
  压缩:lha -a FileName.lha FileName 
 

   1.2 扩展
   1.2.1.在修改完hosts与network之后,reboot系统时发现在starting sendmail的时候,总是需要等大约十几分钟到半个小时不能,google之后得出两种解决方案。
第一种:
引用

try add a line like the following to /etc/hosts
Code:

192.168.0.205 computername computername.domanname

where you replace the IP with your IP and the computername and domainname of your computer

第二种:
引用
I use
Code:

chkconfig --levels 345 sendmail off

sendmail is off at starting. And I think when I want to use it again,I can use
Code:

chkconfig --levels 345 sendmail on


这两种方式都试过,应该说是各有优点。当使用静态IP时,选第一种还是不错的。当然第二种方法也是非常方便的。在这里提醒下自己,在Fedora8上使用chkconfig命令时,不仅要使用root,而且shell也必须使用root用户的,即使用su - root命令进入。
  1.2.2 find
1.2.2.1寻找当前目录及所有的子目录下叫hello的文档
   find . -name hello
1.2.2.2 找出七天内未被修改的文档
  find / -mtime +7
1.2.2.3 找出大小超过2000 bytes的文档
  find / -size 2000c
1.2.2.4 在/tmp下属于flm的文档
  find /tmp -user flm
1.2.2.5 显示当前目录及所有的子目录文件名前4位为test的文件名
  find . -name "test*"
分享到:
评论

相关推荐

    linux内核驱动-内核初涉.docx

    linux内核驱动-内核初涉.docx

    初入Linux教程 03--初入Linux

    03--初入Linux03--初入Linux03--初入Linux03--初入Linux03--初入Linux

    Linux初启分析 Linux初启分析 Linux初启分析

    Linux初启分析Linux初启分析Linux初启分析Linux初启分析Linux初启分析Linux初启分析Linux初启分析

    Linux常用词汇与术语手册

    对于初涉Linux世界的Microsoft Windows用户而言,有许多新的术语需要学习。本词汇表简明地 解释了 Linux 产品常用的许多术语、首字母缩写词和缩写的意思和意义。(其中有些术语并不是Linux 所特有的,但许多Windows...

    Linux应用技术:二Linux初体验命令操作界面使用.pptx

    项目二 Linux基础使用 第三讲 主要内容 启动与关闭系统 Linux常用命令 init运行级别 Linux系统的命令操作界面 Linux命令的操作界面 ...Linux是一个多用户操作系统 允许多个用户登录 允许一个用户登录多次 需要

    Linux应用技术:二Linux初体验Linux基本操作.pptx

    第二讲 Linux初体验 项目二 主要内容 启动与关闭系统 Linux基本操作及常用命令 Init进程 Linux命令操作界面 启动与关闭系统 Linux的启动与关闭 选择登录用户 选择使用语言 选择启动会话的模式 重新启动 关机 Linux...

    为Windows用户准备的简明Linux词汇表

    对于初涉 Linux 世界的 Microsoft Windows 用户而言,有许多新的术语需要学习。本词汇表简明地解释了 Linux 产品常用的许多术语、首字母缩写词和缩写的意思和意义。(其中有些术语并不是 Linux 所特有的,但许多 ...

    Linux C编程一站式学习

    Linux C 编程的入门指引,对于各方面都有讨论,对于初入linux编程的同学有一定的参考作用。 Linux C 编程的入门指引,对于各方面都有讨论,对于初入linux编程的同学有一定的参考作用。 Linux C 编程的入门指引,对于...

    (saintgreat)——初入Linux世界

    对于我的linux学习,安装了好长 时间,算是一点经验,希望初学、安装的朋友能够别跟我一样啊!!!

    Linux初,中级学习者教程-Linux操作系统技术合集

    Linux初,中级学习者教程-Linux操作系统技术合集 Linux初,中级学习者教程-Linux操作系统技术合集

    Linux初學之旅_幫助初學者可以較輕鬆的進GNU/Linux 的世界

    這篇文章旨在幫助初學者可以較輕鬆的進GNU/Linux 的世界。由於資料愈加愈多,書籍介紹的部份只好忍痛刪去,各位到書局逛逛應該就找得到合適的。

    Linux下一个简单的文件系统实现

    本代码实现了Linux下的一个简单的文件系统XORFS,针对Linux2.6版本。XORFS,是它“或许很强大”的意思。

    进程和线程的创建(linux) 源代码

    1. 在linux下编写一个应用程序,命名为an_ch2_1b。这个程序不断地输出如下行: Those output come from child,[系统时间] 另外写一个应用程序,命名为an_ch2_1a。这个程序创建一个子进程,执行an_ch2_1b。这个程序...

    东方标准Linux初中级培训教程

    东方标准Linux初中级培训教程,分享快乐。

    Linux 新手最佳晋级10本培训书籍集

    Linux 新手最佳晋级10本培训书籍集 Linux 指令大全.doc Linux菜鸟专用资料.pdf linux从入门到精通.pdf Linux实用培训学习教程1.0(最终版)....搭建一个安全的Linux服务器教程.txt 嵌入式Linux应用程序开发详解(1-11).pdf

    Linux从初学到精通

    目前各种类型的Linux系统在其应用领域中都有着长足的发展,特别是在信息安全越来越重要的今天... 《Linux从初学到精通》适合Linux初、中级用户参考学习,也可作为高等院校电子类、信息类、计算机类等专业的Linux教材。

    大学生攻克Linux系统教程.rar

    一个障碍,一个学习Linux的最大障碍-无指导-在困扰着每一位企图闯出初中级Linux困境的人。攻克Linux系统教程给你提供动力,帮助你闯出难关。为何这么有把握?原因很简单,天下没有难学的Linux。 红联是致力于...

    初用Linux操作系统时要掌握的技巧

    专门对于初用Linux操作系统的人而准备的,请多多支持.

Global site tag (gtag.js) - Google Analytics