Difference between revisions of "Linux"
From kemiko
(Created page with "<strong>Favorite Commands:</strong> * find . -name "*" -exec grep -n {} /dev/null \;") |
(Adding commands.) |
||
Line 1: | Line 1: | ||
<strong>Favorite Commands:</strong> | <strong>Favorite Commands:</strong> | ||
− | * find . - | + | * 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 -h -d1 | sort -h # disk usage (human size)...group/sum one level deep and 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 # zeros out file "foo" | ||
+ | * \foo # unalias command "foo" |
Revision as of 22:19, 31 October 2016
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 -h -d1 | sort -h # disk usage (human size)...group/sum one level deep and 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 # zeros out file "foo"
- \foo # unalias command "foo"