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
TheGopher
Sep 7, 2009
After being very happy I'm learning *nix pretty effectively, and am getting more and more comfortable with the command line, I find out egrep (yeah yeah, grep -E, whatever Fedora I don't care if it's deprecated) does not support grouping like I thought it did. I had a long list of numbers I needed surrounded by some letters (ABCD123DC ...), so I run:

code:
[usr@comp]$ egrep -e \[A-Z]\{4}\(\[0-9]\{3}\) list.txt
..results...
[usr@comp]$ echo $1

[usr@comp]$
Then I'm like, "Wait, if grep matches all the results at once, how do I get $1 for each result?"

After googling for answers to no avail, I come up with this hack:

code:
$ egrep -e \[A-Z]\{4}\[0-9]\{3} list.txt -o | egrep -e \[0-9]\{3} -o >numbers.txt
Like, yeah, I figured it out, but it took me like half an hour and I'm getting pissed off that I need to pipe commands into other commands to do anything remotely complicated. How else should I have done this?

Adbot
ADBOT LOVES YOU

TheGopher
Sep 7, 2009

ToxicFrog posted:

$1 doesn't mean what you think it does - it's "the first argument to this shell script or function". It doesn't magically change because you ran another program. While other programs (like awk) may use it to mean different things, the shell doesn't know about those other meanings, nor does it retain those meanings when used outside those programs.

Makes sense, and thanks for the info. I couldn't find any info about using results from regex grouping and grep so this actually clears up some of my earlier confusion. (Curse you DOS for storing variables until the prompt is closed. :argh:)
[/quote]

quote:

If it's too complicated for that, on generally writes a small script, either in bash itself or in something like awk or perl.

To do this, I'd probably do exactly what you did, only with singlequotes rather than backslashes so that it's less ugly:

code:
egrep -o '[A-Z]{4}[0-9]{3}' list.txt | egrep -o '[0-9]{3}' > numbers.txt


Erasmus Darwin posted:

Try this:
perl -ne 'print "$1\n" if /[A-Z]{4}([0-9]{3})/;' list.txt

Personally, I'll only use fgrep these days. If it gets more complicated than fgrep, I switch to perl. That way, I've got a regexp engine that I'm familiar with (and which is well documented via 'man perlre'), and I've got a full programming language backing me up if I want to do something complicated.

The perl suggestion is a great idea, since I use regex searches pretty extensively, and I'm more familiar with Perl's regex syntax than grep.

Thanks for the help!

TheGopher
Sep 7, 2009
After a modestly intelligent discussion on regex and grouping with egrep, today I made a pretty dumb mistake while being compltely absentminded. I was trying to make my samba share easier to access when using the gui file explorer...

code:
# sudo mount --bind /share ~/
Queue me going "gently caress" immediately after hitting enter. I try to unmount it, but of course the volume's busy. I was having weird graphic corruption when using ctrl + alt + 1 to go to single user mode, so I tried to make another account to at least see what I was doing. That didn't work, of course. I say gently caress it, go to single-user and try to type "sudo umount /share ; reboot"

It worked, and I got single user mode back from graphic corruption! I know I'm doing way better with linux when I can recover from dumb poo poo like the above. A few years ago I would have said "gently caress it" and just installed windows.

TheGopher
Sep 7, 2009
Ah, my misunderstanding of how --bind works. Thanks for clearing that up!

TheGopher
Sep 7, 2009
I installed Fedora 14 on my eeePC netbook at home and had literally 0 problems with drivers or otherwise. Fedora has proprietary drivers if you enable the non-free yum repository, should things not work out of the box. Also, if you need to use RDP for work, I'd highly, highly recommend Remmina. I'm not sure what Ubuntu has installed by default for remote desktop (VNC or otherwise) but I know vinagre is the default on Fedora and it's a total piece of poo poo, and doesn't even support RDP out of the box to boot.

Unrelated, if I were interested in becoming a *nix sysadmin down the road what would be the best way to make myself qualified for the job? I don't have a college degree to prop up my resume, so I'm assuming I would need a few certs. I'm not a linux guru by any means, and only started using it on a very regular basis within the last 6 months, so obviously continuing to use it and work with it is going to only increase with time, but I definitely want to learn faster than waiting to make mistakes and puzzling out how to fix them.

I guess the question really is, should I focus on official qualifications (e.g. certifications), or should I be immersing myself in linux, learning as much as I can, and worrying about the qualifications down the road? Maybe there's something else I'm not thinking of or don't know about, but feedback/advice is greatly appreciated.

