zoukankan      html  css  js  c++  java
  • shell linux基本命令实例、笔记

    1. 在当前文件夹下。查找20分钟内,被訪问过的文件, 并将文件的详情显示出来:

     find ./ -name '*.log' -mmin -20 -exec ls -l   {} ;
    

     

    当然,须要指出的是。假设你是在windows上安装的cgywinportable(windows上的linux工具包),则执行的详细实例:

    find ./ -type f -exec ls -l {} ;

     

    在windows中使用cygwin的find查找.svn相关的文件,并将其删除的命令演示样例:

    findx ./  -name '*.svn'  -exec rm -rf {} ;


     

    即{}和;间没有转意处理符2014年7月22日18:15:16

    凝视:当中{}将会被文件名称替换。而;冒号用于表示命令结束。而;因为用于ls命令,而非find命令,所以须要escaped by 或者用单引號包起来。

    2014年6月23日19:02:25

    2.关于怎样查看隐藏文件:

    ls -a

    2014年6月24日09:39:02

     

    3.grep正則表達式:

    何为转义:将特殊符号当普通符号来处理

    笔记:

    1.^在[]内外的含义

    2.何时须要转义

    3.*在bash中和正則表達式中本身的差别

    4.-acinv的含义

     

     4.

    cat主要有三大功能:
    1.一次显示整个文件。$ cat filename
    2.从键盘创建一个文件。

    $ cat > filename  
       仅仅能创建新文件,不能编辑已有文件.
    3.将几个文件合并为一个文件: $cat file1 file2 > file

    參数:
    -n 或 --number 由 1 開始对全部输出的行数编号
    -b 或 --number-nonblank 和 -n 类似,仅仅只是对于空白行不编号
    -s 或 --squeeze-blank 当遇到有连续两行以上的空白行,就代换为一行的空白行
    -v 或 --show-nonprinting
    例:
    把 textfile1 的档案内容加上行号后输入 textfile2 这个档案里
    cat -n textfile1 > textfile2

    把 textfile1 和 textfile2 的档案内容加上行号(空白行不加)之后将内容附加到 textfile3 里。


    cat -b textfile1 textfile2 >> textfile3

     
    test.txt文件扔进垃圾箱。赋空值test.txt
    cat /dev/null > /etc/test.txt  


    5.后台执行命令

    Syntax

    You can put a task (such as command or script) in a background by appending a & at the end of the command line. The & operator puts command in the background and free up your terminal. The command which runs in background is called a job. You can type other command while background command is running. The syntax is:

  • 相关阅读:
    专题三--1005
    专题三--1009
    专题三--1017
    背包九讲
    专题三--1003
    专题三--1004
    专题三--1015
    [洛谷P1220]关路灯
    [洛谷P1776]宝物筛选
    [USACO14JAN]Recording the Moolympics
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10078464.html
Copyright © 2011-2022 走看看