Linux Commands
General Reference Links
http://tldp.org/LDP/abs/html/basic.html
http://www.tuxfiles.org/linuxhelp/linuxcommands.html
Below are handy commands that I often need and usually forget. I’m a Linux novice, so if most appear very basic, so is my Linux experience.
System Info
Memory:
cat /proc/meminfo
List of process related commands at http://www.cyberciti.biz/faq/show-all-running-processes-in-linux/
Processes on a specific port (often used to find what to run kill 9 [portnum] on):
lsof | grep 5556
or
netstat -anp|grep :5556
Misc
sudo su -l (thats a lower “L”) makes you root
pbrun su
or
/usr/local/bin/pbrun -u [USER ID TO EMULATE] ksh
example: /usr/local/bin/pbrun -u mdmadmin ksh
pwd For full path to current directory
File commands
Last modified: ls filename -l
Delete file: rm filename
du -ch [DIRECTORY_NAME] | grep total
returns
7.0G total
More at http://www.codecoffee.com/tipsforlinux/articles/22.html
ZIP
zip -r [archive_name] [directory_to_zip]
More at
http://linux.about.com/od/commands/a/blcmdl1_zipx.htm
Tail
-f, –output appended data as the file grows; -f, –follow, and –follow=descriptor are equivalent
-n, –lines=N output the last N lines, instead of the last 10
Full syntax: tail -f -n 100 [PATH TO LOG FILE]
Example
tail -f -n 100 /app/bea/wlp1032/user_projects/domains/f1_domain/servers/AdminServer/logs/AdminServer.log
WebLogic
Stop WLS sytnax
.[full/domain/path]/bin/stopWebLogic.sh
Stop WLS example
./app/bea/wlp1032/user_projects/domains/portal_domain/bin/stopWebLogic.sh
Start WLS sytnax
.[full/domain/path]/bin/startWebLogic.sh
Start WLS example
./app/bea/wlp1032/user_projects/domains/portal_domain/bin/startWebLogic.sh
Sample nohup Start Script
#!/bin/sh
dir=/app/bea/wlp1032/user_projects/domains/f1_domain/bin/wwwlog
log=Admin.weblogic.log
export dir; export log;
echo “tail -f $dir/$log”
mv $dir/$log $dir/archived/$log.`date ‘+%m%d%y.%H%M’`
nohup ./startWebLogic.sh > $dir/$log 2>&1 &