Bash/shell history autocompletion!

by adding this lines:
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
in .bashrc (debian, ubuntu ..etc) can with ^ auto complete typed commands as user or root. but in archlinux just work for user mode not as root.
maybe the arch have another .rc file not .bashrc!?
best regards

matzo wrote:
Just create the file  '.inputrc' with the following content:
"\e[A":history-search-backward
"\e[B":history-search-forward
Just as I remember it is necessary to also create a file '.bash_profile' with following content
. $HOME/.bashrc
Thus, the '.bashrc' should be interpreted for user root.
.bash_profile is already created as default, srry, doesn't work as root too

Similar Messages

  • Bash shell's .bash_history file

    In a Bash shell .bash_history file is generated.
    How we can modify the settings so as to get timestamp in .bash_history?
    Regards
    Ritesh
    Edited by: riteshumrawala on Jun 30, 2008 1:27 PM

    Exit bash shell and start a new one. history on command line should show timestamps. I have timestamps in my .bash_history file, but they are not formatting properly.
    #echo $HISTTIMEFORMAT
    #%D:%T
    #echo $0
    #bash
    #history
    1 07/03/08:13:13:52env
    2 07/03/08:13:14:23env
    3 07/03/08:13:14:29ls -la
    4 07/03/08:13:14:31pwd
    5 07/03/08:13:14:40find / -name profile
    6 07/03/08:13:14:58ls -la
    7 07/03/08:13:15:04ls -latr
    8 07/03/08:13:15:15cat .bash_history
    9 07/03/08:13:15:38echo $0
    10 07/03/08:13:15:39ls -la
    11 07/03/08:13:15:45cat .bash_history
    #cat .bash_history
    #1215105232
    env
    #1215105263
    env
    #1215105269
    ls -la
    #1215105271
    pwd
    #1215105280
    find / -name profile
    #1215105298
    ls -la
    #1215105304
    ls -latr
    #1215105315
    cat .bash_history
    #1215105338
    echo $0
    #1215105339
    ls -la
    #1215105345
    cat .bash_history
    Not sure why the cryptic timestamp in .bash_history
    john

  • How to invoke BASH shell and execute a command in that shell in Windows 98

    Hello, I have a problem and if somebody will help me, I will be very glad. Thank you.
    I am using BASH shell on Windows 98 OS by means of CYGWIN. And I want to invoke this BASH shell and execute a preprogrammed command in the shell (./scan fileName.txt) from a JAVA program. But so far, I am not sucessful. I can not read or write anything from / to BASH shell. It either blocks and freezes (When I use waitFor( ) ) or appears and disappears without executing scan command (When I do not use waitFor( ) ). My code is like this:
    // This method is used for compiling a file.
    // It invokes BASH shell and executes "./scan fileName.txt" command
    public void compileFileMethod () {
    try {
    Process proc = ( Runtime.getRuntime() ).exec ("C:\\MyDocuments\\CYGWIN.BAT); //I also tried to add -c ./scan fileName.txt after .BAT );
    // I also tried to write "C:\\MyDocuments\\BASH.EXE" but it did not help
    OutputStream ostr = proc.getOutputStream();
    BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter (ostr) );
    InputStream istr = proc.getInputStream();
    BufferedReader br = new BufferedReader ( new InputStreamReader (istr) );
    InputStream errorStr = proc.getErrorStream();
    BufferedReader errorBr = new BufferedReader ( new InputStreamReader (errorStr) );
    bw.write("scan case40.10.txt"); /* I am trying to input the scan command to the shell,but it is not working*/
    bw.flush();
    Vector list = new Vector (1) ;
    String str;
    while ( (str = br.readLine() ) != null) {
    list.addElement(str);
    } // End of while
    Enumeration enumForList = list.elements();
    while ( enumForList.hasMoreElements() ) {
    String tempString;
    tempString = ( String ) enumForList.nextElement();
    System.out.println(tempString); // I am trying to read the outputs of the scan command but it is not reading (I can not see any output)
    I tried with and without waitFor( ), it did not work
    // wait for command to terminate
    proc.waitFor();
    // close streams
    br.close();
    bw.close();
    errorBr.close();
    } // End of try
    catch ( IOException ioe ) {
    JOptionPane.showMessageDialog (null, "Input / output error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    } // End of catch
    catch ( SecurityException se ) {
    JOptionPane.showMessageDialog (null, "Security error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    catch ( InterruptedException ie ) {
    JOptionPane.showMessageDialog (null, "Interruption error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    } // End of method compileFileMethod
    // Thank you for your helps and time.

    You cannot invoke BAT files directly, you have to invoke the program that run those files which is your Windows 98 shell. For example (under windows 2000), i would invoke "cmd.exe sricpt.bat some args", rather than "script.bar some args".
    Hope this will help you out.

  • Bash shell for  sid adm and ora sid user

    I'm planning to make bash shell as the the default shell for my <sid>adm and ora<sid> user. Will there any issues? It seems harmless.
    My current setups are ECC6 on top of  AIX 5.3 and Oracle 10g
    regards,
    Marjan

    The only problem is permission of user access to that bash shell. as well as what u u want to run i mean to say if it is any haevy erport or update insert or refresh functionality then do not run at the time of haevy load.
    Thanks

  • Where can I find the LOG file for bash/command history typed into Terminal?

    Where can I find the LOG file for bash/command history typed into Terminal?
    For 2 weeks ago I was searching for a log file on my server. Somehow I opend a file where I could see a list of all bash-commands I had ever entered into OSX Terminal.
    Now I need this file.. but cant find it.
    What is the official location for this LOG file?
    Thank you so much for helping.

    cat .bash_history

  • History autocomplete not working

    just updated the browser to the most recent release. my history autocomplete is not working and i cannot scroll down the location bar to see the sites i have visited. i have my privacy settings set to remember my bookmarks and history, just want to know what i can do about this issue? i had gotten used to only typing a few letters to reach my most visited sites. thanks

    Same problem here. I have Firefox on several machines and OS (XP and Ubuntu [edit: Win 7 too]). However, the bookmarks file is the same in each.
    None of the location bars suggest (autocomplete) features work now. I tried deleting the places.sqlite (bookmarks) file and the bar began working again, but all my bookmarks had lost their "[http://en.wikipedia.org/wiki/Favicon favicons]". When I replaced that places.sqlite file with my original (including the favicons) the location bar again ceased working.
    I highly doubt that the upgrade to 3.6.11 would corrupt every places.sqlite file I have on multiple computers. That leads me to believe that there is some kind of bug in 3.6.11 that messes up the location bar (especially if your bookmarks contain favicons). Hope some kind of patch can be found.
    Edit: Just updated Firefox on Windows 7 with same results. I even backed up the places.sqlite (so it could not be corrupted) file before updating then used the backup file when the location bar failed to work. Even restoring with the backup file didn't work - again, this can not be due to a corruption issue.
    Finally, I noticed that one (only one) of the autocomplete bookmarks I had selected prior to updating FF in Ubuntu was actually retained. Is there some other file where autocomplete data is held? I wish I knew why that one bookmark is still able autocomplete while all the others will not (note: this is only in the Ubuntu install all other FF installs (in XP/Win7) bookmarks will not autocomplete.

  • DIsplay variable setting ReflectionX in Bash shell

    Everyone,
    Can somebody help me with setting display variable for running Configtool in ReflectoinX in Bash shell.
    Appreciate your time. Thanks.

    > It looks like it will work..only thing is that we need to set display variable..i assume.
    If you logon as <sid>adm then no DISPLAY (or other variable) must be set if you use XDMCP.
    > I am doing sudo for opening a java tool which needs x window..other x windows like visual admin is working fine but for configtool, i am getting this error saying display variable is not set.
    That's what I was saying - do not switch users (sudo, su etc.) - that will delete the environment and invalidate .Xauthority.
    > I am not given the <sid>adm password, can i just use X window with sudo OR do i need to get the <sid>adm password to start the configtool..
    In that case I would not use XCMCP to connect but a pure telnet, do sudo and then set the DISPLAY to
    <your-IP>:<reflection-display>. the latter can be found when open Reflection in the lower part of the configuration window.
    Markus

  • Cisco ASA 5545-X Running Bash shell service???

    Hi,
    May I check whether if currently Cisco ASA 5545-X is having/using Bash shell service?
    If yes, how can I disable the service?
    Thks and Rgds

    Please reference this link
    http://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20140926-bash
    As per Cisco, ASA not effected, but as a precaution, eliminate if not limit ssh/htpps connections to authorized hosts until browser patches have been distributed. 

  • Any tips on Controlling interactive bash shell on Cygwin via Java process?

    Ideally, I'd like to be able to control an interactive bash shell on Cygwin from a Java process. But for starters, I want to do 'ls > /cygdrive/c/fred.txt'. The little program to do this, below, doesn't work. It simply runs without error.
    Any ideas? And also, any tips on doing a fully interactive shell?
    --> Java program to test simple command:
    package com.treelogic_swe.real_estate_explorer.utils;
    import java.io.File;
    import java.io.InputStream;
    * Quick and dirty test of Java to Cygwin bash shell process control.
    * Thanks to [email protected]
    * re: http://groups.google.com/group/comp.lang.java.help/browse_thread/thread/914403fbdd1de127/40363d2e7cbae823?lnk=st&q=cygwin+shell+java+process+runtime&rnum=1&hl=en#40363d2e7cbae823
    public class RunSystemCommand {   
        public static void main(String args[]) throws Throwable {
         // System command to run
         String cmd = "ls > /cygdrive/c/fred.txt";
            String [] sysArgs = { };
         // Set the working directory for the OS command processor
         File workDir = new File( "c:/cygwin/bin" );
         Process bash = Runtime.getRuntime().exec( cmd, sysArgs, workDir );
         InputStream bashIn = bash.getInputStream();
         while( bashIn.read() != -1 ); // Added, as otherwise the ls hangs.
         bash.waitFor();
    }

    Ideally, I'd like to be able to control an
    interactive bash shell on Cygwin
    What do you mean by this? Do you just want to start a bash shell, and have it's input and output come from and go to your Java program?
    Please be specific about what you want, as there are a couple of interpretations for what you said. You need to understand the differences and relationships among terminals, shells, shell builtins, and executables.
    You'll want to read this:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    from a Java
    process. But for starters, I want to do 'ls >
    /cygdrive/c/fred.txt'. The little program to do
    this, below, doesn't work. It simply runs without
    error.
    , <, |, and others are specific to the shell. When you're in a terminal, and you type ls > /tmp/zzz, it's the bash shell that interprets the >. Cygwin doesn't know anything about it. ls doesn't know anything about it.So if you want to to that, the command you'd execute from Java is not ls, but bash (or some other shell). You'd then tell bash to execute the rest. I'm not sure what the command line arg is for bash to tell it the rest of the command line args are a command that bash should interpret and execute. I think it might be -c like it is for zsh. So you'd need to do something like Runtie.getRuntime().exec("bash -c 'ls > /tmp/zzz'");

  • Bash shell

    hi,
    in my solaris 9 (sparc) i am using the sh shell. i like to upgrade to the bash shell.
    please guide me on how can i do this? i m a newbie on solaris 9.
    thanks.

    Yes, it is included, just as bubbwe has noted.
    You would need to have installed the Developer Cluster or more.
    Core Cluster does not include it..
    Here's a link to the cluster contents in the Sun System Handbook.
    http://sunsolve.sun.com/handbook_pub/Software/Solaris_Ref/Solaris_9/clusterchart.html

  • Problems customizing bash shell

    I am trying to add some customizing environment and aliases to my bash shell but cannot seem to get the .bash_profile file to be recognized when I open a xterm. I can source the file and get it loaded but would rather it be automatic. Any suggestions?
    G4, G5   Mac OS X (10.3.9)  

    I found a post in another area explaining that X11 is invoked as a non-shell start and therefore reads .bashrc and not .bash_profile. Moved my commands to that file and everything works.

  • Bash shell does not recognise 'java', 'javac' commands (Linux command line)

    i' ve used javac and java compile & execute commands to build the same application on the DOS command line with Windows - no problem.
    But when I try to compile the same file on the command line under Linux Redhat (7.1) using Bash shell i get <bash: javac: command not found> and <bash: java: command not found>.
    In both cases I'm using j2sdk1.4.2 downloaded from java.sun.com for Windows & Linux respectively.
    I make sure I have both the javac and the file I want to compile in the same directory ../j2sdk1.4.2/bin for both the Windows and the Linux applications.
    Is there something I need to do to get bash to recognise javac, java etc? Is there a different setup procedure?
    Any angles on this are much appreciated ..

    Have you tried these correctly..
    Set the CLASSPATH environment variable to include whichever directories you like, eg (on bash) type:
    export CLASSPATH=$CLASSPATH:.:<your java dirs>
    To make java easier to run, put the directory in which it is installed into your path:
    export JAVA_HOME=<where you installed java>
    Then do
    export PATH=$PATH:$JAVA_HOME/bin
    verify it has worked by simply typing
    java
    You can put all of these commands into the .*rc file for your shell, so that they are executed every time you open the shell. So if you are using bash you can put them into ~/.bashrc
    Read up setting the PATH and CLASSPATH for more info.
    This shall resolve the issue .

  • Problem with running Bash shell scripts

    I am unable to run Bash shell scripts on the UNIX Terminal application.
    This is the transcript from the Terminal application.
    Zhi-Yang-Ongs-Computer:/Applications/MetaPost/metapost-1.102 zhiyangong$ ./test1.sh
    dyld: Symbol not found: _BC
    Referenced from: /usr/local/bin/bash
    Expected in: /usr/lib/libSystem.B.dylib
    Trace/BPT trap
    Zhi-Yang-Ongs-Computer:/Applications/MetaPost/metapost-1.102 zhiyangong$
    Is this a problem with the the default installation of the Bash shell? Can I install the Bash shell on my own? If so, how can I do that?
    Also, how can I get the dynamic linker, dyld, to refer to the symbol "_BC"? What does this symbol "_BC" refer to?

    This was in your posted output:
    /usr/local/bin/bash
    You are NOT running the default bash, you are trying to run a private copy.
    The default Mac OS X bash is located at
    /bin/bash
    Try the following:
    /bin/bash ./test1.sh
    Does that work?
    What is the first line of your script? Is it:
    #!/bin/bash
    Or maybe
    #!/usr/bin/env bash
    /usr/bin/env would find the first bash in PATH . I find this most useful for finding perl on different systems, but sh, ksh, bash, zsh, csh, tcsh are all generally found in /bin so I do not bother using /usr/bin/env
    And if you have
    #!/usr/local/bin/bash
    Then the person that wrote test1.sh choose to use something besides the default bash
    Or maybe this script was transferred from some system where you needed to put your own copy of bash in /usr/local/bin because the vendor does not distribute bash
    Then again, you have not showed us what is inside your script, so it is possible something in the script called something else which invoked the /usr/local/bin/bash
    If that is the case, then you might try:
    /bin/bash -x ./test1.sh
    which should show you the commands executed before it died.

  • AppleScript: How to let AppleScript use the same environment as Bash shell does?

    Howdy!
    I can run AppleScript from Bash shell.
    I can also run Bash shell from AppleScript.
    So my question is when I run a Bash shell script from AppleScript, I am hit with a path problem.
    Suppose my AppleScript is under ~user/a.scpt. I want my AppleScript to know its current path (i.e. ~user/a.scpt).
    So a quick snippet test in my AppleScript shows that AppleScript always begins from the root directory:
    do shell script "pwd"
    So let's do a workaround AppleScript like this:
    tell application "Finder" to set currentDir to (target of front Finder window) as text
    do shell script "cd " & (quoted form of POSIX path of currentDir) & "; pwd"
    This works. However, this approach poses a potential danger.
    Suppose when I run this AppleScript for a bash script, I inadvertently clicked other Finder Window. That would result in execution of bash script in that newly clicked Finder Window, resulting in a big mess.
    Is there a better way to let the AppleScript to know its current path?

    The following is what your Applescript environment looks like, so plan accordingly.  If you want your Applescripts to be portable to other user environments, you should NOT depend on your environment, but rather embed all the environment knowledge you need into your script.
    Applescript "do shell script" environment
    pwd:
    /bin/ls -dlaeO@ .
    drwxr-xr-x  36 root  wheel  - 1292 Feb 28 09:58 .
        /usr/bin/id -a
    uid=501(raharris)
    gid=20(staff)
    groups=20(staff),
    402(com.apple.sharepoint.group.1),
    12(everyone),
    61(localaccounts),
    79(_appserverusr),
    80(admin),
    81(_appserveradm),
    98(_lpadmin),
    403(com.apple.sharepoint.group.2),
    33(_appstore),
    100(_lpoperator),
    204(_developer),
    398(com.apple.access_screensharing),
    399(com.apple.access_ssh)
    $#
    0
    $0
    /path/to/your/shell/script
    printenv:      
    SHELL=/bin/bash
    TMPDIR=/var/folders/4t/t1djbq6j5pj951x44l9hwxtc0000gn/T/
    Apple_PubSub_Socket_Render=/tmp/launch-mSKKJo/Render
    USER=<username_running_the_Applescript>
    SSH_AUTH_SOCK=/tmp/launch-7D4zpF/Listeners
    __CF_USER_TEXT_ENCODING=0x1F5:0:0
    PATH=/usr/bin:/bin:/usr/sbin:/sbin
    __CHECKFIX1436934=1
    PWD=/
    HOME=/Users/<home_dir_of_running_user>
    SHLVL=2
    LOGNAME=<username_running_the_Applescript>
    DISPLAY=/tmp/launch-qKucki/org.macosforge.xquartz:0
    _=/usr/bin/printenv
    Message was edited by: BobHarris

  • Invoking a bash shell script from Java code

    Hi All
    I am trying to invoke a Bash shell script using java code. The arguments required are "source wmGenPatch <source dir> <destination dir> no_reverse.
    in the code I have specified the arguments considering the cannonical paths of the files as the code may run on Unix or windows platform.
    I am getting a error while invoking Runtime.getRuntime().exec(args). The error is as follows :
    "The Error Occurred is: CreateProcess: source D:\Package4.0\workspace\DiffEngineScripts\v4a02\wmGenPatch D:\Package4.0\workspace\fromImageFilesDir\ D:\Package4.0\workspace\toImageFilesDir\ no_reverse error=2"
    It seems that error=2 indicates that the 'file not found' exception. But i can see the directories referred to in the error at place in the workspace.
    Kindly advice.
    Thanks in advance.

    Hi All
    I am pretty new to invoking bash shell scripts from java and not sure if i am progressing in right direction.
    The piece of code tried by me is as follows
    try {
                   currentDir = f.getCanonicalPath();
              } catch (IOException e) {
              if (currentDir.contains("/")) {
                   separator = "/";
              } else {
                   separator = "\\";
              String args[] = new String[7];
              args[0] = "/bin/sh";
              args[1] = "-c";
              args[2] = "source";
              args[3] = currentDir + separator + "DiffEngineScripts" + separator
                        + "v4a02" + separator + "wmGenPatch";
              args[4] = sourceFileAdd;
              args[5] = destFileAdd;
              if (isReverseDeltaRequired) {
                   args[6] = "reverse";
              } else {
                   args[6] = "no_reverse";
              try {
                   Process xyz = Runtime.getRuntime().exec(args);                              
                   InputStream result = xyz.getInputStream();
                   InputStreamReader isr = new InputStreamReader(result);
                   BufferedReader br = new BufferedReader(isr);
                   String line = null;
                   while ( (line = br.readLine()) != null)
                        System.out.println(line);
                   int exitVal = xyz.waitFor();
                   System.out.println("Leaving Testrun.java");
              } catch (Throwable t) {
                   t.printStackTrace();               
    and on running the same i am getting Java.io.IOException with the stack trace
    java.io.IOException: CreateProcess: \bin\sh -c source D:\Package4.0\workspace\DiffEngineScripts\v4a02\wmGenPatch D:\Package4.0\workspace\fromImageFilesDir\ D:\Package4.0\workspace\toImageFilesDir\ no_reverse error=3
    kindly advice
    Thanks in advance

Maybe you are looking for

  • ISE 1.2 to 1.3 upgrade

    I have ISE 1.2 running would advise if we can update to ISE 1.3.I came to know that we have licensing change in 1.3 do i need to buy new license or how is it going to work. Are their any major bug in ISE 1.3 (do want any issues, my 1.2 is stable)

  • My Time Machine external hard drive is not recognised anymore under 10.9.1

    Hi, I am running 10.9.1 on my MBP13" mid 2010. I plugged in my external hard drive (Western Digital Elements 500GB portable drive) and it is no longer recognised. This has been going on for a couple of weeks. TM says its not connected. Icon not on de

  • Automatic Payment programme - exclusion based on profit center.

    Hi Forum Member, I am having a Vendor supplying to different Profit centers. My requirement is to run Automatic payment programme based on Profit center i.e: all overdue of one profit center to be paid through specified House Bank of said Profit cent

  • SSIS 2008 Logging - SSIS Log Provider for SQL Server

    Simple SSIS package - copies a table from Server A to Server B. Everything works except logging using SSIS Log Provider for SQL Server. Selecting the similar events to using SSIS Log Provider for Text Files does generates a file on the server. I spec

  • Problems calling image on J2ME mobile phone screen

    I have an image size (160kb) of certain size and width. I am calling this image onto a mobile phone screen (j2me) and upon calling this image, I am getting OutOfMemoryException. Sometimes, I do get the partial image displayed on the phone screen. My