Category Archives: Linux (Ubuntu/CentOS)

Syslog Configuration (IOS/ASA/Palo/Linux)

How to set up Syslog


Commands to check memory (RAM) on linux (Microchunks)

Script to grab all the domain groups for a user on a Linux system with Active Directory connection






#Reseting String storage veribles




echo “command line to usergroup checker

please supply the domain you wish to check”

read DOM

DOMAIN=$(echo $DOM | tr [a-z] [A-Z])


echo “What username do you wish to list groups for?”



USERSID=$(WINBINDD_SOCKET_DIR=/var/samba/$DOMAIN/ wbinfo –name-to-sid=$USERNAME &> $USIDTEMP)

echo “check Remote Proceedure Call (RPC) connection to domain”

echo ” “

WINBINDD_SOCKET_DIR=/var/samba/$DOMAIN/ wbinfo -t

echo ” “

echo “———————————————————“

echo ” “

echo “Current Domain Controller Bound To”

echo ” “

WINBINDD_SOCKET_DIR=/var/samba/$DOMAIN/ wbinfo –dc-info=$DOMAIN

echo ” “

echo “———————————————————“

echo ” “

echo “Check All List Domain In $DOMAIN current Status: “

echo ” “

WINBINDD_SOCKET_DIR=/var/samba/$DOMAIN/ wbinfo –online-status

echo ” “

echo “———————————————————“

echo ” “

echo ” “

#Save the username sid to a tmp file

WINBINDD_SOCKET_DIR=/var/samba/$DOMAIN/ wbinfo –name-to-sid=$USERNAME &> $USIDTEMP

#Read in the USID

cat $USIDTEMP | while read LINE


USERSID=$(echo $LINE | gawk ‘{print $1}’)

echo ” “

echo “Groups found for $USERNAME are:”

echo ” “

GROUPSID=$(WINBINDD_SOCKET_DIR=/var/samba/$DOMAIN/ wbinfo –user-sids=$USERSID &> $GSIDTEMP )

cat $GSIDTEMP | while read GLINE



TEST=$(WINBINDD_SOCKET_DIR=/var/samba/$DOMAIN/ wbinfo –sid-to-name=$GLINE &> $NAMETEMP)

cat $NAMETEMP | gawk ‘BEGIN{FS=”\\”}{print $1″,”$2}’ | while read NLINE


T=$(echo $NLINE | rev | cut -c1)

if [ $T = 2 ]; then

echo $NLINE | gawk ‘BEGIN{FS=”,”}{print $1″\\”$2}’|sed ‘s/.$//’





Common Linux Commands


#ping -I ethF (from a particular source interface)


#/sbin/ifconfig (all active network interfaces and some interface statistics)(add or change IP addresses)

# ifconfig -a

# ip addr

#setup (to change the default interface or changing the interface IPs etc)


#clear (to clear the screen)

#ip neigh flush all (clear arp cache)


#dig (just like nslookup in windows)


#route -n (or route (to print the routing table in linux)

#route add default gw eth0 (to add a default route)

#route add -net netmask gw

#route del -net netmask gw

To add a route on the windows machine to force route the traffic through a particular gateway when two connections are connected on it

c:/>route ADD “network” MASK “subnet mask” “gateway ip”

c:/>route ADD MASK


c:/>route ADD MASK

To check interface errors

# /sbin/ifconfig

#netstat -i

#netstat -s

To mount a USB under the linux shell (USB should be in FAT32 and it should the first partition as FAT32)

#tail -f /var/log/messages-2014-10-23 (to see which directory it is read as e.g. /dev/sdb1 , once plugged in)

#cat /proc/partitions (to see which /dev/ directory it is plugged into) or #fdisk -l

#mkdir /tmp/usb (create a mount point)

#mount /dev/sdb1 /tmp/usb

#cp /var/archive/backup123. /tmp/usb

#unmount /tmp/usb

System information commands

#vmstat (summary information for system load and usage, but does not show individual processes)

#ps aux (display all processes running on the Linux system)(to search for specific processes or list them all)

#ps aux | grep auth (all the processes that have auth in them)

#ps auxf | sort -nr -k 4 | head -10 (shows the top 10 memory consuming processes)

#cat /proc/cpuinfo (lot of information about the system and the hardware associated)

#cat /proc/meminfo (information on memory and memory usage)

#cat /proc/mounts (various file systems and where they are mounted and which options have been used)

#df -h (Show a summary of disk usage and some useful key combinations Keyboard Combinations SHIFT + PAGE UP scroll up the screen CTRL + C stop a running command eg ping)

To see the load average and the uptime ona Linux system



#watch -n 1 uptime

iftop to monitor traffic bandwidth usage

iftop -i ethF

iftop -i ethF -f “dst host”

iftop -i ethF -f “dst host”