TheGopher
Sep 7, 2009

rt4 posted:

Run Linux at home and solve as many problems as possible with no GUI (except a web browser for documentation reference). Type some long commands involving grep and xargs or maybe parallel for bonus points. Do some shell scripting. Learn Perl; you will encounter it eventually and it might be a quick fix in some stick situations.

Then, if you've got the money, get the certification. I'd say Red Hat Certification...

Bob Morales posted:

Do you have a little bit of money?

Setup a network at home...

...making it run well and learning what to do when things gently caress up is what it's all about.

Thanks for the very useful advice, both of you! I started doing a little bit of learning-at-home by turning my netbook into an ssh/vnc/general purpose box I can access at work, (Been super useful using nmap outside of my work network for troubleshooting connectivity issues with clients.) but what you guys are saying I should do is a bit more focused, and that's exactly what I need.

I do have a bit of money to sling around, and I really like the idea of setting up a few servers at home to toy around with. If I got two of something like this, ($210 one) what I should be going for? The $210 one doesn't have a redundant power supply, but I obviously wouldn't be using them as production servers so I'm not too concerned. If I'm going to spend this much money, is there some place online I should look at that has comparable prices, or is CL my best shot?

In terms of the immersion, I'm already getting to a point where I would much prefer using a CLI than a GUI configuration tool. I'm definitely lacking in terms of utilizing the power *nix shells provide, but part of the reason I think I want to do *nix admining is because I see the potential of working almost exclusively with a command line. I checked out that Unix Power Tools book, and it looks incredibly interesting so I'll be picking that up at some point. There's a lot of other stuff you both have mentioned that I've started doing but haven't gone far with, but that was the point of coming here, to make sure I'm heading in the right direction while getting some new ideas.

On a tangent, I've heard the age old adage, "If you learn RedHat/Fedora/Suse/Mandriva, you know RedHat/Fedora/Suse/Mandriva. If you learn Slackware you know Linux." and I'm curious if it'd be worthwhile to play with Slackware, or should I save that for down the road when I've got some more experience under my belt and it won't be so frustrating?

Also, learning with SELinux enabled, yea or nay? I have it enabled on both of my Fedora machines, but it's definitely caused some headaches. Documentation is thorough at least...

TheGopher
Sep 7, 2009
I have a few weird graphic corruption issues with the proprietary ATI driver on Fedora, if that's what you're using. It's a huge piece of poo poo and sets off SELinux like nothing else I've seen.

TheGopher
Sep 7, 2009
I'm not at my computer at home, which has OS X, but I can tell you that terminal on OS X seems to do everything the opposite of how everybody else does it. That being said, check out tset.

TheGopher
Sep 7, 2009
So I'm going through Linux from Scratch at the moment, and I'm learning quite a bit. I'm finding it hilarious how inconsistent the book is at explaining what you're doing. It just coddled me through a "for" loop, but doesn't even bother to explain what the actual purpose of linkers and loaders are, and doesn't hesitate to reference them every paragraph. You also never have to figure out a command for yourself, but when instructing you to perform a sanity check:

quote:

If the output is not shown as above or there was no output at all, then something is wrong. Investigate and retrace the steps to find out where the problem is and correct it. This issue must be resolved before continuing on. Something may have gone wrong with the specs file amendment above. In this case, redo the specs file amendment, being careful to copy-and-paste the commands.

Yeah hang on and let me just "find out what the problem is." Thanks book.

Getting annoying having to type all these commands in, since I'm building from a the LFS Live CD and a virtual machine. Makes it slightly stressful because one typo and I might have to start over. I have no idea how to troubleshoot and resolve issues, and google results for a couple of issues I had early on returned no fruitful results.

TheGopher
Sep 7, 2009

BagelMaster posted:

So I want to run a headless Ubuntu box. The problem is, I want to be able to VNC into it, especially for my roommates who are interested in linux but are too overwhelmed to only use SSH. Without any inputs into the machine, I can't seem to get VNC to work. I'm assuming it's because I haven't actually logged in and started up a desktop session, so there's nothing to show, thus rendering VNC useless. Is there an easy way around this?

I primarily just want to use this as a seedbox and for allowing people to access the media files on it and on the connected external harddrives.

I actually just had this issue with a Fedora 14 install. The issue is that VNC is installed to only allow viewing of the current desktop session, as you said yourself.

