• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "cli". Back to normal view
    1. Linux Question: I think my sys m.2 is failing and want to copy my / data for backup via cli

      So, I'm using Arch i3wm. I have multiple copies of my /home/username (I am the sole user), and I have a "Spare" drive with media, games, and other goodies, some of which are also stored on...

      So, I'm using Arch i3wm. I have multiple copies of my /home/username (I am the sole user), and I have a "Spare" drive with media, games, and other goodies, some of which are also stored on partitions on the m.2 in question, but they have backups.

      And the reason I ask this question is because while I've had my m.2 fail at the end of '21 (I didn't even know that was a thing, but it barely lasted a year, and things are acting shoddy now... though the original failed without a warning), I just bought a second m.2 for my games. I guess I could swap most of the whole thing over, but I know the boot partition is easier just rebuilt from scratch... which I had to do last week.

      Ultimately, what's making me suspicious is when I upgraded to the new drive and unplugged all my non-m.2 satas, I also added some memory and a new power supply. But then after the upgrade (Monday of last week, so the 5th), the system wouldn't boot up. I used a usb to troubleshoot and my /boot partition was apparently no gouda. I redid that, and everything was fine... until this week. Then my new Games partition (basically the new drive) failed fsck and it got stuck in a boot loop on Tuesday. I could boot emergency to root, but not skip the fsck and keep the Games disk auto mounted (I know I changed something to randomize fsck on bootup, but that's something I'm still kinda looking into how I managed...), so I just removed it from my fstab and it booted fine. For two times. I just manually mounted the drive, all was great, then my SO sent me a screenshot today while I was at work stating that my / partition (on the older m.2) apparently rebooted because it bypassed my screen lock, and was stating EXT4-fs error, reading directory lblock:0 and whatnot.

      So, that's my history on what's going on, and if anyone can offer any advice [mostly] on the backup stuff, though as I said, /home and the important tangible stuff is saved, but if you also have any input on something more than I suspect the drive is failing (since the /boot partition and now the / partition are crapping out), please feel free to share.

      (Also, thanks for letting me in. This is what I'd typically post on reddit and probably have to repost 10 times depending on the sub to get the right keywords and tags and yes, I already searched the internet but my search will not match yours... sigh)

      6 votes
    2. Do generic CLI to GUI wrappers exist?

      So I've been messing around with the webp encoder cli tool and I really wish I could quickly achieve a workflow more similar to photoshop's previews. Is there a GUI tool out there where I can...

      So I've been messing around with the webp encoder cli tool and I really wish I could quickly achieve a workflow more similar to photoshop's previews. Is there a GUI tool out there where I can specify the arguments for an CLI executable then it lets me adjust the values and run the command. Ideally it would automatically let me view the output file, and define presets would be great.

      10 votes
    3. Share your useful shell scripts!

      Disclaimer: Don't run scripts offered to you by randos unless you trust them or review it yourself I use this constantly, it just plays music by file name, specifically matching *NAME* with...

      Disclaimer: Don't run scripts offered to you by randos unless you trust them or review it yourself

      I use this constantly, it just plays music by file name, specifically matching *NAME* with case-insensitivity. Requires bash 4.something.

      # play -ln SONGS ...
      # -l don't shuffle
      # -n dry run
      mpv_args="--no-audio-display --no-resume-playback \
                --msg-level=all=status --term-osd-bar"
      shopt -s globstar nullglob nocaseglob
      
      shuffle=true
      dry=false
      while [[ "$1" == -* ]]; do
          if [[ "$1" == "-l" ]]; then 
              shuffle=false
          elif [[ "$1" == "-n" ]]; then
              dry=true
          fi
      
          shift 1
      done
      
      if [[ "$shuffle" == true ]]; then
          mpv_args="--shuffle $mpv_args"
      fi
      
      songs=()
      while [[ "$#" != 0 ]]; do
          songs+=( ~/music/**/**/*"$1"*.* ) # change this to match your music directory layout
          shift 1                                               # could probably use find instead
      done
      
      if [[ "$dry" == true ]]; then
          if [[ "$shuffle" == true ]]; then
              printf "Shuffle mode is on\n"
          fi
      
          for song in "${songs[@]}"; do
              printf "$song\n"
          done
        
          exit
      fi
      
      if [[ ${#songs[@]} != 0 ]]; then
          mpv $mpv_args "${songs[@]}"
      fi
      

      I make no claims to the quality of this but it works!

      36 votes