[TIP] Use vi keys for CLI history and editing

I randomly discovered this when reading documentation about GNU Screen, and thought it was awesome!  By default bash (and I believe other shells too) use some emacs like commands for movement: <code>CONTROL-A</code> to move the cursor to the begining of the line, and <code>CONTROL-E</code> to move the cursor to the end of the line, etc.
You can change that behavior to more closely mimic the movements and commands in Vi by issuing the command:
$ set -o vi
If you just want to see what your current settings are, leave off the <code>vi</code> part.
$ set -o
allexport off
braceexpand on
emacs off
errexit off
hashall on
histexpand on
history on
ignoreeof off
interactive-comments on
keyword off
monitor on
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
posix off
privileged off
verbose off
vi on
xtrace off
Then you can hit the <code><ESCAPE></code> key to enter the command-editing mode.  Then try out using the "<code>h j k l</code>" movement keys to navigation through the command history.  You can also use other Vi movement commands to edit the line.  If you want to go back to typing, use the typical "<code>i I a A</code>" keys to either Insert or Append as expected.  To make this change permanent, just add the "<code>set -o vi</code>" command in your <code>~/.bashrc</code> file.
Anyway, after messing around with it for a bit, I think it will make my command-line usage much more efficient.  Hope this appeals to somebody else out there...

I also forgot, you can use Vi commands to skip to items from your history as well.  If you view your history:
$ history
377 ps aux | grep firefox
378 sudo pacman -Syu
379 exit
380 startx
381 startx
382 sudo pacman -Syu
383 less /etc/ntp.conf
384 sudo vim /etc/pacman.conf
385 sudo pacman -Syu
...and say you want to run "<code>ps aux | grep firefox</code>", you can just type <code><ESCAPE></code> to enter command-editing mode, put in the line number you want: <code>377</code>, and then hit '<code>G</code>' to go there.  There are all sorts of cool things I'm figuring out...

