| type two commands at a time | cmd1 ; cmd2 |
| spell check a file | cat filename | spell |
| Reset terminal: if mistakenly viewed a binary file with cat | stty sane |
| append results of a command onto an existing file | cmd>>file.ext |
| write results of a command to a file | cmd>file.ext |
| logout | [Ctrl]+D |
| ftp file to host1 from host2 | ftp host1 |
| search files for a string -# = display '#' lines on both sides -c = display a count -v = display non-matching lines -i = ignore case | grep string filename |
Showing posts with label grep. Show all posts
Showing posts with label grep. Show all posts
Wednesday, March 30, 2011
Miscellaneous Unix Commands
System Information
| list current shell | echo $SHELL |
| show your group | grep yourid /etc/passwd |
| show all groups | more /etc/group |
| system information | uname -a |
| who's logged in | finger |
Monday, March 21, 2011
Grep
| match any character | . | grep l..n filename | finds 'lynn' or 'loan' |
| match only if at the beginning of a line | ^ | grep ^day filename | finds 'day into night'but not 'Some day' |
| match only if at the end of the line | $ | grep day$ filename | finds 'One fine day'but not 'Monday is good' |
| search for '.' or '^' or '$' in a file | \ | grep \* filename | finds '*****1.05' |
| search for a set of names | [] | grep [dog,dil]bert filename | finds 'dogbert' and 'dilbert' |
| find all lines that start with an alphabetic character in upper or lower case | ^[] | grep ^[A-Z,a-z] filename |
Subscribe to:
Posts (Atom)