Linux Commands / Tips

Welcome Guest Login or Register
Total Members: 5


TITLES:

|| HOME | Contact Us ||
|| Add Command ||

  • Aliases
  • Backup
  • cp
  • Insertion of a password into a pdf file
  • Play video DVD ISO file with Xine
  • Quick format of CD-RW
  • Removing old kernels
  • Searching
  • Split
  • xorg.conf ModeLine
  • Search:

    Showing Searching

    Scroll Down to see the comments / add comments

    Submitted by: Will | Total Views: 304

    There are several ways to search for files

    I came up with a little bash script which you can use for searching for files:
    #!/bin/bash
    ## INSTALLATION:
    ## MAKE A FILE se AND PLACE IT IN THE /USR/BIN DIRECTORY, YOU MUST BE ROOT TO DO THIS
    ## CHMOD IT TO 700 - CHANGE OWNERSHIP chown user:user se
    ## TYPE IN se AT THE TERMINAL AND YOU SHOULD SEE "What file to search for?"
    ## ANY QUESTIONS VISIT HTTP://CODE-HEADS.COM

    echo "CodeHeads File Search"
    read -p "What file to search for?? " FIL
    if [[ $FIL == "" ]]
    then
    echo "Sorry need a file to search for"
    else
    read -p "What directory?? " DIR
    if [[ $DIR == "" ]]
    then
    echo "Sorry need a directory to search under"
    else
    echo; echo "List of files found"
    du -a $DIR | grep $FIL
    fi
    fi

    You can also use find:
    find [text]
    This only finds files in the current directory you are in.

    Locate is another option:
    locate [file]
    You may have to issue this command before using the locate command:
    updatedb
    It will tell you if you need to do this.

    | Add Comment |

    Comments

    Name: Comment


    Linux Commands by CodeHeads and Paul Smith © 2006 All Rights Reserved! All information on this site is property of the respected owners (posters)