GENERAL NOTE: can put quotes around pattern if contains spaces
GREP searches INSIDE the given stream/file(s) for the pattern string
grep [options] pattern [stream/file]
EXAMPLES
grep -lir jack csYear3 ~ searches INSIDE all files in the given dir (csYear3) for the string "jack" (-l means output filenames not lines, -i = ignore case, -r = recursive)
grep -i dijkstra /home/jack/essay.txt ~ returns lines of the file essay.txt containing the word dijkstra
chmod: CHange access MODe
USE
chmod <u/g/o/a>=<r/w/x> <file/folder>
EXPLANATION
u/g/o/a - user/group/others/all
r/w/x - read/write/execute (or all 3)
e.g. chmod o=r doc1.txt
2 main options: FIND and LOCATE
GENERAL NOTES:
-asterisks for wildcards
-can put quotes around pattern if contains spaces
The LOCATE command is the simplest and fastest. It searches the whole filesystem for filenames/directories CONTAINING pattern (i.e. it searches with wildcards: *pattern*)
locate [options] pattern
COMMAND STRUCTURE
sudo /etc/init.d/service action
SERVICES
-samba
-apache2 (sometimes httpd)
-ssh
-tomcat
id <user> ~ get all info (inc userID and groupIDs for a user)
USER MANAGEMENT
cat /etc/passwd ~ view all users
useradd <username> ~ add a new user (and create them a home directory in /home)
passwd <user> ~ reset a user's password
userdel <user> ~ delete a user