ALL


  Differences between bashrc and profile in Linux

After login to a Linux system, the command console will show up with a prompt label such as # or ~, a shell command can be typed after this prompt and the system can execute the command thereafter. All these operations are handled by shell.Shell is a command language interpreter that executes commands read from the standard input device (keyboard) or from a file. There are different types of shells such as bash, ksh, csh etc. The most commonly used of them is bash and it's also the default one on most Linux distributions.There are two very important configuration files for bash : bas...

19,841 1       LINUX PROFILE BASH BASHRC .BASHRC .PROFILE


  bash network interface

Some of us may have seen /dev/tcp/<host>/<port> before, is this a special file system implemented in some BSD kernel? Because there is no /dev/tcp in Linux. Actually, this one is implemented in bash. We no need to rely on wget,nc to do network connection.It's very easy to use this interface:bash-4.2$ cat </dev/tcp/time.nist.gov/1356188 12-09-18 15:34:26 50 0 0 733.5 UTC(NIST) * bash-4.2$ exec 3<>/dev/tcp/www.w3.org/80bash-4.2$ echo -e "GET / HTTP/1.0\n\n" >&3bash-4.2$ cat <&3HTTP/1.1 200 OKDate: Tue, 18 Sep 2012 15:41:08 GMTServer: Apache/2Content-Location: H...

4,360 0       BASH NETWORK INTERFACE /DEV/TCP


  Concise bash programming skills

The following are some concise bash programming skills which we may need in our daily programming work.1. Check status of command execution The usual way:echo abcdee | grep -q abcd if [ $? -eq 0 ]; then echo "Found"else echo "Not found"fiConcise way:if echo abcdee | grep -q abc; then echo "Found"else echo "Not found"fiOf course you can remove if...else with following code[Sun Nov 04 05:58 AM] [kodango@devops] ~/workspace $ echo abcdee | grep -q abc && echo "Found" || echo "Not found"Found2. Redirect standard out and standard error to /dev/nullThe usual way:grep"abc" te...

10,399 2       TIP BASH SKILL


  Bash Shell Scripting - 10 Seconds Guide

This Bash shell scripting guide is not a detailed study but a quick reference to the BASH syntax. So lets begin...Common environment variablesPATH - Sets the search path for any executable command. Similar to the PATH variable in MSDOS.HOME - Home directory of the user.MAIL - Contains the path to the location where mail addressed to the user is stored. IFS - Contains a string of characters which are used as word seperators in the command line. The string normally consists of the space, tab and the newline characters. To see them you will have to do an octal dump as follows:$ echo $IFS | od -b...

3,923 0       TUTORIAL LINUX SHELL BASH 10 SECONDS SHORTCUT KEY


  Using vi key bindings in bash and zsh

Takeaway: If you prefer to use vi or vim for command-line editing, you can configure shells to use vi key bindings instead of emacs-style key bindings. Here’s how. By default, most shells use emacs-style key bindings for command-line editing and modification. For users of vi or vim, however, you can instead configure shells to use vi key bindings instead. This is done by editing ~/.bashrc in the case of bash, or ~/.zshrc in zsh and adding:set -o viin bash, and the following for zsh:bindkey -vOnce you have saved either ~/.bashrc or ~/.zs...

6,707 0       LINUX BASH VI ZSH KEY BINDING


  Useful Bash Scripts

Many people hack together shell scripts quickly to do simple tasks, but these soon take on a life of their own. Unfortunately shell scripts are full of subtle effects which result in scripts failing in unusual ways. It's possible to write scripts which minimise these problems. In this article, I explain several techniques for writing robust bash scripts. Use set -u How often have you written a script that broke because a variable wasn't set? I know I have, many ti...

8,871 0       LINUX COMMAND SHELL BASH ROBUST