Results 1 to 3 of 3

Thread: Advance Linux commands

  1. #1
    Join Date
    Sep 2008
    Posts
    9

    Default Advance Linux commands

    To get the list of username with its user ID in formatted way:

    awk -F":" '{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd
    Find the particular string from the list of files in current directory:

    cd /etc
    for i in $(find -type f); do grep -iH nfsnobody $i; done
    Or

    grep -iH nfsnobody *
    Get the number of occurrences of particular word in file:

    awk '/ServerName/ {i=i+1} END {print i}' /etc/httpd/conf/httpd.conf
    grep ServerName /etc/httpd/conf/httpd.conf
    To delete resources of semaphore arrays from memory:

    ipcs -s | grep apache | perl -e 'while (<STDIN>) { @a=split(/\s+/); print`ipcrm sem $a[1]`}'

    To get the list of IP addresses in the server:

    ifconfig | grep -vw inet6 | grep -w inet | cut -d : -f 2 | cut -d \ -f 1
    Find list of IP address along with eth device and network mask:

    ifconfig | cut -d " " -f1,12,16 | grep -A 1 eth | tr -d - | tr -s "\n" |sed -e :a -e N -e 's/\n/ /'
    Know the performance of your HardDisk:

    change the device address as per your servers configuration

    hdparm -Tt /dev/sda
    The details of the present http connections can be found by using:

    netstat -plan | grep ":80 " | awk {'print $5'} |awk -F: {'print $1'}|sort
    cat /proc/net/ip_conntrack | grep "port=80" | wc -l
    Number of connection from perticular IP address:

    netstat -ntu | awk '{print $5}'| cut -d: -f1 | sort | uniq -c | sort -nr | more
    Only get the listing of directories:

    ls -F $1 | grep \/ | sed -e 's/\/$/4/g'
    Real Time Network Activity Examples:

    watch -d "netstat -nalp |grep -v DGRAM |grep -v STREAM |grep -v LISTEN"
    watch "netstat -nalp"|grep ":TCP PORT Number"
    watch "netstat -nalp"|grep ":22"

  2. #2
    Join Date
    Jan 2012
    Posts
    5

    Default

    Linux philosophy of “do only one thing, and do it good” works. However, this creates a massive forest of tools where even the most experienced users don’t know what each commando does so don’t despair.

  3. #3
    Join Date
    Feb 2012
    Posts
    4

    Default

    Linux is not so easy.....

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •