Difference between revisions of "Linux"
From kemiko
Line 1: | Line 1: | ||
− | <strong>Favorite Commands:</strong> | + | <strong>Favorite Commands (Debian):</strong> |
+ | |||
− | |||
Some Notation: | Some Notation: | ||
− | FILE: | + | <br> |
− | + | " #": everything following this to the end of the line is a comment...you can also paste it...the shell will ignore it | |
− | PATH: | + | <br> |
− | LINE: | + | FILE: filename |
− | + | <br> | |
− | + | DIR: directory | |
+ | <br> | ||
+ | PATH: directory/[file] location | ||
+ | <br> | ||
+ | LINE: line's contents | ||
+ | <br> | ||
+ | CMD: command like awk, cat, echo, grep, etc. | ||
+ | <br> | ||
+ | LIT: literal/static variable no REGEX | ||
+ | <br> | ||
REGEX: "REGular EXpression"...a pattern matching expression | REGEX: "REGular EXpression"...a pattern matching expression | ||
− | DATE: | + | <br> |
− | TIME: | + | DATE: date...format may vary |
− | + | <br> | |
− | + | TIME: time...format may vary | |
− | + | <br> | |
+ | NUM: numeric value | ||
+ | <br> | ||
+ | SEP: field separator | ||
+ | <br> | ||
+ | VAR: variable | ||
+ | <br> | ||
+ | URL: Uniform Resource Locator | ||
+ | <br> | ||
/dev/null: a device file representing nothing | /dev/null: a device file representing nothing | ||
− | read: read's stdin | + | <br> |
− | < | + | read: shell builtin that read's stdin |
+ | <br> | ||
+ | *: wildcard | ||
+ | <br> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <ul> | |
− | + | <li> | |
− | + | type CMD <font color="#AAAAAA"># cool builtin that tells you what you are looking at...</font> | |
− | + | </li> | |
− | + | <ul> | |
− | + | <li> | |
− | * a2ensite kohlmeyer.us.conf # Apache...enable a virtual host | + | alias |
− | + | </li> | |
− | + | <li> | |
− | + | builtin | |
− | + | </li> | |
− | + | <li> | |
+ | command | ||
+ | </li> | ||
+ | <li> | ||
+ | etc. | ||
+ | </li> | ||
+ | </ul> | ||
+ | </li> | ||
+ | <li> | ||
+ | uname -a <font color="#AAAAAA"># lists basic system information</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | uptime <font color="#AAAAAA"># print time since system boot</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | top <font color="#AAAAAA"># traditional performance monitor</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | htop <font color="#AAAAAA"># improved performance monitor</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | mytop <font color="#AAAAAA"># a top like tool for MySQL</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | itop <font color="#AAAAAA"># a top like tool I programmed for Informix 9.40.FC7</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | du -hd1 | sort -h <font color="#AAAAAA"># disk usage (human size), one level deep and sum by directory...pipe to sort smallest to largest</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | find . -type f -exec grep -n "LIT/REGEX" {} /dev/null \; <font color="#AAAAAA"># search regular files for "LIT/REGEX" inside...printing "path/filename:line:content"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | find . -type f -exec ls -hlatr {} \; | sort -hk5,5 <font color="#AAAAAA"># long list all files under a directory, sort smallest to largest (human size)</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | find . -maxdepth 1 -type f <font color="#AAAAAA"># list only regular files in current directory</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | rm -rf PATH <font color="#AAAAAA"># remove a "PATH" and all content</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | awk -F'SEP' '{print $NUM}' <font color="#AAAAAA"># print the column "NUM" delimited by "SEP"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | locate LIT <font color="#AAAAAA"># print the PATH of file name matching "*LIT*"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | less -S FILE <font color="#AAAAAA"># page "FILE" with no line wrap</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | wget URL <font color="#AAAAAA"># get "URL" from http/ftp</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | scp PATH1 username@hostname:PATH2 <font color="#AAAAAA"># put "PATH1" to "PATH2"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | scp -r PATH1 username@hostname:PATH2 <font color="#AAAAAA"># same as above, but recursively puts directory and all files under it</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | scp username@hostname:PATH1 PATH2 <font color="#AAAAAA"># get "PATH1" to "PATH2"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | scp -r username@hostname:PATH1 PATH2 <font color="#AAAAAA"># same as above, but recursively gets directory and all files under it</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | cat FILE <font color="#AAAAAA"># display contents of "FILE"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | vi FILE <font color="#AAAAAA"># edit/view "FILE"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | echo $VAR <font color="#AAAAAA"># display contents of variable "VAR"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | >FILE <font color="#AAAAAA"># zeros out "FILE" keeping current attributes</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | cp /dev/null FILE <font color="#AAAAAA"># zeros out "FILE" keeping current attributes</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | touch FILE <font color="#AAAAAA"># creates a FILE of zero size if does not exist or updates file's timestamp to current time</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | \CMD <font color="#AAAAAA"># unalias "CMD"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | "CMD" <font color="#AAAAAA"># unalias "CMD"</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | while [ 1 ]; do CMD; sleep NUM; done <font color="#AAAAAA"># repeat CMD with NUM seconds between/wait</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | cat FILE | while read LINE; do CMD; done <font color="#AAAAAA"># read a file line by line doing a CMD until file's end</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | apt-get update <font color="#AAAAAA"># updates the system's package lists</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | a2ensite kohlmeyer.us.conf <font color="#AAAAAA"># Apache...enable a virtual host</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | ffmpeg -ss 4.5 -i input.mp3 -t 1.7 output.mp3 <font color="#AAAAAA"># cut a mp3 from 4.5 seconds to 6.2 seconds</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | vlc FILE <font color="#AAAAAA"># play audio or video FILE</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | eog FILE <font color="#AAAAAA"># display image FILE</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | gnome-system-monitor <font color="#AAAAAA"># graphical display of system resources</font> | ||
+ | </li> | ||
+ | <li> | ||
+ | gimp <font color="#AAAAAA"># run GNU Image Manipulation Program</font> | ||
+ | </li> |
Revision as of 11:12, 14 January 2017
Favorite Commands (Debian):
Some Notation:
" #": everything following this to the end of the line is a comment...you can also paste it...the shell will ignore it
FILE: filename
DIR: directory
PATH: directory/[file] location
LINE: line's contents
CMD: command like awk, cat, echo, grep, etc.
LIT: literal/static variable no REGEX
REGEX: "REGular EXpression"...a pattern matching expression
DATE: date...format may vary
TIME: time...format may vary
NUM: numeric value
SEP: field separator
VAR: variable
URL: Uniform Resource Locator
/dev/null: a device file representing nothing
read: shell builtin that read's stdin
*: wildcard
- type CMD # cool builtin that tells you what you are looking at...
- alias
- builtin
- command
- etc.
- uname -a # lists basic system information
- uptime # print time since system boot
- top # traditional performance monitor
- htop # improved performance monitor
- mytop # a top like tool for MySQL
- itop # a top like tool I programmed for Informix 9.40.FC7
- du -hd1 | sort -h # disk usage (human size), one level deep and sum by directory...pipe to sort smallest to largest
- find . -type f -exec grep -n "LIT/REGEX" {} /dev/null \; # search regular files for "LIT/REGEX" 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)
- find . -maxdepth 1 -type f # list only regular files in current directory
- rm -rf PATH # remove a "PATH" and all content
- awk -F'SEP' '{print $NUM}' # print the column "NUM" delimited by "SEP"
- locate LIT # print the PATH of file name matching "*LIT*"
- less -S FILE # page "FILE" with no line wrap
- wget URL # get "URL" from http/ftp
- scp PATH1 username@hostname:PATH2 # put "PATH1" to "PATH2"
- scp -r PATH1 username@hostname:PATH2 # same as above, but recursively puts directory and all files under it
- scp username@hostname:PATH1 PATH2 # get "PATH1" to "PATH2"
- scp -r username@hostname:PATH1 PATH2 # same as above, but recursively gets directory and all files under it
- cat FILE # display contents of "FILE"
- vi FILE # edit/view "FILE"
- echo $VAR # display contents of variable "VAR"
- >FILE # zeros out "FILE" keeping current attributes
- cp /dev/null FILE # zeros out "FILE" keeping current attributes
- touch FILE # creates a FILE of zero size if does not exist or updates file's timestamp to current time
- \CMD # unalias "CMD"
- "CMD" # unalias "CMD"
- while [ 1 ]; do CMD; sleep NUM; done # repeat CMD with NUM seconds between/wait
- cat FILE | while read LINE; do CMD; done # read a file line by line doing a CMD until file's end
- apt-get update # updates the system's package lists
- a2ensite kohlmeyer.us.conf # Apache...enable a virtual host
- ffmpeg -ss 4.5 -i input.mp3 -t 1.7 output.mp3 # cut a mp3 from 4.5 seconds to 6.2 seconds
- vlc FILE # play audio or video FILE
- eog FILE # display image FILE
- gnome-system-monitor # graphical display of system resources
- gimp # run GNU Image Manipulation Program