Actions

Linux

From kemiko

Revision as of 22:23, 9 November 2016 by Kemiko (talk | contribs)

Favorite Commands:

  • find . -type f -exec grep -n "foo" {} /dev/null \; # search regular files for "foo" inside...printing "path/filename:line:content"
  • find . -type f -exec ls -hlatr {} \; | sort -hk5,5 # long list all files under a directory, sort smallest to largest (human size)
  • rm -rf foo # remove a directory "foo" and all content
  • awk -F'foo' '{print $number}' # print the column (number) delimited by "foo"
  • locate foo # print the path/filename of file name matching "foo"
  • less -S foo # pager with no line wrap
  • du -hd1 | sort -h # disk usage (human size),one level deep and sum by directory...pipe to sort smallest to largest
  • wget foo # get a file from http/ftp
  • scp foo username@hostname:/tmp # put "foo" to location
  • scp username@hostname:/tmp/foo . # get "foo" from location
  • cat foo # display contents of file "foo"
  • vi foo # edit/view file "foo"
  • echo $foo # display contents of variable "foo"
  • >foo || cp /dev/null foo # zeros out file "foo"
  • \foo || "foo" # unalias command "foo"