What you need to do is set up vncserver to use its own desktop session. For instance, when I connect to my Fedora box on port 5901, I get a gnome session on display 1 that is separate from the one you would get sitting at the computer.

I'm recanting this off the top of my head with a couple of quick google searches supplmenting, and I used tigervnc, so I'm not sure if this is right, but it should put you in the right direction. You may need to install another package or two, I know I had to with tigervnc-server:

In /etc/sysconfig/vncservers:
code:
VNCSERVERS="1:$user"
VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp"
After you've added that, create a password for the session:
code:
# su $user
# vncpasswd
Do all your other linux trickery, update firewalls for port 5901, service auto-starting, etc. I haven't really used ubuntu, so I don't know what you need to do.

After that's done, you can connect to 5901 for the vnc session. You can add other users so they get their own VNC sessions on 590X, where X corresponds with the display you specified in /etc/sysconfig/vncservers.

TheGopher
Sep 7, 2009
I've been using Linux on a daily basis for 6 months or so now, and I still don't remember the syntax to anything.


waffle iron posted:

It's easy, you just have to remember that it's the same order of arguments as cp.

I love you so much. Why did I not make that connection myself?

TheGopher
Sep 7, 2009
Erm, shouldn't take more than a few minutes to get regex going for the "FN:MISTER DUDER" part. Not sure how to only extract the first part of the file and ignore the rest, but here's your regex:

code:
egrep '^FN\:[A-Za-z]*' $file
You'll probably need to use perl to do what you're trying to do.

TheGopher
Sep 7, 2009
Just got my LFS system to boot for the first time! Pretty loving happy, since I was so pessimistic thinking I'd never get it to work!

TheGopher
Sep 7, 2009
It's only as much of a learning experience as you make it to be. You're not going to learn anything if you just type the commands in as instructed. The cool part is you get to see where each of those utilities and commands you use every day come from. I was already pretty overwhelmed working through it, so I didn't spend as much time learning about things as I should have, but I plan on doing it again, or at least with slax, on the HP rack server I have, and taking the time to really learn about what I'm doing.

I did, however, get a feel for exactly how linux works. There's a lot I did learn that's immediately applicable and going to help me out tremendously. It is really tedious, but I was playing a shitload of Monday Night Combat while waiting for poo poo to compile over the weekend. The tediousness did get to me, and I was really only an hour, hour and a half away from being finished, but after working on it for like 15-20 hours over the weekend, I had to take a break because I was so overwhelmed. That's why I finished today, and not Sunday night.

TheGopher
Sep 7, 2009

waffle iron posted:

I see Linux From Scratch as "how to use GNU autotools". Which in the scheme of things isn't a huge deal.

Thanks for trying to diminish what I thought was an accomplishment, but there's more to it than that!

LFS on its own isn't designed to be the end-all resource for learning Linux. In fact, it's designed to be a introduction and a leaping point for Beyond LFS which includes most packages that come with modern Linux distros.

TheGopher
Sep 7, 2009
Have you tried booting from rescue mode? Guide here.

TheGopher
Sep 7, 2009
Can you copy and paste the contents of /etc/samba/smb.conf?

TheGopher
Sep 7, 2009
You should reread this:


spoon0042 posted:

In your case you either need to change the group of LVM Pool and set it to (at least) 710, or set it to 711 without changing the group.

TheGopher
Sep 7, 2009
Try 751.

fake edit: If that doesn't work, try 771, then 775. You should avoid using 777 if possible.

TheGopher
Sep 7, 2009

General_Failure posted:


Would this be the relatively smart way to go about it?

Two pages back champ: http://forums.somethingawful.com/showthread.php?threadid=2389159&userid=0&perpage=40&pagenumber=213#post387567497

TheGopher
Sep 7, 2009

Misogynist posted:

find /path/to/backups -type f -mtime +365 -exec rm -f {} +

Trying to figure this one out because I haven't used find like this, and I'm curious about a few things:

"-mtime +365" is saying only include files modified more than 365 * 24 hours ago, right? Could I use -mtime -7, for example?

"rm -f {} +" This part I get, delete with no prompt all matching files, but I'm not sure what the '+' is used for here. The examples I see have the curly braces single quoted, but maybe it has to do with the use of the '+'?

TheGopher
Sep 7, 2009
Does it work if he uses the full path? e.g. /sbin/init?

TheGopher
Sep 7, 2009

