COMMANDS -------- ls -- list files in current directory -l (show all file attributes) -R (recurse into other directories) pwd -- show current directory ps -- process listings ax (show all processess, not just terminal ones.. background daemons too ) top -- show current info about everything chown -- change owner (example): $ chown user:group filename.txt (recursive): $ chown -R user:group directory chmod -- change permissions (example): $ chmod +x filename.txt $ chmod -R o-x dirname/ $ chmod 644 filename $ chmod 700 filename (quantities): READ = 4 WRITE = 2 EXEC. = 1 (symbols): u = owner (thing 'user') g = group o = others grep -- find patterns (just use plain text) last -- last logins df -- show partition disk usage -h (common option.. == "human readable") du -- show disk usage for a particular node -h (human readable) -s (summary) -k (kilobytes) (example): du -sh /root w -- show who's logged in, where they're logged in from, what they're running sort -- sort stdin passwd -- change the password (if root): passwd sed -- stream editor sed 's///g' (takes stdin, puts to stdout) cat -- list contents of some node (file) cat mv -- move stuff mv [,] cp -- copy stuff cp cp -r (symbolic): ~ == (example): cp -r /htdocs ~/web_backup (english): copy the web server's htdocs into a folder called htdocs in my home directory rm -- delete stuff -r (recursive) -f (older systems: do you really wanna delete directories?? yes!!! prob don't need on modern FBSDs) date -- what time is it? cal -- display current month cal (display whole year's cals) kill -- kill a process (won't work w/no params) kill this process (sends the TERM signal, the nice way to ask if the proc will stop please) -9 sends the KILL signal, which always kills killall -- kill a process by executable name (sends the KILL signal by default... doesn't play nice echo -- something to stdout (example): echo "Hi I'm big bad root" | wall wall -- yell to everyone on a terminal (execept root if you're non- root) mkdir -- makes dir rmdir -- removes dir (alias for rm -r) time time a process's run ln (make a link) -s (symbolic link) (example): ln -s /home/webmaster/htdocs/ /usr/local/apache/htdocs/ netstat -- who's connected to what port, etc -n (don't do reverse lookups on IPs.. just show me the IP) nmap -- do a port scan.. what's open. -O determine operating system head/tail -- show the top/bottom of a file - show lines from top/bottom -f "follow" the log file crontab -- edit things having to do with the cron daemon, i.e., scheduled services, etc -e (edit my crontab file) -l (show my crontab entries) NOTE: man crontab just gives you command instructions. File format can be found in man 5 crontab -- TIPS -- * Most logs are found in /var/log/ * How to update locate database /usr/libexec/locate.updatedb * Cron file syntax (my crontab) -- start -- MAILTO="" 30 0 * * * webalizer */20 * * * * /usr/local/bin/python /usr/local/apache/htdocs/mail_tidy.py 0 18 * * 5,6,0 cd /usr/hlds_l/; /usr/hlds_l/cs_start 0 5 * * 6,0,1 killall hlds_run 0,30 * * * * nice /usr/src/psychostats1.5/stats;/usr/local/thttpd/fixindex.py */2 * * * * /usr/local/thttpd/fixindex.py -- end -- Asts correspond to: minute hour dayofmonth month dayofweek * "tarballs": --making $ ls chris_stuff $ tar cvfpP chris_stuff.tar chris_stuff/ $ ls chris_stuff.tar $ gzip chris_stuff.tar $ ls chris_stuff.tar.gz --decompressing $ ls chris_stuff.tar.gz $ gunzip chris_stuff.tar.gz $ tar xvf chris_stuff.tar $ ls chris_stuff