Total Pageviews

Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, May 14, 2014

Packet Capturing on linux

Using tshark
root@bng-sql-1:~# tshark -i eth2 -R diameter -V
tshark: Lua: Error during loading:
 [string "/usr/share/wireshark/init.lua"]:45: dofile has been disabled
Running as user "root" and group "root". This could be dangerous.
Capturing on eth2

Count how many times a string occurs in all files

grep -c string *
to get only files that have one or more occurrence:
grep -c string * | grep -v :0
for multiple occurrences per line:
grep -o string * | wc -l

Shared library management with ldconfig

Ldconfig is a basic system program which determines run-time
linkbindings between ld.so and shared libraries. Ldconfig scans a
running system and sets up the symbolic links that are used to load
shared libraries properly. It also creates a cache (/etc/ld.so.cache)
which speeds the loading of programs which use shared libraries.

To see lib used by a binary
[root@nsetcindia-web ~]# ldd /usr/bin/curl-loader
        libdl.so.2 => /lib64/libdl.so.2 (0x0000003b47e00000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003b48600000)
        librt.so.1 => /lib64/librt.so.1 (0x0000003b48e00000)
        libz.so.1 => /usr/lib64/libz.so.1 (0x0000003b48a00000)
        libcares.so.2 => not found
        libc.so.6 => /lib64/libc.so.6 (0x0000003b47a00000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003b47600000)
[root@nsetcindia-web ~]#


Add your custom lib locations to /etc/ld.so.conf
and do
ldconfig
To see  
ldconfig -p | less

Delete a file with spaces in linux

Get innode Number
ls -il
find . -inum 270016 -exec rm -i {} \;