Dotcom656 posted:

So I've been convinced to try running a Linux distro on my laptop and the only thing I have around is a 2GB flash drive.
I got the ISO bootable on the flashdrive using the tool from the Ubuntu website but whenever I go to boot linux using "run from flash drive" it shows the boot screen and then corrupts and shows garbage all over my screen and I just end up powering off my laptop. but windows doesn't do this at all and I'm not sure why this keeps happening.

Laptop is an Asus G60JX with an Intel i5, 4gig DDR3 and Nvidia GTS360m

I would just try to make a bootable DVD if I had any around.

Make sure the stick isn't faulty. I was struggling with a 2gb stick on and off for a month, trying to figure out why, no matter what I did, it wouldn't properly boot. I tried a different stick and immediately was able to get it up and running. I would have beaten myself up if it were physical possible,

If that's not possible, try UNetbootin which is what I used to make a bootable Fedora stick in Windows.

TheGopher
Sep 7, 2009

Dotcom656 posted:

I don't think the stick is faulty. and I tried netbootin and nothing changed. I don't have another flash drive to try so I'll see if I can use a live CD from the computing lab tomorrow.

I did a google search for "GTS360m ubuntu" and this was the first result:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/657736

Comment #38:

Marius Kruger posted:

> Is it any way to enable safe video mode for installer?

On the installer menu, I think you press F6 and then check "nomodeset"

The very last comment on the page mentions installing additional drivers. I'm guessing these are the proprietary Nvidia drivers, and you can google around for a guide. If you're going to start using Linux, get used to googling extensively for solutions to problems.

TheGopher
Sep 7, 2009
Third google result for "openvpn": http://openvpn.net/index.php/open-source/documentation/howto.html

TheGopher
Sep 7, 2009

Sizzlechest posted:

A google search tells me the best way to do it? Because if that's what you just did to come up with that recommendation, please stop posting.

No, but if you said "what's the best way" instead of saying, "I'm reading you can use $method_a or $method_b, but I don't know if those will work. Anybody know the best way?"

The second way shows you did at least a ten second google search. The way you asked the question is just begging for hand-holding. You couldn't have spent more than 20 seconds writing that post, so you're going to tell people to gently caress off when they don't spend more than 20 seconds replying to yours?

TheGopher
Sep 7, 2009
I don't know if anybody here has any experience with Cassandra, but I'm getting pretty frustrated. I've been messing around with some stuff and decided to set up a Reddit clone and hopefully learn something in the process.

On my Debian 6 server, I can get the Cassandra daemon to run just fine. I can connect to the instance with casssandra-cli, but for some reason it isn't loading the keyspace defined in /etc/cassandra/cassandra.yaml. I'm really not sure what I'm supposed to do next, because from my understanding that's all I need to do. I've been searching around, and I saw a reference to LiveSchemaUpdates, but I can't find anything about why the keyspace isn't important from the YAML file.

TheGopher
Sep 7, 2009

TheGopher posted:

I don't know if anybody here has any experience with Cassandra, but I'm getting pretty frustrated. I've been messing around with some stuff and decided to set up a Reddit clone and hopefully learn something in the process.

On my Debian 6 server, I can get the Cassandra daemon to run just fine. I can connect to the instance with casssandra-cli, but for some reason it isn't loading the keyspace defined in /etc/cassandra/cassandra.yaml. I'm really not sure what I'm supposed to do next, because from my understanding that's all I need to do. I've been searching around, and I saw a reference to LiveSchemaUpdates, but I can't find anything about why the keyspace isn't important from the YAML file.

I figured this out. Issue was I thought schematool HOST PORT import uses JMX, not RMI, and as such needs to connect on port 8080, not 9160...

Yeah I don't really know what the gently caress I'm doing. At least I'm learning something about Cassandra...

TheGopher
Sep 7, 2009
Any reason you can't just run the script like: ./script.sh &

TheGopher
Sep 7, 2009
Not sure what filesystem it needs to mount, but FreeBSD has a SPARC64 Live CD. If the machine is 32-bit SPARC that will be trickier. OpenBSD is only one of two *nix distributions that still has 32-bit SPARC support, and I can't remember the other: OpenBSD 4.8 here.

TheGopher
Sep 7, 2009

Crackbone posted:

Having a samba nightmare.

Running Fedora 14. What I'm hoping to do is setup a share with anonymous r/w access for some Win 7 and Xp/2003 machines which are on a AD domain. Furthest I can get is having the share visible but not accessible (attempting to access the share gives me the generic "not accessible" error). This happens on both machines.

