Announcement

Collapse
No announcement yet.

Command line question. Trying to learn and understand

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Command line question. Trying to learn and understand

    Hi,
    I am trying to find an old post, but I came across this.
    https://www.kubuntuforums.net/forum/...s-installation

    FYI. My Brain needs to "see" the input and output to understand and learn... Reading a page is helpful, as it gives me a reference point for the command, but I really need to see the output and what it does for it to makes sense in my brain... (Autism. It's great)

    I tried one or two (since there is a backup created and I can compare the two).. Then undo (restore original) But.. I am wanting to understand the actual commands... More... PLEASE
    >>>>I also want to know how to disable updates from adding "quiet" to
    /boot/grub/grub.conf
    every(bloody)time an update is performed. Frustrating.

    So as I understand....
    Code:
    sudo cp /etc/default/grub /etc/default/grub.orig
    = copies
    Code:
    sudo sed -i 's/^GRUB_TIMEOUT_STYLE=hidden/GRUB_TIMEOUT_STYLE=menu/' /etc/default/grub
    Code:
    sed -i 's/^
    ?? Does what exactly, please
    at the end
    Code:
    /etc/default/grub
    I am assuming is the file where the sed thing is working-output to-something... Sorry INPUT file (according to some website I just looked up... Still not following the command

    #2
    Yes, more reading, but this is pretty good at explaining what sed does, with examples and explanations of those examples. https://www.geeksforgeeks.org/techti...with-examples/
    Windows no longer obstruct my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Originally posted by Snowhog View Post
      Yes, more reading, but this is pretty good at explaining what sed does, with examples and explanations of those examples. https://www.geeksforgeeks.org/techti...with-examples/
      I actually read that page. Thanks
      Question regarding
      delimiters
      on that page

      Code:
       's/find_this_text/replace with this/
      Is that how it goes ?
      and
      adding 2 (after /) at the end, means the second occurrence or every occurrence after the 2nd ??

      So in relation to where I would like linux to not modify a file, do I modify the
      Code:
      /etc/default/grub
      file ??
      OR
      Do I have to create a separate script file that I run after an update to remove all the added
      Code:
      quiet
      remarks in the
      /boot/grub/grub.cfg
      file, or keep manually opening it in text-editor ??
      Thanks

      Comment


        #4
        Very generally, the last element in a bash command line is the target. I.e. the file to be acted on. So in your example above, the file which would be edited is /etc/default/grub. With current Kubuntu - 24.04 and after - it's perfectly fine to use Kate to edit almost any file as it will prompt you for a sudo password if needed when you attempt to save edits.

        In your referenced link, the comment by the author to beware the using of sed (paraphrasing) is because with sed and almost all command line tools there is no error checking and no undo. This is why Kate is a better option in most cases - because you can undo and errors are often exposed before saving.

        The benefit to command line tools like sed is it can do 1000's of edits in milliseconds vs. a laborious hunt-and-edit search using a text editor like Kate.

        This, as in many Linux questions that begin with "Which tool is right for...?" boil down to;

        Use case - as in "How many edits do I need to do and are they very similar or vastly different?'
        Skill level - as in "Am I well versed enough to understand the potential pitfalls of what I think I want to do?"

        If you have only a handful of edits, use Kate. If you have more than a dozen or so and they're identical or nearly so, consider bash scripting. Another time where bash is better is if you expect to need to redo whatever it is you're doing more than a few times. Then a bash script - once perfected - can save hours of manual edits.

        Please Read Me

        Comment


          #5
          Originally posted by CharlieDaves View Post
          So in relation to where I would like linux to not modify a file, do I modify the Code:

          Code:
             
           /etc/default/grub
          file ??
          Correct. /etc/default/grub is a template of sorts, used to generate the proper grub cfg files when update-grub is run, either manually or when there is a kernel update. This file should not change unless you change it yourself.


          A LOT of sources use quickie command line options, partially as a 'cool' factor, but mostly because it is far, far quicker and easier to use than it is is to describe using a text editor, and the reader might also be stuck on the command line as well. But basically lazy and/or autogenerated.

          I don't grok sed very much, so if it isn't clear to me what a suggested command does, I will just edit it manually (in nano, lol) it would not be hard for someone to screw up or to sneak in some nefarious edit.

          Comment


            #6
            In your journey to learn the command line you may want to take a look at this page.
            https://linuxjourney.com
            Dave Kubuntu 20.04 Registered Linux User #462608

            Wireless Script: http://ubuntuforums.org/showthread.p...5#post12350385

            Comment


              #7
              Thanks Snowhog && claydoh && kc1di . Appreciated. I'll take a look.

              So overall. Best to just manually edit the grub.cfg file after each *auto* update, since it is just the one file...
              No way I can add a "-quiet" line in the file

              Ohh. Just realised there is a line in the /etc/default/grub file that reads
              Code:
              GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
              , so I've hashed
              Code:
              ##
              that line out.

              EDIT:
              Ping claydoh.. How do you do that Highlight thing in your response. I've tried "higlight" and it's yellow. I think there was or is a page that explains all these things. If there is, please attach the link.

              Comment


                #8
                Originally posted by CharlieDaves View Post
                How do you do that Highlight thing in your response.
                It's a TAG in the toolbar when you are creating a post.

                Click image for larger version

Name:	Screen Shot 2025-06-03 at 8.28.49 PM.png
Views:	0
Size:	40.8 KB
ID:	686938
                Do you see this 'full' edit toolbar when you are composing a post?
                Windows no longer obstruct my view.
                Using Kubuntu Linux since March 23, 2007.
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #9
                  Originally posted by Snowhog View Post
                  It's a TAG in the toolbar when you are creating a post.

                  Click image for larger version

Name:	Screen Shot 2025-06-03 at 8.28.49 PM.png
Views:	0
Size:	40.8 KB
ID:	686938
                  Do you see this 'full' edit toolbar when you are composing a post?
                  Thanks Snowhog. Yes I see the FULL edit toolbar
                  I did that specific "highlight" TAG and it's Black Text on a yellow Background... claydoh is Black Text on a Grey Background
                  Do I add colours or something within Square Brackets?
                  Thanks

                  Comment


                    #10
                    Originally posted by CharlieDaves View Post
                    I did that specific "highlight" TAG and it's Black Text on a yellow Background
                    yes, the [hl] button shown does just that. If you want to do the grey thing you want the [console] tag. Hover over each button for a description, which sort of helps.

                    Click image for larger version

Name:	Screenshot_20250604_005240.png
Views:	0
Size:	19.6 KB
ID:	686946

                    We really should remove the extra buttons we never use or need, tbh. I keep getting lazy when I think about it.
                    Last edited by claydoh; Yesterday, 10:59 PM.

                    Comment

                    Working...
                    X