Similar Messages

  • By default, on a mac keyboard F3 lets you see all the open apps and the such. However, I changed it so that I use those keys for keyboard shortcuts; But i'd like the normal F3 key to still work without me having to press FN.

    By default, on a mac keyboard F3 lets you see all the open apps and the such. However, I changed it so that I use those keys for keyboard shortcuts; But i'd like the normal F3 key to still work without me having to press FN.

    rajlego,
    in the Keyboard pane of System Preferences, select the Shortcuts tab, and then select Mission Control on the left-hand side. On the right-hand side, make sure that the Mission Control checkbox is checked, double-click on its current key combination (by default “^↑”) so that the key combination is highlighted, and then press the F3 button — that will set its shortcut to be F3. You can now press F3 to bring up Mission Control without needing to also press the Fn button.

  • I have the key for office home and business, can anyone advise how to use it to install office on mac

    I have the key for office home and business, can anyone advise how to use it to install office on mac

    Install the software. The first time you use it you will be prompted to enter your key.

  • How we use Surrogate Keys for snowflake dimension

    Hi All,
    my question is - How we use  Surrogate Keys for  snowflake dimension
    i heard from some body Surrogate Keys only work with star schema.
    please correct me if i wrong.
    Regards,
    Manish

    Hi manishcal16PPS,
    According to your description, you can only create natural key in your dimension. But it's not working when using surrogate key. Right?
    In Analysis Services, the snowflake schema of the dimensions are represented by more than one dimension table in other words its takes multiple dimension tables to define a dimension. Surrogate key are just some extra, redundant, unique key based on the
    natural key. So there's no direct relationship or some limitations between surrogate keys and snowflake schema.
    In this scenario, since there's relationship between the two dimensions, you should create natural key. For using natural key or surrogate key. Please refer to an article below:
    Surrogate Key vs. Natural Key
    For understanding star/snowflake schema, please see:
    Understanding Star and Snowflake Schemas 
    Regards,
    Simon Hou
    TechNet Community Support

  • My macbook from 2008 which I bought used worked fine for 3 weeks and then suddenly it started restarting and now it restarts, goes to grey apple screen and a code saying something about a kernel panic appears and it restarts again and again. Help?

    My macbook from 2008 which I bought used worked fine for 3 weeks and then suddenly it started restarting and now it restarts, goes to grey apple screen and a code saying something about a kernel panic appears and it restarts again and again. Help?

    Restart the computer and immediately hold the Option key down.
    Select the Recovery partition and continue.
    On the next pane, select Disk Utility and continue.
    When DU opens, select your hard drive in the left column, click the First Aid tab, the click Repair Disk.
    When that is done, quit DU and restart in the usual way.

  • I'm installing the new OS and iPhone is asking for a password to "restore" my iPhone, but I've never used a password for the phone and don't know what it is!

    I'm installing the new OS and iPhone is asking for a password to "restore" my iPhone, but I've never used a password for the phone and don't know what it is!  Can anyone help??

    You selected Encrypt iPhone Backups in iTunes.  Then you entered a password.
    It would be that specific password it is asking for.
    See here:
    https://discussions.apple.com/thread/3284065?start=0&tstart=0

  • I am using Numbers app for the ipad and it has been working absolutely fine but now, when I want to email a spreadsheet as a PDF via the 'share and print' option, the file now doesn't appear as an attachment to the recipient. Any ideas please?

    I am using Numbers app for the ipad and it has been working absolutely fine but now, when I want to email a spreadsheet as a PDF via the 'share and print' option, the file now doesn't appear as an attachment to the recipient. Any ideas please?

    Hi mafiose15,
    Thanks for visiting Apple Support Communities.
    Restoring your iPod to factory settings is the best way to try and get it back to working order. You can use the instructions below to restore it:
    How to restore iPod
    Verify that you have an active Internet connection, because you may need to download new versions of the iTunes and iPod Software.
    Download and install the latest version of iTunes if necessary.
    Open iTunes. Connect your iPod to your computer using the USB or FireWire cable that came with your iPod.
    After a few moments, your iPod will appear in the Source panel in iTunes.
    Select your iPod in the Source panel. You will see information about your iPod appear in the Summary tab of the main iTunes window.
    Click Restore.
    If you are using a Mac, you will be asked to enter an administrator’s name and password.
    A progress bar will appear on the computer screen, indicating that stage one of the restore process has begun. When this stage is done, iTunes will present one of two messages with instructions specific to the iPod model you are restoring.
    Disconnect iPod and connect it to iPod Power Adapter (typically applies to older iPod models).
    Leave iPod connected to computer to complete restore (typically applies newer iPod models).
    During stage two of the restore process, the iPod displays an Apple logo as well as a progress bar at the bottom of the display. It is critical that the iPod remain connected to the computer or iPod power adapter during this stage.
    Note: The progress bar may be difficult to see, because the backlight on the iPod display may be off.
    After stage two of the restore process is complete, the iTunes Setup Assistant window will appear. It will ask you to name your iPod and choose your syncing preferences, as it did when you connected your iPod for the first time.
    You can find the instructions in this article:
    Restoring iPod to factory settings
    http://support.apple.com/kb/ht1339
    All the best,
    Jeremy

  • I have two iphone one is iphone 5 and othere is iphone 4 . can i use same id for both ? And do i have to purchase the application again for iphone 4 which i have buyed for iphone 5.??

    i have two iphone one is iphone 5 and othere is iphone 4 . can i use same id for both ? And do i have to purchase the application again for iphone 4 which i have buyed for iphone 5.??

    You can use the same Apple ID for both phones, you would then be able to use the purchased Apps/Content on both phones without having to pay again.

  • Can I use a domain for one site and mobile me for a different site?

    Can I use a domain for one site and mobile me for a different site?
    I have two sites, I would like to have up and I would like to do one through a domain and one through mobileme is this possible?

    Yes you can. You can use the CNAME method of forwarding for the first site (the top site in iWeb) and use the MMe URL for your account for the other site: http://web.me.com/YourAccount_Name/SiteName/
    OT

  • I have Lightroom 6 (not CC) on a Windows machine.  I'm prompted to log into Creative Cloud when I restart my computer (I don't have, use, or pay for Creative Cloud), and then when I launch Lightroom, it tells me to use the application I have to log into m

    I have Lightroom 6 (not CC) on a Windows machine.  I'm prompted to log into Creative Cloud when I restart my computer (I don't have, use, or pay for Creative Cloud), and then when I launch Lightroom, it tells me to use the application I have to log into my Adobe account...AGAIN!  And then to further add insult to injury, I'm prompted to enter in the license number of my product.  I've gone through this process a dozen times now...SCREAM!!!

    Paulou12 what type of a Creative Cloud Membership do you have?  You can find details on how to update Lightroom using the Creative Cloud Desktop application at Install and update apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html.
    Finally if you are in a managed environment then please work with your I.T. department to apply the update.

  • Can I use Time Capsule for Time Machine and a place to put my iPhoto Library

    Can I use Time Capsule for Time Machine and a place to put my iPhoto Library?

    Only if you partition the Time Capsure into two partitions, one for TM and one for the iPhoto LIbrary.  But you won't be able to backup that library as it will be on the same drive as the TM backups.
    It's not recommended.  An alternative solution is to get another EHD, move the library to it and run it from there. Then TM can backup both your boot drive and the working EHD drive.
    OT

  • How do you transfer the content from an iPhone to a PC? I have to use a PC for a while and don't know how to put my stuff on to there from my phone

    How do you transfer the content from an iPhone to a PC? I have to use a PC for a while and don't know how to put my stuff on to there from my phone

    If you're talking about music and movies an i-device was not designed for unique storage of media. It is not a backup device and media transfer was planned with you maintaining a master copy of your media on a computer which is itself properly backed up against loss. Syncing music and movies is one way, computer to device, updating the device content to the content on the computer, not updating or restoring content on a computer. The exception is iTunes Store purchases which can be transferred from a device to a computer.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer - http://support.apple.com/kb/HT1848 - only purchases from iTunes Store
    For transferring other items from an i-device to a computer you will have to use third party commercial software.  See this document by turingtest2: Recovering your iTunes library from your iPod or iOS device - https://discussions.apple.com/docs/DOC-3991

  • I've got movies on my computer on itunes, however my parents wish that i use my laptop for itunes stuff, and i cant figure out how to get those movies to be able to sync with my ipod again, it wont recognize that I have them. Suggestions?

    I've got movies on my computer on itunes, however my parents wish that i use my laptop for itunes stuff, and i cant figure out how to get those movies to be able to sync with my ipod again, it wont recognize that I have them. Suggestions?

    While you're in itunes, with the leftside window open, click on Apps. Then, look across the top middle of your itunes screen. You will see several choices: All, Iphone/iPad Touch, Ipad, Ipod Games, List, and Updates. 
    Clicking on each of these gives you a different view. 
    When you select ALL you will see all of your apps. When you select Updates you sill see only the apps that need to be updated. When you are in Updates you will see the Update button in the lower right corner.
    Hope this helps.

  • HT1296 I was using the iCloud for my iPod and had recorded an important Voice Memo on the device. Before I was able to store it on my computer, the device stopped working. I have the data on the Cloud, how can I get that back to my iMac?

    I was using the iCloud for my iPod and had recorded several irreplaceable Voice Memos. It went up to the Cloud, but I wasn't too savvy with the Cloud at that point, so it wasn't syncronizing to my home computer. So, the thing is that the iPod died and the backup is in the Cloud and I would like to load the backup to my iMac to recover my data. How can I do that? Thanks

    The new device I got to replace the iTouch is a iPad and I don't see the playlist I created with previous voice memos on it at all. Is there any way to access them on the iPad? If I erase the iPad and restore it with the old back up will the Voice Memos come along and get in to my home computer or will I be out of luck?

  • Using different templates for the desktop and phone versions of the same blog

    I have a site which was created in Adobe Muse and is hosted on Business Catalyst.
    I have created both a desktop and a phone versions of the site.
    I  want to know how I can integrate the blogs that I  currently have on the desktop site with the phone version that I just did, using different templates for the desktop and phone versions of the same blog. This is in order to ensure that visitors to the blogs on the website are directed to the templates that render correctly for the devices they are using.
    My current approach has been to create both a desktop and phone versions of the blogs. The problem with this however, is that the dates are different and the comments are separated between the two blog versions!
    I  have also tried enabling mobile templates in BC, but still couldn't find a way to specify the mobile versions of the templates for the same blog?
    To recap my problem, I basically  need a solution where the same blog uses different templates for desktop and mobile (both templates use different navigation headings and menu styles)
    Thanks.

    There can be few reason for this, including page contents links or contents used in phone/tablet version.
    Please provide the site url , also try to publish the site as a trial site in Business Catalyst with all layouts which would help to isolate the issue.
    Thanks,
    Sanjit

