Actions

Difference between revisions of "Linux"

From kemiko

Line 1: Line 1:
 
<strong>Favorite Commands:</strong>
 
<strong>Favorite Commands:</strong>
  
 +
<pre>
 
Some variables:
 
Some variables:
 
FILE: a filename
 
FILE: a filename
Line 11: Line 12:
 
TIME: a time...format my vary
 
TIME: a time...format my vary
 
NUMBER: a numeric value
 
NUMBER: a numeric value
 +
</pre>
  
 
* find . -type f -exec grep -n "foo" {} /dev/null \;  # search regular files for "foo" inside...printing "path/filename:line:content"
 
* find . -type f -exec grep -n "foo" {} /dev/null \;  # search regular files for "foo" inside...printing "path/filename:line:content"

Revision as of 22:03, 14 November 2016

Favorite Commands:

Some variables:
FILE: a filename
PATH: a directory/file path
LINE: a line's contents
COMMANDS: a/many commands like awk, cat, echo, grep, etc. 
LITERAL: a literal/static variable no REGEX
REGEX: "REGular EXpression"...a pattern matching expression
DATE: a date...format my vary
TIME: a time...format my vary
NUMBER: a numeric value
  • 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"
  • while [ 1 ]; do foo; sleep foo; done