July 2014

unexpected !
Kali 1.0.8 is here !
The long awaited Kali Linux USB EFI boot support feature has been added to our binary ISO builds, which has prompted this early Kali Linux 1.0.8 release. This new feature simplifies getting Kali installed and running on more recent hardware which requires EFI as well as various Apple Macbooks Air and Retina models. Besides the addition of EFI support, there is a whole array of tool updates and fixes that have accumulated over the past couple of months.
Kali 1.0.8

So what we get more with this new Release ?
here is a list of the change and update

bc utility is surely one of the underdogs when it comes to calculations on command line.
It’s a feature rich utility that has its own fan base but needs time to get comfortable with
linux bc command calculations

  • bc is included with (almost?) all Linux distros as standard, as well as (again, almost?) all Unices.
  • Results from calculations in some proprietary flavours of bc have up to 99 decimal digits before and after the decimal point. This limit has been greatly surpassed in GNU bc. I don't know what that limit is, but it's at least many, many tens of thousands. Certainly it's more than any GUI-based calculators (I've used) could accomodate.
  • You may also find yourself working in an environment where you simply don't have access to a GUI.
  • The syntax for basic sums is almost identical to Google's calculator function, so you can learn how to use two utilities in one go!
bc is a preprocessor for dc. The useful thing about bc is that it accepts input from files and from standard input. This allows us to pipe data to it for quick calculations.

basename command in Kali Linux

basename command

Basename is a simple command which returns the file name string without any path info and it is mostly used in shell scripts.
It can also remove the file extension, and return only the file name without an extension.
The syntax of basename command is as follows,
basename String [ Suffix ]
basename OPTION string – input string Suffix – string needs to be removed from the input
-a, --multiple
support multiple arguments and treat each as a NAME.
-s, --suffix=SUFFIX
remove a trailing suffix SUFFIX, such as a file extension.
-z, --zero
separate output with NUL rather than a newline.
display help information and exit.
output version information and exit.
 basename /usr/bin/sort
 Outputs the string "sort". 

basename include/stdio.h .h
 Outputs the string "stdio".
basename -s .h include/stdio.h
 Outputs the string "stdio".
basename -a any/str1 any/str2
Outputs the string "str1" followed by the string "str2".

aspell linux command
what is aspell ?
it's a GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell.
It can either be used as a library or as an independent spell checker.
Its main feature is that it does a much better job of coming up with possible suggestions than just about any other spell checker out there for the Englishlanguage, including Ispell and Microsoft Word. It also has many other technical enhancements over Ispell such as using shared memory for dictionaries and intelligently handling personal dictionaries when more than one Aspell processis open at once.

Linux awk Command
what is awk Command ?
The basic function of awk is to search files for lines (or other units of text) that contain a pattern. When a line matches, awk performs a specific action on that line.
The Program statement that tells awk what to do; consists of a series of "rules". Each rule specifies one pattern to search for, and one action to perform when that pattern is found.
Linux awk Command

How to Use Awk to Find and Sort Text in Linux ?

What do you do?
In its simplest usage awk is meant for processing column-oriented text data, such as tables, presented to it on standard input. The variables $1, $2, and so forth are the contents of the first, second, etc. column of the current input line. For example, to print the second column of a file, you might use the following simple awk script:
[success title="awk Command" icon="check-circle"] awk < file '{ print $2 }' [/success] This means "on every line, print the second field".

To print the second and third columns, you might use
[success title="awk Command" icon="check-circle"] awk < file '{ print $2, $3 }' [/success]
Input separator
By default awk splits input lines into fields based on whitespace, that is, spaces and tabs. You can change this by using the -F option to awk and supplying another character. For instance, to print the home directories of all users on the system, you might do
[success title="awk Command" icon="check-circle"] awk < /etc/passwd -F: '{ print $6 }' [/success] since the password file has fields delimited by colons and the home directory is the 6th field.

Awk is a weakly typed language; variables can be either strings or numbers, depending on how they're referenced. All numbers are floating-point. So to implement the fahrenheit-to-celsius calculator, you might write
[success title="awk Command" icon="check-circle"]awk '{ print ($1-32)*(5/9) }'[/success]
which will convert fahrenheit temperatures provided on standard input to celsius until it gets an end-of-file.

The selection of operators is basically the same as in C, although some of C's wilder constructs do not work. String concatenation is accomplished simply by writing two string expressions next to each other. '+' is always addition. Thus
[success title="awk Command" icon="check-circle"] echo 5 4 | awk '{ print $1 + $2 }' [/success] prints 9, while
[success title="awk Command" icon="check-circle"]echo 5 4 | awk '{ print $1 $2 }'[/success]
prints 54. Note that
[success title="awk Command" icon="check-circle"] echo 5 4 | awk '{ print $1, $2 }' [/success] prints "5 4".

awk has some built-in variables that are automatically set; $1 and so on are examples of these. The other builtin variables that are useful for beginners are generally NF, which holds the number of fields in the current input line ($NF gives the last field), and $0, which holds the entire current input line.

You can make your own variables, with whatever names you like (except for reserved words in the awk language) just by using them. You do not have to declare variables. Variables that haven't been explicitly set to anything have the value "" as strings and 0 as numbers.

For example, the following code prints the average of all the numbers on each line:
[success title="awk Command" icon="check-circle"]awk '{ tot=0; for (i=1; i<=NF; i++) tot += $i; print tot/NF; }'[/success]
 Note the use of $i to retrieve the i'th variable, and the for loop, which works like in C. The reason tot is explicitly initialized at the beginning is that this code is run for every input line, and when starting work on the second line, tot will have the total value from the first line.
It might seem silly to do that. Probably, you have only one set of numbers to add up. Why not put each one on its own line? In order to do this you need to be able to print the results when you're done. The way you do this is like this:
[success title="awk Command" icon="check-circle"]awk '{ tot += $1; n += 1; }  END { print tot/n; }'[/success]
Note the use of two different block statements. The second one has END in front of it; this means to run the block once after all input has been processed. In fact, in general, you can put all kinds of things in front of a block, and the block will only run if they're satisfied. That is, you can say
[success title="awk Command" icon="check-circle"]awk ' $1==0 { print $2 }'[/success]    
which will print the second column for lines of input where the first column is 0. You can also supply regular expressions to match the whole line against:
[success title="awk Command" icon="check-circle"]awk ' /^test/ { print $2 }'[/success]  
If you put no expression, the block is run on every line of input. If multiple blocks have conditions that are true, they are all run. There is no particularly clean way I know of to get it to run exactly one of a bunch of possible blocks of code.

The block conditions BEGIN and END are special and are run before processing any input, and after processing all input, respectively.
Other language constructs
As hinted at above, awk supports loop and conditional statements like in C, that is, for, while, do/while, if, and if/else.
awk includes a printf statement that works essentially like C printf. This can be used when you want to format output neatly or combine things onto one line in more complex ways (print implicitly adds a newline; printf doesn't.)

Here's how you strip the first column off:
[success title="awk Command" icon="check-circle"]awk '{ for (i=2; i<=NF; i++) printf "%s ", $i; printf "\n"; }'[/success]    
Note the use of NF to iterate over all the fields and the use of printf to place newlines explicitly.
[success title="awk Command" icon="check-circle"]awk or gawk (gnu awk)[/success]
Find and Replace text, database sort/validate/index
[success title="Code" icon="check-circle"]awk <options> 'Program' Input-File1 Input-File2 ...

awk -f PROGRAM-FILE <options> Input-File1 Input-File2 ...[/success]

 -F FS
 --field-separator FS
     Use FS for the input field separator (the value of the `FS'
     predefined variable).
     Read the awk program source from the file PROGRAM-FILE, instead
     of from the first command line argument.
 -mf NNN
 -mr NNN
     The `f' flag sets the maximum number of fields, and the `r' flag
     sets the maximum record size.  These options are ignored by
     `gawk', since `gawk' has no predefined limits; they are only for
     compatibility with the Bell Labs research version of Unix awk.
 --assign VAR=VAL
     Assign the variable VAR the value VAL before program execution
 -W traditional
 -W compat
     Use compatibility mode, in which `gawk' extensions are turned off.
 -W lint
    Give warnings about dubious or non-portable awk constructs.
 -W lint-old
     Warn about constructs that are not available in the original
     Version 7 Unix version of awk.
 -W posix
     Use POSIX compatibility mode, in which `gawk' extensions are
     turned off and additional restrictions apply.
 -W re-interval
     Allow interval expressions, in regexps.
 --source PROGRAM-TEXT
     Use PROGRAM-TEXT as awk program source code.  This option allows
     mixing command line source code with source code from files, and is
     particularly useful for mixing command line programs with library
     Signal the end of options.  This is useful to allow further
     arguments to the awk program itself to start with a `-'.  This
     is mainly for consistency with POSIX argument parsing conventions.
     A series of patterns and actions: see below
     If no Input-File is specified then awk applies the Program to
     "standard input", (piped output of some other command or the terminal.
     Typed input will continue until end-of-file (typing `Control-d')

Author Name

{picture#YOUR_PROFILE_PICTURE_URL} YOUR_PROFILE_DESCRIPTION {facebook#https://www.facebook.com/wTsXDev} {twitter#https://twitter.com/wTsDev} {google#https://plus.google.com/u/0/+AnonSalame} {pinterest#https://www.pinterest.com/Thexwts/} {youtube#https://www.youtube.com/channel/UCg2fUa8Yp-aWDCJYQTVHmBg}

Contact Form


Email *

Message *

Powered by Blogger.