Difference between revisions of "Linux"
From kemiko
(Adding commands.) |
|||
Line 6: | Line 6: | ||
* locate foo # print the path/filename of file name matching "foo" | * locate foo # print the path/filename of file name matching "foo" | ||
* less -S foo # pager with no line wrap | * less -S foo # pager with no line wrap | ||
− | * du - | + | * 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 | * wget foo # get a file from http/ftp | ||
* scp foo username@hostname:/tmp # put "foo" to location | * scp foo username@hostname:/tmp # put "foo" to location | ||
Line 13: | Line 13: | ||
* vi foo # edit/view file "foo" | * vi foo # edit/view file "foo" | ||
* echo $foo # display contents of variable "foo" | * echo $foo # display contents of variable "foo" | ||
− | * >foo # zeros out file "foo" | + | * >foo || cp /dev/null foo # zeros out file "foo" |
− | * \foo # unalias command "foo" | + | * \foo || "foo" # unalias command "foo" |
Revision as of 22:23, 9 November 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 -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"