Hoping to get a little bit of handholding on this - I've looked around and tried dozens of different variations in the smb.conf file, changing file permissions/owners but something is sailing over my head.

Can anybody post a basic config that should allow what I'm looking for? At this point I don't really care where the share is located, I just want to get something up and running. I've heard that Win 7 complicates things, so I'd even settle for getting access from the xp/2003 machines.

Not accessible is a permissions error. Check the logs for more info, and try using SWAT if you're having a lot of trouble. I can post my smb.conf once I'm at work, as that machine is running Fedora 13 and hosts a share as you describe.

TheGopher
Sep 7, 2009
The following works on my Fedora 13 machines with samba-3.5.8-74.fc13.i686.

code:
[global]
        server string = Samba
        interfaces = eth0, $local_ip/255.255.255.0, 127.0.0.1/255.0.0.0
        map to guest = Bad User
        guest account = ftp
        lanman auth = Yes
        client lanman auth = Yes

[samba]
        comment = Samba share
        path = /share
        read only = no
        guest ok = yes
This lets me anonymously read and write to /share. Permissions for /share are:

# ls -ld share
drwxrwxrwx. 24 $user root 4096 Apr 19 17:05 share


I probably could do better with those permissions, but I'm not too concerned as this is not a public-facing terminal and I was having difficulties getting it to work.

TheGopher
Sep 7, 2009

Crackbone posted:

Thanks for the config, I'll give it a shot. Did you have any issues with SELinux settings? Coworking is swearing up and down that's part of the problem.

I disabled SELinux because I finally got fed up with dealing with it and the lovely proprietary ATI driver. That being said, SELinux should not be an issue, as those settings were working fine without fiddling with SELinux before I disabled it.

(Make sure you change $local_ip to your actual local IP address if you didn't know already)

TheGopher
Sep 7, 2009
I just want to share my most recent accomplishment with people that might actually understand what I'm talking about. Was getting annoyed with a pretty outdated version of Remmina on Fedora, so I downloaded the source and built the RPM myself!

Promptly afterwards I had to delete it and reinstall the old version because 0.9.3 doesn't come with the VNC plugin by default, and I had work to do. I'm trying to make a spec file for the plugins package, but I was able to rely on the existing spec file for the previous RPM build, but after playing with it so far it doesn't seem particularly tricky.

TheGopher
Sep 7, 2009
All the cool kids are using Arch in general, but not sure about specifically for KDE. Fedora is alright, and comes with good KDE support, but after using it daily for almost a year now my main gripes with it come from it not getting as much attention and support as Debian/Ubuntu.

I've only ever used Gnome, so I can't really speak about KDE. Each time I've tried KDE however, there was nothing about it that's really stood out to me as a reason to switch to it from Gnome. I don't need much fancy or flashy functionality out of my GUI, and besides OpenOffice, Pidgin, Remmina, a mail client, and Chrome, I don't really need a GUI.

TheGopher
Sep 7, 2009

Bob Morales posted:

I just had F14 the way I wanted it with GNOME. But it just feels so...old. I honestly haven't given KDE a whirl in a very long time. Like since Caldera or something ancient.

Yeah I know what you mean with it feeling old, but after awhile you stop noticing the aesthetics and solely focus on the functionality anyway.

Besides, if I were going to use an OS for "pretty" factor I would use OS X.

TheGopher
Sep 7, 2009
I prefer:

code:
rev `tail -n1 filelist.txt` > file.txt; rev file.txt | less

TheGopher
Sep 7, 2009
Probably will need to use the Google Docs API. Shouldn't be too hard to write something in Python for it, and you can always expand the functionality of whatever you're using it for pretty easily.

TheGopher
Sep 7, 2009
If you're feeling lazy use SWAT for Samba. Makes something already easy even easier.

Adbot
ADBOT LOVES YOU

TheGopher
Sep 7, 2009
I'm looking for some good reference books, mainly for shell scripting and general use. I read somewhere that Unix Power Tools is top-notch, but after looking around on amazon I saw Practical Guide to Linux Commands and seemed like what I'm looking for. I make extensive use of man pages, but sometimes I need something quick and dirty with good examples, something lacking from most man pages. I'm not just looking for general reference books, so if you know of an amazing book that's a little more specific to a particular topic I'd be interested to hear about it.

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