Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
F_Shit_Fitzgerald
Feb 2, 2017



How do you unlock your screen if you invoke slock in the terminal? Is there a particular keystroke or flag you set?

e: xscreensaver seems to work just fine with awesome, so I'll just use that. Seems a lot easier.

F_Shit_Fitzgerald fucked around with this message at 19:31 on Apr 9, 2022

Adbot
ADBOT LOVES YOU

F_Shit_Fitzgerald
Feb 2, 2017



I created a mount point for my USB drive - /mnt - and successfully mounted the drive. Now I've gotten everything I wanted from the drive, but when I invoke

sudo umount /dev/sdXX

...it tells me that '/mnt is busy'. Do I need to delete /mnt in order to unmount the drive? I'm afraid to do anything if it'll gently caress up my system.

F_Shit_Fitzgerald
Feb 2, 2017



RFC2324 posted:

are you in /mnt currently? Can't umount the drive if anything is accessing it, and that including you just sitting in the directory

Not that I can tell. I closed the file system where I was grabbing the files I needed and I'm in my home directory in my terminal. I even closed my terminal and that didn't seem to help.

F_Shit_Fitzgerald
Feb 2, 2017



Pablo Bluth posted:

As an side; /mnt is a standard linux/unix directory, normally you would create a directory within that ( eg /mnt/usbstick/ ) rather than mounting to /mnt directly.

OK, that's good to know. I'm not new to Linux but I'm relatively new to mounting USB devices. These kind of frustrations are why I generally stick with using cloud storage to transfer files.

I think what happened was that I opened up Music On Console (mocp) in the /mnt drive and it was still considered by the system to be active, even after closing my terminal a couple of times.

F_Shit_Fitzgerald
Feb 2, 2017



I do some volunteer work that involves docx and pptx files. At the end of the week, I'd like to purge all of these type of files from a directory using crontab. My commands
0 14 * * 0 rm *.docx ~/Documents/foo
1 14 * * 0 rm *.pptx ~/Documents/foo/bar

didn't work, and when I typed the same command in my terminal it complained that there were no .docx files and that Documents/foo is a directory.

Is there another set of commands that would work without deleting the entire directory?

F_Shit_Fitzgerald
Feb 2, 2017



Warbird posted:

Did you do ‘crontab -e’ or ‘sudo crontab -e’ when making the jobs?

Yes. On my system it takes me straight to the nano file for editing.

F_Shit_Fitzgerald
Feb 2, 2017



Warbird posted:

Which one? Sudo or non sudo? What is the crontab command you’re using?

crontab -e

Next time I'll use sudo crontab -e.


Volguus posted:

That's not how the rm command works. Not even in windows (had to look to make sure), the del command doesn't work like that. What you probably want is rm ~/Documents/foo/*.docx as a command line. As a crontab, I'd advise making a shell script:

code:
#!/bin/bash

rm -f /home/<user>/Documents/foo/*.docx
rm -f /home/<user>/Documents/foo/bar/*.pptx
That is: do not use ~ because that depends for what user is cron running the job, specify the full path. "*.docx" is expanded by the shell not by cron, so give it a shell. Add "-f" to force the removal, for "rm" to not stop to ask if you're really sure.

Oh. See, I thought it had to be structured that way for cron to be able to interpret it. A shell script would be ideal because I need to learn bash anyway.

Thanks for all the replies. There's so much I have yet to learn in Linux...

F_Shit_Fitzgerald fucked around with this message at 20:06 on Sep 25, 2022

F_Shit_Fitzgerald
Feb 2, 2017



Thanks Ants posted:

Do you really want to delete those files on a schedule? What about moving them all to a folder named after the current date which then allows you to delete that folder manually or write another script to delete it a week later?

I'm just thinking of an edge case where your work takes longer than expected and runs over into the following week.

The nature of this work is that the docx and pptx files change week by week. Is there another package that could automate this other than cron?


kujeger posted:

Just to elaborate, when you're using 'sudo', you are kind of changing to the 'root' user and then running the command. This is only necessary if you need to do things that your own user is not permitted to do.

When you run 'sudo crontab -e', you are then editing the crontab of the 'root' user. If you only want to change or alter your own files, you should probably not use sudo -- you already have all permissions on your own files.

When you run 'crontab -e', you are editing your own crontab, and commands run from it will run with your own permissions. For deleting your own files, this is almost certainly what you want.

Ah, OK. I was dumb and didn't realize that different crontabs exist for the user and for the root.

F_Shit_Fitzgerald
Feb 2, 2017



Is there a way to download an almost hour and a half Youtube video as an mp4? It's my class' high school graduation video, so there shouldn't be any copyright issues that I know of.

F_Shit_Fitzgerald fucked around with this message at 15:05 on Oct 14, 2022

F_Shit_Fitzgerald
Feb 2, 2017



Tesseraction posted:

Not really a Linux question but most distros have youtube-dl to do that.

Worked perfectly! Thanks! youtube-dl is a great tool.

F_Shit_Fitzgerald
Feb 2, 2017



Is there a flag or setting I can use for Lynx to auto-reject all cookies so that I don't have to keep pressing 'v' (for neVer allow cookies)?

F_Shit_Fitzgerald
Feb 2, 2017



ExcessBLarg! posted:

I'm pretty sure they're called "directories" in any DOS that supports hierarchical storage. The first time I encountered them was Apple ProDOS, though the Apple Finder represented them as folders.

Either way, directories were not often used on floppy media even when filesystems supported them--you don't have that many files on a disk after all. So many folks probably didn't think much of them until they had a PC with a hard disk, probably in the DOS/Windows 3.x era. If you used MS- (PC-, DR-, etc.) DOS, you were definitely familiar with "cd", "md", and "dir" commands and so had to be aware of the "directory" terminology even if you called them folders.

I'm young enough to have intuited the concept of hierarchical storage without having to rely on the physical file folder or phone directory abstractions, so the two terms have always been interchangible for me.

Kids these days probably have no idea what a phone book is. It would be nice if they didn't know what a file folder is either since that might save them from an lifetime of organizational disaster as adults. It's just easier to go paper-free on everything and let Google sort it. Live free.

My family had an IBM PS/2 when I was little, and DOS always used 'directories'. It wasn't until we got a Windows 98-capable computer, many years later, that "folders" was used.

One of the reasons I'm convinced that I've taken so easily to a lot of Linux is that it reminds me so much of the way computing was when I was little (in a good way), typing commands in the DOS prompt.

F_Shit_Fitzgerald
Feb 2, 2017



I have a weird issue where Linux sometimes opens Zoom when I've been using xscreensaver for a while. Is there a fix for this? It's very odd.

F_Shit_Fitzgerald
Feb 2, 2017



Volguus posted:

I never heard of this and it's been ages since I've used xscreensaver, but it got me thinking. It used to be that it would lock the computer after a while(5-10 minutes or so, configurable somewhere). To unlock it it would launch xlock, to ask for a password.

Now, I don't know how it launches xlock, but it could be using xdg-open. And that determines what application to launch for a particular file (such as your default browser if the argument is an url). And then somehow, xdg-open is told to launch zoom for whatever argument it gets, as that's the preferred application for that particular file or url that it got as a param.

I'd mess around the preferred applications list of your DE, see what is Zoom set to open.

Subjunctive posted:

If you quit your browser and then xdg-open opens it, and one of the tabs is a Zoom link (which of course is the case) then it’ll trigger the Zoom client opening.

OK, I'll look into that; thanks. The funny thing is that I rarely even use Zoom.

F_Shit_Fitzgerald
Feb 2, 2017



I'm so dumb. I update my system every Monday, and for a while now I've gotten the 'no public_key ##################' error. Looking it up, you can invoke

code:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv keys ###########
to fix the issue, and that prompted what was doubtlessly months worth of updates to my kernel. So my question: is there a way to automate this process so that if there's ever another public key error, I can download the key right away and avoid this issue?


That's the thing about Linux: just when you feel like you've gotten a grip on managing your system, something happens to humble you. Linux is more of a journey than a destination.

F_Shit_Fitzgerald
Feb 2, 2017



OK, thanks! Both good ideas. I might go the cron route, honestly, so that I don't have to worry about this again.

F_Shit_Fitzgerald
Feb 2, 2017



It might be (probably is) something I hosed up. My auto-update script was not sudo apt-get upgrade && sudo apt-get dist-upgrade; I think I left off the 'apt-get' because I'm still a relative noob. So without the escalated privileges it just tried to upgrade, failed, and left it alone.

F_Shit_Fitzgerald
Feb 2, 2017



Serious_Cyclone posted:

TL;DR: Are linux laptops any good?

I run Mint on a new (as of last year) Thinkpad and have not had any problems with it. Good compatibility with drivers (I've been extremely lucky), not a whole lot of fuss with getting Linux installed, and 100% better hardware reliability than the Dell Dimension 15 7000 (?) laptop I was running with Win 10.

F_Shit_Fitzgerald fucked around with this message at 20:29 on Jan 19, 2023

F_Shit_Fitzgerald
Feb 2, 2017



I have several programs that I have set in my Awesome wm configuration to spawn with the shell: Nitrogen, xscreensaver, and Redshift. If I restart Awesome several times after modifying rc.lua, will there be three or four instances of these programs running on my system? I just tinkered a bit with my configuration and I'm wondering if I need to reboot because of five different xscreensaver daemons running (or maybe I still have Windows brain and that's not how it works on Linux?).

F_Shit_Fitzgerald fucked around with this message at 16:18 on Feb 17, 2023

F_Shit_Fitzgerald
Feb 2, 2017



Yeah, I've had times in the past where the screen dimming at night was very intense because I think there were multiple daemons of Redshift running at once. Xscreensaver, though, never seems to have a problem.

I rebooted anyway, just to be safe.

F_Shit_Fitzgerald
Feb 2, 2017



Thanks for all the previous help.

Why in hell is it that if, say, I want to delete all the pdf files in a directory, I can simply invoke

code:
if [ -f *.pdf ];
then
  rm *.pdf
fi
...but if I want to do the same thing with mp4 files, I can't simply do that but something more along the lines of

code:
for i in *.mp4 do
  rm *.mp4
done
Is there an easier way to automatically detect any mp4 files in a directory and delete them (or do nothing if there aren't any)?

F_Shit_Fitzgerald
Feb 2, 2017



rm -f *.mp4 is perfect! I didn't realize it could be that simple; I thought you had to set up a conditional for each file type. Thanks! Still a lot I have to learn about Bash.

F_Shit_Fitzgerald fucked around with this message at 20:56 on Feb 26, 2023

F_Shit_Fitzgerald
Feb 2, 2017



If that's the case, I might keep it, actually. I do volunteer work that uses a variety of different file types - docx, pdf, mp4 - and this script is intended to only clean out old files of the specific type while preserving other files (e.g: text files, subdirectories, etc).

F_Shit_Fitzgerald
Feb 2, 2017



cruft posted:

Actually they swear up and down they only know vim, and then I find out they don't even know what "dd" does. Their "vim" usage technique is to press "i" and use the cursor keys and backspace A TON.

I don't understand how kids today reconcile themselves with such an incredibly painful and laborious method of editing text files.

It's what they're used to. I can relate because I've had to train myself to think more in a "Linux" way when using vim rather than the Windows way of cursor keys and backspaces. It's an adjustment.

F_Shit_Fitzgerald
Feb 2, 2017



No...

I can see both sides of it, honestly. Yes, the Linux community can be toxic and insular to outsiders getting started with it. I really despise the snottiness that tech people can have and try very hard not to be 'that guy'. But on the other hand it can depend on the type of questions asked and how they're asked. I get why people might be annoyed by Linux 101 questions like, "How do I show the contents of a directory?".

It's all about the mindset you have going into Linux. Depending on the distro, you can't just expect that it's going to be like Windows where it works out of the box. "Linux is only free for those who don't value their time"; it's the kind of thing where you have to put work in to make it work for you.

F_Shit_Fitzgerald
Feb 2, 2017



What matters in terms of what distro you use is what works for your needs. I don't even like saying that x is a "beginner's distro" because it implies that if you have experience with Linux you should feel bad for not moving to a 'harder' distro. Just use what works for you and don't worry about it.

F_Shit_Fitzgerald fucked around with this message at 21:00 on Mar 12, 2023

F_Shit_Fitzgerald
Feb 2, 2017



Hot take: Unless you're having driver issues or something similar, you shouldn't need to distrohop a half dozen times. It's fine to be comfortable with the distro you're using. I think one of the reasons the Linux community seems insular is that some of us push the "You gotta hop distros constantly!". To outsiders who are just looking for a good OS to use, that's off-putting.

F_Shit_Fitzgerald
Feb 2, 2017



Quixzlizx posted:

and then a second response saying that you can't expect Linux to work out of the box like Windows (I DIDN'T SAY THIS, IT WASN'T ME, HOLD YOUR FIRE):

Am I a cause of this slapfight?

I shouldn't have said that, then. A lot of distros do work just fine out of the box; Mint certainly did when I switched to Linux last year. If you're new to Linux you probably shouldn't pull a Linus Tech Tips and wade right into using something like Arch or Gentoo anyway.

What I meant and didn't express clearly is this: the use case of Windows and Linux tend to be different. Windows is designed for your average "normie" (I hate that term, but it fits) who may not know much about computing but just need something that works. Linux can be used that way too, but the reason techier people tend to like it is that it gives you control over your system so that customize your system - even when you end up tweaking something that fucks up your computer.

But at the same time, there are things like driver issues that make the switch to Linux harder than they would be on Windows or Mac.

F_Shit_Fitzgerald
Feb 2, 2017



I'm writing a script that uses grep in a while-loop. Is there a way to get grep to shut the gently caress up so that I don't have to see the

Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.

message every time I run the script? The -s flag doesn't seem to work.

F_Shit_Fitzgerald fucked around with this message at 22:12 on Mar 19, 2023

F_Shit_Fitzgerald
Feb 2, 2017



AlexDeGruven posted:

Sounds like your grep is failing. What's the line you're trying to run?

Admittedly, it's probably not the most elegant way to do this:

offs=`echo $alpha | grep -obs $letter | tr -cd '0-9'`

Where
alpha is an alphabet string
letter is a letter extracted from a string

So what this is supposed to do is search for a letter in the alphabet string and use its position (e.g: a=0, b=1, etc) to modify a position in an array corresponding to a letter (so position 0 is a, position 25 is z, etc).

No, it's not homework. This is a script for my own system.

F_Shit_Fitzgerald fucked around with this message at 00:07 on Mar 20, 2023

F_Shit_Fitzgerald
Feb 2, 2017



e: Never mind; I fixed the problem. I was taking the length of a string and then running through a while-loop to extract each letter, but the length was exceeding the actual length of the string. In other words, Bash is similar to something like C++/Java where there's a terminal character at the end of chars. It was reading that null string and complaining because it wasn't legitimate input to grep.

F_Shit_Fitzgerald fucked around with this message at 14:28 on Mar 20, 2023

F_Shit_Fitzgerald
Feb 2, 2017



Thanks to Windows/iTunes quirks, some of the mp3 files I moved to my Linux machine have a 1 at the end of them. For example:
Name of song 1.mp3

Is there an awk one-liner of some kind I could use to get rid of these?

F_Shit_Fitzgerald
Feb 2, 2017



Cool; thanks. I love how relatively easy Linux makes this process. It'd be a pain in Windows.

F_Shit_Fitzgerald
Feb 2, 2017



So....I have a question and I hope I haven't hosed up my system.

I wanted to move the download of the recent The Mads are Back live riff to a USB stick, so I connected a stick, did the usual lsblk and sudo mount /dev/xxxx yyyyy . Then I downloaded the file to my desktop (since it wouldn't download directly to the stick) and then used

sudo mv name_of_file.mp4 /media/yyyyy

It said that "permissions couldn't be preserved" and appeared to fail in moving the file, but when I ls'ed my desktop and then the location of my USB stick, the video was there. I was even able to play it in VLC from my terminal.

Is the file safely on the stick or should I redownload and try again? These download links are only good for about a day, so I want to make sure I have my video file.

e: Supposedly cp is a better command to use with sudo when doing something like this? There's still a lot I have to learn.

F_Shit_Fitzgerald fucked around with this message at 02:32 on Apr 13, 2023

F_Shit_Fitzgerald
Feb 2, 2017



I was able to plug the USB stick into my old Windows machine and play it without any apparent issues. Thanks; I'll try pmount next time or just boot into the Cinnamon desktop; the connection/ disconnection process is much easier there.

F_Shit_Fitzgerald
Feb 2, 2017



If I wanted to use a font similar to the IBM PS/2 CLI, is there an equivalent for Linux terminals? My dad's first computer was a PS/2 and it'd be kind of cool to replicate it the feel on my machine.

F_Shit_Fitzgerald
Feb 2, 2017




Seems to be! Thanks!

F_Shit_Fitzgerald
Feb 2, 2017



Windows iTunes organized my Beatles Anthology double albums as "Anthology 2 (1 of 2)", which I don't like in Music on Console, so I'm trying to consolidate these mp3 files into a single directory. I ran the following code on sample data in another directory and it worked perfectly:

for file in *.mp3; do mv $file '1-'$file; done

When I try this same code in my actual Anthology directory, it gives the correct output when I substitute mv with echo, but when I actually run the code it says

"1.mp3 is not a directory".

So what the gently caress gives here? Nothing has changed either in the File System or on Music on Console. I'm having to manually rename these files to "1-03 Blah blah blah'.mp3 so that tracks are organized by disk, which is quite annoying.

F_Shit_Fitzgerald
Feb 2, 2017



I've aliased a few commands in my terminal to control the volume on my laptop.
code:
amixer -q -D pulse sset Master toggle
unmutes
code:
amixer -q set Master mute
mutes

(Just for full disclosure so you understand how I've set up my Mint system.)

Every now and then, at random, my system will automatically mute itself when I'm wearing headphones. It did it just now as I was listening to something in Music on Console. If I unmute, the system will act as though no headphones are plugged in and play through the speaker. I have to mute, physically unplug/replug my headphone jack and then unmute for it to return to normal. This never happens when my headphones aren't plugged in.

Someone also using Mint had a slightly similar problem that involved ALSA mixer power saving. I suspect this could also be my problem, but looking into alsa-base.conf there is no "option power_save" entry. Maybe there's something else going on?

Reference: https://forums.linuxmint.com/viewtopic.php?t=322348

Adbot
ADBOT LOVES YOU

F_Shit_Fitzgerald
Feb 2, 2017



Great advice; thanks! I admit that I don't know too much about the amixer command outside of the very specific use cases I have, so there's probably a more efficient way to mute/unmute than that.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply