-b Display the block number at the beginning of each line. -c Display the number of matched lines. -h Display the matched lines, but do not display the filenames. -i Ignore case sensitivity. -l Display the filenames, but do not display the matched lines. -n Display the matched lines and their line numbers. -s Silent mode. -v Display all lines that do NOT match. -w Match whole word.
Here Some of the examples for using Grep
1)How to Search a Given word in a single File
grep "String_name" filename
2)How to Search a String in Multiple File
grep "string" FILE_PATTERN
The Above example will used to search the string in multiple files.For Example,We have 2 text files named as textfile1 and textfile2.
Now the following command will use to search the string in these two text files
grep "search_string" text*
3)How will do Case insensitive search
Using -i option you can do the case insensitive search.
grep -i "string" Filename
4)How search a string in recursively
Using -r option will do the recursive search.
grep -r "string" *
5)How to count the number of Matches
Using -c option you can count the number of matches.
wget utility is the best option to download files from internet. wget can pretty much handle all complex download situations including large file downloads, recursive downloads, non-interactive downloads, multiple file downloads etc.
Some of the examples for how to download using wget
nano is a text editor for Unix-like computing systems or operating environments using a command line interface. It emulates the Pico text editor, part of the Pine email client, and also provides additional functionality.
GNU nano is a small and friendly text editor. Besides basic text editing, nano offers many extra features like an interactive search and replace, go to line and column number, auto-indentation, feature toggles, internationalization support, and filename tab completion.
Nano has a pseudo-graphical layout that makes it a little easier to jump right into.
Command for Starting nano editor
Command line Options
Start at line number LINE and column number COLUMN (at least one of which must be specified) instead of the default of line 1, column 1.
Same as -h, --help. -A, --smarthome
Make the Home key smarter. When Home is pressed anywhere but at the very beginning of non-whitespace characters on a line, the cursor will jump to that beginning (either forwards or backwards). If the cursor is already at that position, it will jump to the true beginning of the line. -B, --backup
When saving a file, back up the previous version of it to the current filename suffixed with a ~. -C , --backupdir=
Set the directory where nano puts unique backup files if file backups are enabled. -D, --boldtext
Use bold text instead of reverse video text. -E, --tabstospaces
Convert typed tabs to spaces. -F, --multibuffer
Enable multiple file buffers, if available. -H, --historylog
Log search and replace strings to ~/.nano_history, so they can be retrieved in later sessions, if nanorc support is available. -I, --ignorercfiles
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is available. -K, --rebindkeypad
Interpret the numeric keypad keys so that they all work properly. You should only need to use this option if they don't, as mouse support won't work properly with this option enabled. -L, --nonewlines
Don't add newlines to the ends of files. -N, --noconvert
Don't convert files from DOS/Mac format. -O, --morespace
Use the blank line below the titlebar as extra editing space.
In Unix, the shell is a program that interprets commands and acts as an intermediary between the user and the inner workings of the operating system.
It is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems.
It makes basic facilities such as multitasking and piping easy to use, and it adds useful file-specific features such as wildcards and I/O redirection.
The prompt, $, which is called command prompt, is issued by the shell. While the prompt is displayed, you can type a command.
The shell reads your input after you press Enter. It determines the command you want executed by looking at the first word of your input. A word is an unbroken set of characters. Spaces and tabs separate words.
Mon Sep 8 14:03:04 UTC 2014
Types of Shell
There are four common shells in use:
· the Bourne shell
· the Korn shell
· the C shell
· the Bash shell (Bourne Again Shell)
Reletionship Diagram for above four shells
SELECTING A SHELL
When you are provided with a UNIX account,the system administrator chooses a shell for you.
To find out which shell was chosen for you, look at your prompt.
If you have a $ prompt, you’re probably in a Bash, Bourne or a Korn shell.
If you have a % prompt, you’re probably in a C shell.
chsh is the utilitity which allows you to change your default login shell.
It prompts you for the full pathname of the new shell,which is then used as your shell for subsequent logins.
In order to use chsh, you must know the full pathnames of the three shells.
Here they are: Bourne/bin/sh Bash/bin/bash Korn/bin/ksh C/bin/csh