Common
Linux Shell – some hints
1. February 2013
0

Search

  • search for string in files recursively
grep -R "Suchstring" *
  •  search for string in stdout
cat /var/log/syslog | grep 'ERROR'
  •  count lines in output
cat /var/log/syslog | grep 'ERROR' -c
  • search for a file recursively
find . -iname "settings.py"
  • search and replace string in multiple files (replace bike with car in all html files in this folder)
find . -iname "*.html" -depth 1 -exec sed -i "" -e "s/car/bike/g" {} \;

User management

  • add user to a group
addgroup USER GRUPPE

 

Process management

  • show applications and ports they opened
netstat -tulpn

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.