Pages

Friday, June 29, 2012

Files Opened By Application

In Order to find the files that are opened by an application we can use the lsof command like, [root@vx111a bin]# lsof +f  | head COMMAND    PID      USER   FD    TYPE   DEVICE     SIZE       NODE NAME init         1      root ...
Read More

Thursday, June 28, 2012

Why 'du', 'df', and 'ls' show different result for the same disk block

du , df and ls commands show different results for the same Disk block , the reason is  * 'ls' gives data on individual files based on the difference between the end-of-file and the beginning-of-file, whether or not blocks were actually allocated to the file  * 'du' shows the blocks actually allocated to an individual file  * 'df' shows the blocks allocated in the entire file system, including inodes and...
Read More

Mounting a NTFS file system

Since Linux supports different File systems than Windows, there is always a problem accessing the windows files in linux. This article helps you in mounting the ntfs file system on linux and allows accessing the files available on them. The article was written on RHEL 5.4 with Kernel 2.6.18-238.el5.Make sure you download the correct kernel packages. There is a need for some packages to be installed for this to work....
Read More

Wednesday, June 27, 2012

Empty A File

There are many ways available for making a file empty. Here are few [root@vx111a ~]# echo "this Is jagadesh" >> sample.txt [root@vx111a ~]# cat sample.txt this Is jagadesh [root@vx111a ~]# >sample.txt [root@vx111a ~]# cat sample.txt [root@vx111a ~]# echo "this Is jagadesh" >> sample.txt [root@vx111a ~]# :>sample.txt [root@vx111a ~]# cat sample.txt [root@vx111a ~]# echo "this Is...
Read More

su vs su-

The main difference between su - and su is that the former makes the shell a login shell. This is very important especially if the user is going to su from a regular user account to a root (superuser) account. Normal users do not usually have /sbin/ and /usr/sbin/ in their search path. Therefore if a normal user wants to execute the command ifconfig, for example, after doing su, he usually gets the error message: bash:...
Read More

Commands on Commands

There are few commands in Linux which can be executed on other commands To see how the command is executing and what actually is command is doing  strace ls An excerpt of the output, execve("/bin/ls", ["ls"], [/* 36 vars */]) = 0 brk(0)                                  =...
Read More

Find Examples

The examples were used by me mostly during my work, (continuously updated) Find and Gzip find $PWD –type f –name “*.log” | xargs tar zcvf one.tar Find and Remove find –type f –name “*.log” | xargs rm find –type f –name “*.log” -exec rm -f {} \; Find and get confirmation to remove find –type f –name “*.log” –ok rm {} ‘;’ Find files with size and...
Read More

Halt, Reboot & Power off

The Difference between these are Halt : halt the system Reboot: Sym link to halt command, halt the system and then power off and start Power off: Sym link to halt command, halt the system and then power off Happy learning ...
Read More

Getent in Linux

Getent is a shortcut for get Entries. This gets the details from administrative databases. These databases can be passwd, group, hosts, ip nodes, services, protocols, ethers and network e.t.c The General Syntax will be  getent [group|hosts|networks|passwd|protocols|services] [keyword] [root@vx111a ~]# getent passwd root root:x:0:0:root:/root:/bin/bash [root@vx111a ~]# getent group bin bin:x:1:root,bin,daemon [root@vx111a...
Read More

Tuesday, June 26, 2012

How do I find how many files an application is using

In order to find how many files and application is using , we can use lsof +c 0 | cut -d' ' -f1 | sort | uniq –...
Read More

Find Out What Partition a File Belongs To

We can use the df command to find out what partition a file belongs, [root@vx111a perl]# df -T file1 Filesystem    Type   1K-blocks      Used        Available    Use% Mounted on /dev/sda7     ext3    49594196     5499736  41534504  12%    / ...
Read More

Monday, June 25, 2012

Use Full Commands 1

Here is a List of use full commands that can used be used on linux. This page will be updated continuously with commands, Find The MAC Address   [root@vx111a test]# cat /sys/class/net/eth0/address 00:25:64:b3:19:fd Find The Command Line Of the Process Using Specific Port cat /proc/$(lsof -ti:631)/cmdline Ping a Host Using Specific Interface ( Or can check Internet Connection for an Interface) ping -I eth0...
Read More

Check the Multi Cast Address Subscribed

There are times where we need to test various address including the multi cast address.To find the multi cast address that was subscribed for the system we can use  [root@vx111a local]# ip maddr 1:         lo             inet  224.0.0.1 2:         eth0            ...
Read More