Though this is a basic topic known to many of you, But I want to share so that some one will get new things.
BASH(Broune Again Shell) is the default shell in Linux, which will act as a communicator between Kernel and user. Its having so many capabilities such as
a.Short cuts
b.Command chaining
c.History
As I mention we will see all about BASH shell history capabilities here. And I have divided this BASH capabilities in to three parts like basics, medium and advanced.
Basic capabilities of BASH History:
1.To see all the commands what we executed previously
#history
2.To check the history size of your system
#echo $HISTSIZE
3.To check where is your history file, which stores all your previous commands
#echo $HISTFILE
4.To browse history.
Just press up/down arrow to browse history
5.To see all the commands which have particular word
#history | grep string
Example:
#history | grep cd
Medium capabilities of Bash history:
6.Some times browsing history is very tedious job and some times we are executing some big big commands so there is a capability in Bash to over come this ie search-i-reverse. For doing this press ctrl+r and type a string in previous command which you want to execute.
Lets see it with an example
root@krishna-laptop:~#(reverse-i-search)`se': service winbind restart
if you see above I just pressed ctrl+r and then started to type se, it is showing service winbind restart command, so I no need to type entire command and I have to justent press enter
root@krishna-laptop:~# service winbind restart
* Stopping the Winbind daemon winbind [ OK ]
* Starting the Winbind daemon winbind [ OK ]
root@krishna-laptop:~#
7.Changing the size of history. Most of the Linux machines by default it can store up to 500 previously executed commands. Some people likes to change it to some value, here i want to keep my previously executed 3000 commands.
#HISTSIZE=3000
8.to execute previous command
#!!
or
!-1
9.To execute 25 command in bash history
#!25
10.To execute a recent command which start with a string
#!string
11.To clear all the history
#HISTSIZE=0
or
#history –c
12.In Linux when we execute some command there will be no output of the command, for example useradd or mount -a commands will not give you output saying that command is executed successfully or not at that time we can used the below command to see whether the previous command is executed successfully or not
#echo $?
If the out put of the above command is "0", that indicates previous command executed successfully, for any other values the command is not executed successfully(total there are 256 values, 0-255).
Advanced capabilities of Bash history:
History Modifiersreferences:
http://linux.about.com/od/commands/l/blcmdl3_history.htm
http://www.linuxtopia.org/online_books/redhat_linux_debugging_with_gdb/using-history-interactively.html
http://docstore.mik.ua/orelly/linux/lnut/ch08_06.htm
http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/
Please comment your thoughts regarding this post:-)
BASH_History_Capabalities
2 comments 12/05/2009 08:29:00 AM Posted by Meghana M BhombhoreLabels: Basic-Commands, Basics
RHEL4 vs RHEL5
0 comments 12/05/2009 08:04:00 AM Posted by Meghana M BhombhoreMajor differences between RHEL4 & RHEL5
1.Virtualization added in RHEL5
2.Package installation method changed to YUM(Yellow-dog Updater Modifier) in RHEL5
3.Redhat Clustring added in RHEL5
4.RHEL5 now supports unlimited RAM and Hard disk
5.Now varients in RHEL5 are
* Red Hat Enterprise Linux Advanced Platform (former AS)
* Red Hat Enterprise Linux (former ES) (limited to 2 CPU-s)
* Red Hat Enterprise Linux Desktop with Workstation and Multi-OS option
* Red Hat Enterprise Linux Desktop with Workstation option (former WS)
* Red Hat Enterprise Linux Desktop with Multi-OS option
* Red Hat Enterprise Linux Desktop (former Desktop)
Where as in RHEL4
* Red Hat Enterprise Linux AS for mission-critical/enterprise computer systems
* Red Hat Enterprise Linux ES for supported network servers
* Red Hat Enterprise Linux WS for technical power-user desktops or high- performance computing
* Red Hat Desktop ΓÇô for multiple deployments of single-user desktops
Minor differences
1.Newer kernel(2.6.18)
2.Newer softwares packages
3.Office removed from Server edition
4.More Hardware support
5.By default netconfig command is not there, we have to install it manually
6.SELinux improved a lot in RHEL5
7.We have to provide key at the time of installation so that we can choose to install most of the packages such as Clustring/Virtualization.
8.Some of the commands changed like in LVM
References
https://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/release-notes/package-changes.html
http://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux
Please Comment your thoughts regarding this post:-)
How To Open Big Size File Using VI Editor?
0 comments 12/03/2009 07:44:00 AM Posted by Meghana M BhombhoreLabels: How-To's, Tutorials
How to Open/edit large files using VI?
Ans : Some time you will get message like file is too large to open with VI editor or some sort of other error messages like.
For Example : Warning: Tmp file too large
This doesn't mean that you don't have enough space to open the file in /var/tmp (this is default VI editor temp location). This is because VI is having limitation in opening big files which is more than 9070000 character or file of size 2GB.
This is a warning message you get from vi (i.e. the ex family of editors) that it can not track your changes in the temporary files, the editor maintains during an edit session. So when ever using VI editor remember following things(These are from VI editor manual).
1.If the editor crashes (i.e. system halts, or accidental process termination), a preserve file cannot be created and you will not be able to recover your changes via the recover feature(vi -r filename is used to recover a file from .swp file).
2.In addition, while editing a very large files and vi fails to come up in visual mode, do not write this file (:w) since it may be truncated/crashed. You should quit (:q!) and open the file with csplit utility to divide the big file into smaller smaller files and edit(I dont suggest this as it is very much advanced to normal users).
3.To open files less than 2GB use following procedure
Step1 : Just execute vi command with out any file
#vi
Step2 :
In the command mode,
type :set directory="any directory with enough free space"
Step3 :
Now open the file using
:e "file name"
Through this way we can avaoid vi crashing.
Some utilities which is used to view large files are.
a.cat filename more
b.tail filename
c.head filename
d.more filename
e.less filename
To open a file at desired line
head -n filname tail -1
Please comment your thoughts regarding this post:-)