달력

11

« 2024/11 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
2009. 3. 10. 23:31

유용한 터미널 명령어 macOS/Tip2009. 3. 10. 23:31





1. Shell Script를 이용하여 터미널 히스토리 제거하는 방법

function cls { 
osascript -e 'tell application "System Events" to keystroke "k" using command down' 
}

#history -c

2. Download History 제거하는 방버

  • Terminal:

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'

database and dump the results.:

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent' | sort

 

Deleting the Download History List

 

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'


Kill process by searching something from 'ps' command

Terminal - Kill process by searching something from 'ps' command
pkill -f <process name>
2010-06-19 02:36:31
User: eikenberry
Kill process by searching something from 'ps' command

Using -f treats the process name as a pattern so you don't have to include the full path in the command. Thus 'pkill -f firefox' works, even with iceweasel.

Alternatives

There are 3 alternatives - vote for the best!

Terminal - Alternatives
ps ux|grep <process name>|awk '{print $2}'|xargs -n 1 kill
ps h -o pid,command | grep 'TEXT' | sed 's/^ \+//' | cut -d ' ' -f 1 | xargs -n 1 kill

Know a better way?

If you can do better, comment.








:
Posted by Ritz®™