Thursday, June 2, 2011

Linux Tips


Steps for resizing the PC partition in Linux

To view the partitions:

df -ah
Now umount the filesystem using the command given below:

umount /dev/sda1
Perform a check on the file system

e2fsck -f /usr/sda1
Now resize with

resize2fs /usr/sda1 60M
resize is a tool to perform partition.

--------------------------------------------------------------------
To get our public IP in Linux:
curl -s karthik.com
karthik.com is the host name

----------------------------------------------------------------------
Finding Open Sockets in Linux

lsof

use  lsof -i  also

To list all open internet files,use this command:
lsof -i -U

You can also get very specific about ports .We have to use the following command:

lsof -i TCP:3386


To look at UDP ports as follows:
lsof -i UDP:1812