Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. .bash_history makes me happy, how about you?

.bash_history makes me happy, how about you?

Scheduled Pinned Locked Moved The Weird and The Wonderful
linuxcsharpasp-netdotnettutorial
6 Posts 5 Posters 50 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • raddevusR Offline
    raddevusR Offline
    raddevus
    wrote on last edited by
    #1

    I had used Windows since 3.0 (ca 1991) before I switched to main usage of Linux in 2019 so please don't make fun of me for this too much. I've been working on setting up my .NET Core WebAPIs (hosted under various domains but running on one copy of a DigitalOcean droplet (running Debian)) and setting up the services and forwarding via Nginx and all that. It's all command-line there are a lot of steps that I forget often. 1. set up a service file in /etc/systemd/system/ 2. build the WebAPI and deploy it under a folder in /var/www/ 3. configure nginx to point at your webAPI 4. create link to the nginx config ln -s /etc/nginx/sites-available/<apiName> /etc/nginx/sites-enabled/ There's a bunch of things and I would lose the commands and forget things I should do. And, I be forever up-arrowing to get to old commands that I had used. .bash_history Then I stumbled upon the .bash_history file and noticed I can open it up in an editor (nano, of course, because I am vim-weak and don't know how to exit vim :laugh: ) Wow, that is really cool that all those commands are just sitting in there like that so I can now pull them out and save them to a file with some documentation. Thank you, Linux, it seems like you get better all the time. :laugh: I bet you already knew about .bash_history didn't you? Well, try not to laugh at me too hard for only finding it now. :)

    K P N 1 4 Replies Last reply
    0
    • raddevusR raddevus

      I had used Windows since 3.0 (ca 1991) before I switched to main usage of Linux in 2019 so please don't make fun of me for this too much. I've been working on setting up my .NET Core WebAPIs (hosted under various domains but running on one copy of a DigitalOcean droplet (running Debian)) and setting up the services and forwarding via Nginx and all that. It's all command-line there are a lot of steps that I forget often. 1. set up a service file in /etc/systemd/system/ 2. build the WebAPI and deploy it under a folder in /var/www/ 3. configure nginx to point at your webAPI 4. create link to the nginx config ln -s /etc/nginx/sites-available/<apiName> /etc/nginx/sites-enabled/ There's a bunch of things and I would lose the commands and forget things I should do. And, I be forever up-arrowing to get to old commands that I had used. .bash_history Then I stumbled upon the .bash_history file and noticed I can open it up in an editor (nano, of course, because I am vim-weak and don't know how to exit vim :laugh: ) Wow, that is really cool that all those commands are just sitting in there like that so I can now pull them out and save them to a file with some documentation. Thank you, Linux, it seems like you get better all the time. :laugh: I bet you already knew about .bash_history didn't you? Well, try not to laugh at me too hard for only finding it now. :)

      K Offline
      K Offline
      k5054
      wrote on last edited by
      #2

      A couple of pointers: !$ is the last argument of the last command e.g.

      $ cat foo.bar
      $ nano !$ # expands to "nano foo.bar"

      !! repeats the last command CTRL+r does a reverse search through your history so

      $ CTRL+rfoo

      searches backwards through your history for the most recent command with "foo" somewhere in it, so it might match nano foo.bar or setfoobar able baker charlierepeating [CTL-R] searches to the next previous, etc. There's a whole bunch of other things you can do, but those are the ones I use most often

      "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

      raddevusR 1 Reply Last reply
      0
      • K k5054

        A couple of pointers: !$ is the last argument of the last command e.g.

        $ cat foo.bar
        $ nano !$ # expands to "nano foo.bar"

        !! repeats the last command CTRL+r does a reverse search through your history so

        $ CTRL+rfoo

        searches backwards through your history for the most recent command with "foo" somewhere in it, so it might match nano foo.bar or setfoobar able baker charlierepeating [CTL-R] searches to the next previous, etc. There's a whole bunch of other things you can do, but those are the ones I use most often

        "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

        raddevusR Offline
        raddevusR Offline
        raddevus
        wrote on last edited by
        #3

        Very cool. Thanks for the additional pointers. :thumbsup:

        1 Reply Last reply
        0
        • raddevusR raddevus

          I had used Windows since 3.0 (ca 1991) before I switched to main usage of Linux in 2019 so please don't make fun of me for this too much. I've been working on setting up my .NET Core WebAPIs (hosted under various domains but running on one copy of a DigitalOcean droplet (running Debian)) and setting up the services and forwarding via Nginx and all that. It's all command-line there are a lot of steps that I forget often. 1. set up a service file in /etc/systemd/system/ 2. build the WebAPI and deploy it under a folder in /var/www/ 3. configure nginx to point at your webAPI 4. create link to the nginx config ln -s /etc/nginx/sites-available/<apiName> /etc/nginx/sites-enabled/ There's a bunch of things and I would lose the commands and forget things I should do. And, I be forever up-arrowing to get to old commands that I had used. .bash_history Then I stumbled upon the .bash_history file and noticed I can open it up in an editor (nano, of course, because I am vim-weak and don't know how to exit vim :laugh: ) Wow, that is really cool that all those commands are just sitting in there like that so I can now pull them out and save them to a file with some documentation. Thank you, Linux, it seems like you get better all the time. :laugh: I bet you already knew about .bash_history didn't you? Well, try not to laugh at me too hard for only finding it now. :)

          P Offline
          P Offline
          Peter_in_2780
          wrote on last edited by
          #4

          In addition to what k5054 said, bone up on the readline library that bash (and many other command line utilities) use. Lots more tricks at your fingertips from my second most frequent use, correcting typos in a recalled command, to really esoteric magic. (My most frequent use is autocomplete.)

          Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

          1 Reply Last reply
          0
          • raddevusR raddevus

            I had used Windows since 3.0 (ca 1991) before I switched to main usage of Linux in 2019 so please don't make fun of me for this too much. I've been working on setting up my .NET Core WebAPIs (hosted under various domains but running on one copy of a DigitalOcean droplet (running Debian)) and setting up the services and forwarding via Nginx and all that. It's all command-line there are a lot of steps that I forget often. 1. set up a service file in /etc/systemd/system/ 2. build the WebAPI and deploy it under a folder in /var/www/ 3. configure nginx to point at your webAPI 4. create link to the nginx config ln -s /etc/nginx/sites-available/<apiName> /etc/nginx/sites-enabled/ There's a bunch of things and I would lose the commands and forget things I should do. And, I be forever up-arrowing to get to old commands that I had used. .bash_history Then I stumbled upon the .bash_history file and noticed I can open it up in an editor (nano, of course, because I am vim-weak and don't know how to exit vim :laugh: ) Wow, that is really cool that all those commands are just sitting in there like that so I can now pull them out and save them to a file with some documentation. Thank you, Linux, it seems like you get better all the time. :laugh: I bet you already knew about .bash_history didn't you? Well, try not to laugh at me too hard for only finding it now. :)

            N Offline
            N Offline
            Nelek
            wrote on last edited by
            #5

            raddevus wrote:

            I am vim-weak and don't know how to exit vim :laugh:

            IIRC it exits with ":q" (short for :quit) and all other variations if you have saved or not, you want to force the saving (even if you open in read modus) or not, if you want to... Yeah, it might be a bit annoying :-D

            M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

            1 Reply Last reply
            0
            • raddevusR raddevus

              I had used Windows since 3.0 (ca 1991) before I switched to main usage of Linux in 2019 so please don't make fun of me for this too much. I've been working on setting up my .NET Core WebAPIs (hosted under various domains but running on one copy of a DigitalOcean droplet (running Debian)) and setting up the services and forwarding via Nginx and all that. It's all command-line there are a lot of steps that I forget often. 1. set up a service file in /etc/systemd/system/ 2. build the WebAPI and deploy it under a folder in /var/www/ 3. configure nginx to point at your webAPI 4. create link to the nginx config ln -s /etc/nginx/sites-available/<apiName> /etc/nginx/sites-enabled/ There's a bunch of things and I would lose the commands and forget things I should do. And, I be forever up-arrowing to get to old commands that I had used. .bash_history Then I stumbled upon the .bash_history file and noticed I can open it up in an editor (nano, of course, because I am vim-weak and don't know how to exit vim :laugh: ) Wow, that is really cool that all those commands are just sitting in there like that so I can now pull them out and save them to a file with some documentation. Thank you, Linux, it seems like you get better all the time. :laugh: I bet you already knew about .bash_history didn't you? Well, try not to laugh at me too hard for only finding it now. :)

              1 Offline
              1 Offline
              11917640 Member
              wrote on last edited by
              #6

              raddevus wrote:

              I am vim-weak and don't know how to exit vim

              How to exit vim: Try to turn off the computer. If you cannot - buy the new one. Turn on the computer and reinstall OS.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups