AWK – By Example

Remove the columns $4 $5 $12 and $13. awk ‘BEGIN{FS=OFS=” “}{$4=$5=$12=$13=””}{print}’ file.txt Break down each line and numbers each field. awk ‘{print NR”: “$0; for(i=1;i<=NF;++i)print “\t”i”: “$i}’ Add list of numbers within a file. awk ‘{total+=$0}END{print total}’ file

Bash / Korn – Change the default session timeout

This short guide will show you how to set the default session timeout. We will set the TMOUT variable, of which is supported by both shells, Bash and Korn. To check your current timeout setting, enter the following, [root@localhost ~]# env | grep TMOUT To change this setting globally edit the /etc/bashrc. To change this … Read more

Netscreen – Console settings

In this article we will be looking at the various console commands available to us on the Juniper Netscreen. From entering the get command we can see the current console settings along with console session details, ns5gt-> get console Console timeout: 10(minute), Page size: 22/22, debug: buffer privilege 200, config has not been changed! ID … Read more

ffmpeg Commands

FFmpeg allows you to record, convert and stream digital audio and video in various formats. The installation guide can be found here Commands ffmpeg -i [source].flv -vn acodec copy [dest].mp3 Copy the sound of a video to an mp3 ffmpeg -i [source].avi -s 320×240 -b 1000k -vcodec wmv2 -ar 44100 -ab 56000 -ac 2 -y … Read more

Recursive ZIP command

This is a small command which will take each file in the directory that it is run in and zip the file and then remove the original. for i in `ls` ; do zip=$(echo $i | sed s/iso/iso”.”zip/) ; zip -r $zip $i && rm -fv $i ;  done

NSM – I`ve Forgotten / Lost my NSM Password

Have you lost, forgotten, misplaced the NSM password ?Below are the steps to reset your “super” account password, NSM 2006.x and below Log into the NSM via SSH as root Stop the NSM Server (you should be able to find the init scripts in /etc/init.d) Run the following command /usr/netscreen/GuiSvr/utils/.hashPasswd <new password>, you will receive … Read more

Check Point – How to Reset SIC

How do i reset SIC ?  Go into the CLI of the Firewall and type cpconfig then choose Secure Internal Communication. You will then be prompted to enter a passcode. Enter anything it doesnt matter. Then exit cpconfig using option 10. cpfw[admin]# cpconfig This program will let you re-configure your Check Point products configuration. Configuration … Read more

Linux – Creating a new Logical Volume / Partition

How do I create a new Logical Volume / Partition ? We will be creating a new logical volume named DATA and mounting this on a new directory called DATA. First of we will create the logical volume, then we will create a file system on the Logical Volume. Once complete we will create a … Read more

Logical Volume Manager

What is LVM ? LVM (Logical Volume Manager) for the Linux Kernel is a method of allocating hard drive space into logical volumes, this also allows for the easy creation, resizing, or removal of new or existing partitions. There are 4 main terms with LVM ….. physical volumes – These are your physical disks, or … Read more