Sunday, March 6, 2011

Useful linux commands

<div dir="ltr" style="text-align: left;" trbidi="on">
More useful commands:

Mount a filesystem Drive folder in  ubuntu:
1. Make all the folders shared in windows.
2. sudo mkdir -p /media/c on your ubuntu system
3. sudo fdisk -l this will give you the windows partition name in this case its sda3
4. sudo mount -t ntfs -o nls=utf8,umask=0222 /dev/sda3 /media/c


Start tomcat with logging from termincal
1. ./startup.sh &amp;&amp; tail -f ../logs/catalina.out

To truncate a file use &gt;
&gt;catalina.out (to truncate the file)

mv
rmdir
rm -R (delete with contents)

This comand givee sthe process which is listening
netstat -an | grep "LISTEN " to check which all ports are listening.

iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 8080 -j ACCEPT (if ubuntu is behind firewall)


command to check whether the port is firewalled/ blocked
netcat -nvlp <port_number>

and in the second give the command

netcat -nv 192.168.1.35 <port_number>

To know the process running on the port
sudo netstat -plntu

ps -A -- to get list of process running
ps -aux

kill a process
sudo kill -9 pidd

To get the ip address
/sbin/ifconfig</port_number></port_number></div>