Command Line Tricks
Login | Register RSS
01/16/2012 - Linux 

Command Line Tricks

There are a large number of command line tricks out there for Linux.
These are some of the more special things I try to remember.

  • Repeat the last command you just entered

    !!
  • Repeat the last command you just entered thru sudo instead.

    sudo !!
  • Use "mkdir" to create nested directories in a single command

    mkdir dir1/dir2/dir3/dir4
  • Recursively search files starting from current directory using grep

    grep -R thistext *
  • Download a single file via the command line

    wget http://www.somedomain.com/dir/file.txt
  • Download entire website for off-line viewing (with all hyperlinks made local)

    wget --mirror -p --html-extension --convert-links http://www.somedomain.com
  • Generate log file of all broken links on a given website

    wget --spider -o broken.log  -e robots=off wait 1 -r -p http://www.somedomain.com
  • See a history list of your most used commands

    history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r
  • Find lost files you just saved

    find ~ -type f -mtime 0
    find ~ -type f -mtime 0 -iname '*.doc'


If you like this site or any of its content, please help promote it. Use the social media buttons below to help spread the word. Don't forget to post in the comments section.

  Print   Email