SOME TRICKS IN USINGTERMINALTrung Kien Do
AGENDAFind anything with “grep”Quick command with “alias”Commands combination with “|”Suggest commands with “apropos”Some ...
WHY NOT USE FINDERtime waste in searching what’s inside filenot search the hidden filenot flexible: result all contain eit...
FIND ANYTHING WITHGREPgrep options pattern file...some useful options••Text in Subfolder -r grep -r “TMX Map” .Find any fi...
QUICK COMMAND WITHALIASsometimes type something like this is like ****mysql -uroot -prvm_reload_flag=1 source /Users/kien_...
QUICK COMMAND WITHALIASMake command become shorter and readablealias mysql= mysql -uroot -p alias rvm_restart= rvm_reload_...
COMMAND COMBINATIONWITH PIPE (|)The output of command before will be input of aftercommandExamples:grep -r "TMX Map" . | g...
SUGGEST COMMAND WITHAPROPOSsometimes you want to do something but don’t rememberexactly what command should be used?apropo...
SOME OTHER USEFULCOMMANDSln make linkscd - back to before folderw show who are logged on and what they are doinglast the l...
THANK YOU FOR YOURLISTENING !
Upcoming SlideShare
Loading in …5
×

Some Tricks in Using Terminal - KienDT

1,069 views

Published on

This is some tricks in using terminal that improve your speed and give you more convenient with command line

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,069
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Some Tricks in Using Terminal - KienDT

  1. 1. SOME TRICKS IN USINGTERMINALTrung Kien Do
  2. 2. AGENDAFind anything with “grep”Quick command with “alias”Commands combination with “|”Suggest commands with “apropos”Some other useful commands1.2.3.4.5.
  3. 3. WHY NOT USE FINDERtime waste in searching what’s inside filenot search the hidden filenot flexible: result all contain either “TMX” or “Map” whensearch exactly “TMX Map”limited by searching by keywords only••••
  4. 4. FIND ANYTHING WITHGREPgrep options pattern file...some useful options••Text in Subfolder -r grep -r “TMX Map” .Find any file in sub folder of current folderWhole words only -w grep -w “Map”Find Map only, not mapping, maps, mappedCase-insensitive text -i grep -i “map”Return all Map, MAP, map, ....File name only -l grep -l “TMX Map”Find all file contain TMX Map, but return filename onlyNumber of occurrencesonly-c grep -c “TMX Map”Return all file and number of hits TMX Map in each fileSearch using regular expression•
  5. 5. QUICK COMMAND WITHALIASsometimes type something like this is like ****mysql -uroot -prvm_reload_flag=1 source /Users/kien_metalrock/.rvm/scripts/rvmwine ~/.wine/drive_c/Program Files/Oxford/Oxford CollocationsDictionary/ocoll2e.exe......and many so long with complex options commands•
  6. 6. QUICK COMMAND WITHALIASMake command become shorter and readablealias mysql= mysql -uroot -p alias rvm_restart= rvm_reload_flag=1 source/Users/kien_metalrock/.rvm/scripts/rvmalias oxford= wine ~/.wine/drive_c/ProgramFiles/Oxford/Oxford Collocations Dictionary/ocoll2e.exe••••
  7. 7. COMMAND COMBINATIONWITH PIPE (|)The output of command before will be input of aftercommandExamples:grep -r "TMX Map" . | grep "Objects"history | grep "git"history | awk {print $2} | sort | uniq -c | sort -rn | head•••••
  8. 8. SUGGEST COMMAND WITHAPROPOSsometimes you want to do something but don’t rememberexactly what command should be used?apropos keywordExamples:apropos gitapropos patternapropos disk space••••••
  9. 9. SOME OTHER USEFULCOMMANDSln make linkscd - back to before folderw show who are logged on and what they are doinglast the last users logged inhistory show all command in historywhich,whereiswhere does the command come fromdf -h, du -h disk usage statisticssplit & cat split & concat file
  10. 10. THANK YOU FOR YOURLISTENING !

×