Maybe you are looking for

  • 404 Error when loading IWeb page

    Greetings once again! I have been using the IWeb program for setting up my business in nature photograhy and have passed out business cards that say web.mac.com/debo0063/iweb and people have been telling me they get 404 errors when they look up my si

  • Problem with Database Control

    Hi @all OS Windows Server 2008 (Standard) DB 11.1.0.7.0 I try to configure DB Control manually with D:\ORACLE\product\11.1.0\db_1\BIN>emca -config dbcontrol db -repos create result is 15.09.2009 13:19:14 oracle.sysman.emcp.EMConfig perform INFO: Dies

  • Preventing images from being downloaded

    Go here: http://www.funkylala.com/main.htm and try to right-click on any image in the lower frame. In IE for Windows you get a box that says "For image use, please contact Funky LaLa". On a mac the right click or control click won't work. How did the

  • Very Urgent - Lock table is full

    Hi All, I have a problem regarding locks. Whenever I tried to execute mass transaction, which will apply/modify locks on the documents I am getting a error message 'Document is blocked by System error'. And sometimes I am getting error message Lock t

  • Can flash store files within itself?

    Hi i have an SWF which plays mp3s from a remote server. The mp3s are generated by the server and updated on an irregular basis. What I'd like the SWF to do is play the mp3 from the server only when the mp3 is new i.e. not updated. I've made a text fi