Posts

Showing posts from December, 2011

Command Line Tips

Image
Here is some of command line tricks that can help you a lot. I am working on this post So you will get more and more... 1.) Using vim to see Calender of two years in single window. #vim -O <(cal 2011) <(cal 2012) Here -O     Open  one window for each file. 2.) ifconfig eth0;sleep 60;ifconfig eth0)|grep "RX bytes" # Pass two runs of ifconfig 60 seconds apart through the same grep using a subshell. [root@server2 ~]#(ifconfig eth0;sleep 60;ifconfig eth0)|grep "RX bytes"           RX bytes:332299170 (316.9 MiB)  TX bytes:21752930 (20.7 MiB)           RX bytes:337602454 (321.9 MiB)  TX bytes:21927669 (20.9 MiB 3.) Here is One line coding for getting status of all init.d scripts(services) and store result in a file root@primary ~] for i in /etc/init.d/*; do echo -e $i status:; echo -e "\t";$i status ;echo -e "\n"; done > ~/daemon_status_list ...

Hard Link Vs Soft Link in Linux

Image
A Link is a connection of one file with other. Links allow more than one file name to refer to the same file, elsewhere. In Linux we make the use of ln command to create links of a file. There are two types of links, both of which are created by ln : symbolic links , which refer to a symbolic path indicating the abstract location of another file, and hard links , which refer to the specific location of physical data. These links behave differently when the source of the link (what is being linked to) is moved or removed. Symbolic links are not updated (they merely contain a string which is the pathname of its target); hard links always refer to the source, even if moved or removed. For  symbolic links we make use of ln -s and for hard links we make use of ln command as shown below : 1.) symbolic links :  [root@server199 ks]# ln -s sed.sh softlink.sh  [root@server199 ks]# ll -rs total 8 0 lrwxrwxrwx 1 root root   6 Dec 12 18:03 softlink.sh ...

Block Ping Linux

Image
How to block all incoming ping linux Steps to block: 1)Just edit this file /etc/sysctl.conf 2)Next look for this line: net.ipv4.icmp_echo_ignore_all NOTE: if you dont find net.ipv4.icmp_echo_ignore_all then simply added to the last line be sure the the value is equals to 1. So make it look like this: net.ipv4.icmp_echo_ignore_all = 1 After that to make changes effective without rebooting run following command: #sysctl -p !Enjoy Linux Kuldeep Sharma

tcpdump Packet Analyser some interesting commands

Image
tcpdump command is also called as packet analyzer. Mr. tcpdump  tcpdump command will work on most flavors of unix operating system. tcpdump allows us to save the packets that are captured, so that we can use it for future analysis. The saved file can be viewed by the same tcpdump command. We can also use open source software like wireshark to read the tcpdump pcap files. In this tcpdump tutorial, let us discuss some practical examples on how to use the tcpdump command. 1. Capture packets from a particular ethernet interface using tcpdump -i : When you execute tcpdump command without any option, it will capture all the packets flowing through all the interfaces. -i option with tcpdump command, allows you to filter on a particular ethernet interface. [root@server199 ~]# tcpdump -i eth1 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes 13:54:40.373435 IP ser...

Renaming Multiple files at Once

  Renaming Multiple files at Once # for i in *.arc;   do         mv "$i" "${i/.arc}".dbf;    done This is just simple one. There are lots of ways to do same task. I will come with those very soon, !Enjoy Linux Kuldeep Sharma