Here are 10 unix commands i use almost every day. I have googled all of them more than once so here they are in one place:

  1. find / -name “*.txt” -mtime 5
    Find all text files in filesystem modified in the last 5 days or last X days. replace -mtime as desired.
  2. sed ’s/^[ \t]*//’ inputfile > outputfile
    Flush all text in input file left into output file.
  3. dig www.roccanet.com
    Returns the ip address of name servers. Can also return any other DNS record - useful for transferring hosts or troubleshooting new sites.
  4. wget [option]… [URL]…
    An excellent download manager for HTTP protocol. Has many options like continuation of interrupted downloads and can mirror (read rip) an entire site. man wget for details.
  5. find / -name “*.htm” | xargs grep “http://www.roccanet.com”
    Find files of -name “xxxx” and then grep - search these files for string “http….” return list of matches (warning this can eat up processing resources - but sometimes necessary)
  6. sed ’s/^M//g’ inputfile > outputfile
    Remove ^M dos endlines from a unix file. dos2unix command also works here (among others)
  7. tar cvf tarball.tar .
    tar archive recursive for current directory. Always backup everything you do - i usually put this in a crontab to run nightly.
  8. wget -c http://www.google.com
    an HTTP commmand line download manager. Simple and powerful - can resume interrupted downloads and mirror a site. Man wget for more details
  9. sed -e ‘1,100d’ inputfile > outputfile
    Truncate lines 1 to 100 from inputfile and truncated result into outputfile. Remove lines 1 through 100 from file.
  10. tail -25 -f filename
    Tail follow the last 25 lines of a file as a stream (-f = follow option). Useful to monitor log files as they are written
  11.  

    tags:Technorati , .
    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • Digg
    • Furl
    • del.icio.us
    • Reddit
    • Technorati
    • Slashdot
    • StumbleUpon
    • YahooMyWeb

SPEAK / ADD YOUR COMMENT
Comments are moderated.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Return to Top

10 Useful Everyday Unix - LAMP commands

FRESH / LATEST POSTS