Check your session type – wayland or X11

With both wayland and X11 in mainstream, its pretty easy to forget if you are running in Wayland or in X11. To check this here are the commands:

loginctl list-sessions
# The above command will show you all the sessions. Note the session number for your session

loginctl show-session <session number> -p Type

Split pcap to multiple files based on number of packets

Here is a script that can use tshark to split a large pcap to multiple small pcaps

 

inpcap="test.pcap"

max=$(tshark  -r $inpcap -n -T fields -e frame.number|tail -1)

# This is the number of packets in each split pcap
c=1

# Save all new pcaps to out, if it does not exist, create it.
[[ ! -d out ]] && mkdir out

for i in $(seq 1 $max $c)
do
        tshark  -r $inpcap  -n -c $c "frame.number==$i" -w out/$i.pcap
        #Do other stuff, if required
        read -p "Send the next packet? "
done

A very simple 3-4 line script that has saved my day so may times.

libvirt- Create virtual machine with text console only interface

virt-install is an amazing tool to create VMs. If you have created a config file (Kickstart file – ks.cfg), then its only one line un-attended install. If you are using this on remote host with ssh and unluckily cannot export display – what do you do. Do a non-graphical install. There are only minor changes in the command to tell the installer that there is no graphics available and it is amazing, is it not 🙂

virt-install --name test --os-variant=centos7 \
--description "CentOS 7.5 VM" --extra-args \
"ks=ks7.5.cfg console=ttyS0,115200n8 serial" --graphics none --console pty,target_type=serial \
--ram 60240  --vcpus 23 --disk path=/tmp/vm.qcow2,bus=virtio,size=20 \
--location /centos.iso --os-type=linux --hvm --accelerate \
--noautoconsole --wait=-1

 

Especifically for the no-graphical installation, I have added the following:

console=ttyS0,115200n8 serial — in extra-args

–graphics none

–console pty,target_type=serial

 

These options will enable installing the VM in a Text install mode and thus saving your day.