|
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:
After googling for answers to no avail, I come up with this hack: code:
|
# ? Dec 16, 2010 02:42 |
|
|
# ? Apr 27, 2024 02:36 |
|
How do I use patterns with the tree command? Im trying this: tree -aP *.avi|*.mvk|*.mpg|*.MPG /mnt/video/documentaries/ > /mnt/docs.txt but it only finds .avi files, it says that *.mvk,mpg and MPG arent commants. I thought adding "|" between the files let met use multiple patterns.
|
# ? Dec 16, 2010 02:50 |
|
TheGopher posted:Then I'm like, "Wait, if grep matches all the results at once, how do I get $1 for each result?" 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. rugbert posted:Im trying this: The problem is that the shell is parsing the '|' as pipe symbols between commands. It's not being passed to tree as an argument. You want to do this: tree -aP '*.avi|*.mvk|*.mpg|*.MPG' /mnt/video/documentaries/ > /mnt/docs.txt (or you could do this: tree -aP \*.avi\|\*.mvk\|\*.mpg\|\*.MPG /mnt/video/documentaries/ > /mnt/docs.txt Note that in this case, the '*' needs to be escaped, too.)
|
# ? Dec 16, 2010 03:09 |
|
TheGopher posted: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: $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. quote:After googling for answers to no avail, I come up with this hack: Piping is generally how this sort of thing is done, yes. As a rule, one accomplishes complicated tasks by piping together commands that perform simple tasks. That's what pipes are there for. 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:
|
# ? Dec 16, 2010 03:25 |
|
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. ) [/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. Erasmus Darwin posted:Try this: 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!
|
# ? Dec 16, 2010 04:37 |
|
TheGopher posted: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. I can't actually find any information on using grouping with grep except in the operator-precedence sense - that is to say, 'a(abc)+' and 'aabc+' are different regexes to egrep, but there's no way to extract the 'abc' part from the former. In general, though, if a program doesn't have whatever further processing you need built in, the answer is "pipe it to something else". The design philosophy here is lots of relatively specialized programs plus some simple mechanisms (pipes, IO redirection, shell variables, job control) to connect them together. quote:(Curse you DOS for storing variables until the prompt is closed. ) Bash does actually* store variables until exit: * I'm skipping over the whole discussion on how subshells, and related activities like pipes and parallel processing, affect this. code:
So, for example: code:
ToxicFrog fucked around with this message at 04:57 on Dec 16, 2010 |
# ? Dec 16, 2010 04:52 |
|
I've been trying to remember the name of a program and was run on a system once from a known-good setup and would then subsequently alert if any changes were being made. The only other thing I can remember is that the documentation recommended that it be stored on a flash drive to prevent it being compromised. Any ideas?
|
# ? Dec 17, 2010 03:46 |
|
angrytech posted:I've been trying to remember the name of a program and was run on a system once from a known-good setup and would then subsequently alert if any changes were being made. The only other thing I can remember is that the documentation recommended that it be stored on a flash drive to prevent it being compromised. I think you are thinking of OSSEC: http://www.ossec.net/
|
# ? Dec 17, 2010 04:02 |
|
Virigoth posted:I think you are thinking of OSSEC: I don't think so, but this looks really tight too, so thank you.
|
# ? Dec 17, 2010 04:11 |
|
angrytech posted:I don't think so, but this looks really tight too, so thank you. Fair warning, it will email you about EVERYTHING that changes...lol...I'd give it its own mailbox if you plan on using this.
|
# ? Dec 17, 2010 04:21 |
|
Virigoth posted:Fair warning, it will email you about EVERYTHING that changes...lol...I'd give it its own mailbox if you plan on using this.
|
# ? Dec 17, 2010 06:13 |
|
Misogynist posted:Or, you know, just tune your rulesets correctly and generate one report at the end of the day. Eh that requires and I don't have it on any of my systems currently
|
# ? Dec 17, 2010 06:19 |
|
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:
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.
|
# ? Dec 17, 2010 06:27 |
|
TheGopher posted: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. Secondly, anything you do with mount won't be permanent unless you add it to /etc/fstab, in which it'll be mounted during boot. So no, you wouldn't have hosed over your system this way anyhow.
|
# ? Dec 17, 2010 07:33 |
|
Ah, my misunderstanding of how --bind works. Thanks for clearing that up!
|
# ? Dec 17, 2010 17:46 |
|
I have a weird problem. Kinda moot since there's a workaround, but: The wireless internet connection is shared among the two apartments in the house I live in. The router is in the other guy's apartment. All was fine until the old (linksys) router stopped working, and the dude got a new one (netgear wgr614 i think?). His computer and his son's laptop (both running Windows) connect just fine. My laptop (debian lenny) would associate with the router, but the router refuses to assign it an IP address. Same with my desktop (debian squeeze), Wii, and Blackberry. Friends'laptops connect just fine as long as they are running Windows. The workaround is to assign a static IP to all my non-Windows devices. Then I can get an internet connection just fine. I get output similar to this from dhcpd: code:
So why the hell would the router not give a DHCPOFFER to non-Windows machines? How would it even know?
|
# ? Dec 17, 2010 21:32 |
|
TheGopher posted: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...
|
# ? Dec 17, 2010 23:32 |
|
Is there a way to "reload" the title of an xterm? I don't know if it's screen or mutt, but I'm currently running irssi and it still says "mutt: mail/local/blabla". FAKEEDIT: Just checked, title stays after I exit mutt, so disregard the irssi bit.
|
# ? Dec 20, 2010 13:15 |
|
mike12345 posted:Is there a way to "reload" the title of an xterm? http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#s4
|
# ? Dec 20, 2010 14:02 |
|
dr go hog wild posted:I have a weird problem. Kinda moot since there's a workaround, but: Try seeing if you can do a tcpdump on the wlan0 interface to see anything more. Might give you a bit more information, though DHCP issues can be extra annoying, Do you have access to the router to see if you're showing up under known hosts?
|
# ? Dec 21, 2010 16:53 |
|
I asked this over in the Ubuntu thread, but I don't know if it's really related to Ubuntu, so I'll ask here as well...Thermopyle posted:Not sure if this is Ubuntu specific or not...
|
# ? Dec 21, 2010 20:53 |
|
Thermopyle posted:I asked this over in the Ubuntu thread, but I don't know if it's really related to Ubuntu, so I'll ask here as well... You don't have WD Greens or anything do you?
|
# ? Dec 21, 2010 20:55 |
|
Bob Morales posted:You don't have WD Greens or anything do you? Nope.
|
# ? Dec 21, 2010 20:56 |
|
Thermopyle posted:I asked this over in the Ubuntu thread, but I don't know if it's really related to Ubuntu, so I'll ask here as well... I believe this is the kernel process for periodic writing of data from the filesystem buffers to the underlying devices -- which makes sense for why it gets dinged with the I/O.
|
# ? Dec 21, 2010 21:24 |
|
Thermopyle posted:I asked this over in the Ubuntu thread, but I don't know if it's really related to Ubuntu, so I'll ask here as well... I use this, but I don't have anywhere near the same ammount of data that you have.
|
# ? Dec 21, 2010 23:54 |
|
Thermopyle posted:I asked this over in the Ubuntu thread, but I don't know if it's really related to Ubuntu, so I'll ask here as well... If you want to improve disk performance add noatime as an option in fstab and remount or do it manually: mount -o,noatime,remount / You can also check out ionice. It does what nice does for CPU but for I/O. Also you can install systat to use iostat to check total %. To go along with that the dstat command rules, it can give you an overview of everything and color codes it to show bottlenecks, but I don't know how much help all this is as most of my experience tuning is from web servers.
|
# ? Dec 24, 2010 02:38 |
|
JHVH-1 posted:If you want to improve disk performance add noatime as an option in fstab and remount or do it manually:
|
# ? Dec 24, 2010 03:09 |
|
JHVH-1 posted:If you want to improve disk performance add noatime as an option in fstab and remount or do it manually: I don't know how applicable this is really. I mean, the disk performance is great until that "flush" command shows up for several minutes maybe every 30-60 minutes (just a guess) and makes all other processes disk I/O drop to zero while it does...whatever.
|
# ? Dec 24, 2010 03:13 |
|
Zom Aur posted:This shouldn't be necessary since kernel-2.6.3* (IIRC) where they started using relatime by default. Ahh thats good to know. Most of our stuff is on CentOS 5 so it hasn't gotten there yet, but CentOS 6 will finally have a newer kernel. Those kernels also should support using ext4 features on an ext3 filesystem. So if a home OS is ext3 you can mount it as ext4. But since I haven't tried it I can't see how much of a performance gain that gives seeing as it doesn't have all the ext4 features.
|
# ? Dec 24, 2010 03:30 |
|
I didn't have to work today, so I spent the morning getting Enlightenment to build on Debian Lenny Here's the download page: http://www.enlightenment.org/p.php?p=download&l=en Install all the pre-requisites: apt-get install libx11-dev libxtext-dev x11proto-xext-dev pkg-config doxygen zlib1g-dev libpng libjpeg62-dev libfreetype6-dev liblua5.1-0-dev libdbus-1-dev libfontconfig1-dev Download all of the following: http://download.enlightenment.org/snapshots/2010-12-03/elementary-0.7.0.55225.tar.gz http://download.enlightenment.org/snapshots/2010-12-03/enlightenment-0.16.999.55225.tar.gz http://download.enlightenment.org/releases/eina-1.0.0.beta3.tar.gz http://download.enlightenment.org/releases/edje-1.0.0.beta3.tar.gz http://download.enlightenment.org/releases/efreet-1.0.0.beta3.tar.gz http://download.enlightenment.org/releases/eet-1.4.0.beta3.tar.gz http://download.enlightenment.org/releases/evas-1.0.0.beta3.tar.gz http://download.enlightenment.org/releases/e_dbus-1.0.0.beta3.tar.gz http://download.enlightenment.org/releases/eeze-1.0.0.beta3.tar.gz http://download.enlightenment.org/releases/ecore-1.0.0.beta3.tar.gz http://download.enlightenment.org/releases/embryo-1.0.0.beta3.tar.gz Extract all the files. Build the sub-components in this order: (cd, configure, make, make install) Eina Eet Evas Ecore Embryo Edje Efreet E_Dbus Eeze ecore: configure --enable-ecore-evas-software-x11 evas: configure --enable-fontconfig Next, build Enlightenment and Elementary. You should be all set after that. I haven't played with it to add any menus or themes or anything, but it does work on my system. VirtualBox, fresh 5.07 install. Probably try it on a real machine after the holidays.
|
# ? Dec 24, 2010 05:03 |
|
Forgive me if this was brought up recently, but I'm intimidated by the sheer size of the thread. I'm going to be using a sole, small SSD for / and everything else in an Ubuntu Server install, with four hard disks being placed natively in a pool for zfs-fuse and mounted in /media. I will have 8 GB of RAM I do not anticipate will be stressed significantly, as it will mostly be used by the zfs-fuse prefetch cache and will deallocate itself when/if other processes need memory. 1) What special procedures/config tweaks do I need to follow to align partitions, stop spindle-disc optimizations, etc. because of the SSD? 2) I feel I want to disable swap. Can/should I? If so, how? Primary reason is to extend the SSD's life.
|
# ? Dec 24, 2010 07:03 |
|
Factory Factory posted:2) I feel I want to disable swap. Can/should I? If so, how? Primary reason is to extend the SSD's life. It's pretty unlikely you'll need swap with 8gb (depending, of course, on what you're doing with the server). Just open /etc/fstab and comment out the lines that are designated swap, then run the command `swapoff -a`. Or if you're installing the OS for the first time, just skip the swap partition creation. If you change your mind, the kernel supports swap files similar to Windows pagefiles. They offer identical performance to swap partitions and can be added/resized/removed with minimal work.
|
# ? Dec 24, 2010 09:13 |
|
JHVH-1 posted:Ahh thats good to know. Most of our stuff is on CentOS 5 so it hasn't gotten there yet, but CentOS 6 will finally have a newer kernel. Those kernels also should support using ext4 features on an ext3 filesystem. So if a home OS is ext3 you can mount it as ext4. But since I haven't tried it I can't see how much of a performance gain that gives seeing as it doesn't have all the ext4 features. I don't know if there'd be any real performance increase by mounting the old filesystem as the newer one, if you don't convert it. However, by converting it you'll break compability with the old ext3-systems, so unless those systems also can handle ext4 you might not want to. Just something to keep in mind. You can read more about it here. Bob Morales posted:I didn't have to work today, so I spent the morning getting Enlightenment to build on Debian Lenny...
|
# ? Dec 24, 2010 13:38 |
|
Zom Aur posted:
Probably not. I looked around for a little bit, and saw some other scripts that were setup to do it automatically, but people were complaining about them being broken or out of date.
|
# ? Dec 24, 2010 16:04 |
|
I have gotten a strange problem with SSH on a ubuntu machine ever since I upgraded it to 10.10. First off: The server is up and running with port-forwarding working. I can access it from any other device I have tried, so I am pretty sure theres nothing wrong on the server side. However this particular machine is giving me problems. The error i am getting is: code:
I tried to purge SSH, removing old keys etc. and did a reinstall, but still no dice. Theres no other issues at all with networking, web traffic and ftp is working with no problems. I have no clue whats causing it, so hoping someone could point me in the right direction.
|
# ? Dec 26, 2010 16:55 |
|
Bohemian Cowabunga posted:I have gotten a strange problem with SSH on a ubuntu machine ever since I upgraded it to 10.10. Can you SSH to the IP? It looks like a DNS issue, not an SSH issue.
|
# ? Dec 26, 2010 17:24 |
|
FISHMANPET posted:Can you SSH to the IP? It looks like a DNS issue, not an SSH issue. I always use the IP. I did try to change DNS on the machine to googles, but no dice still.
|
# ? Dec 26, 2010 17:34 |
|
It's complaining about DNS. Put a hostname for IP-redacted in /etc/hosts or edit /etc/ssh/sshd_config and toggle/comment out UseDNS (and restart the ssh server).
|
# ? Dec 26, 2010 17:48 |
|
bort posted:It's complaining about DNS. Put a hostname for IP-redacted in /etc/hosts or edit /etc/ssh/sshd_config and toggle/comment out UseDNS (and restart the ssh server). I really dont want to fiddle with the server if i dont have to, since its been working fine for a good 1,5 years now and its working perfectly with any other device than this particular computer. The server is using googles dns, but i really dont think its an issue on the server side. I should clarify that i have never used a hostname to connect to the server because i havent got a domain for it and never bothered setting it up with a DNS. It is my private fileserver located in my basement and i only use the hostname when on my localnetwork. *********** Edit: Okay for shits n' giggles I tried to install Putty on the machine and when using that i can connect to the server just fine. So it must be something in the SSH installation thats not working which is weird seeing i just purged the installation and reinstalled it. I dont get it.' Edit #2: Can also connect with sftp via filezilla. Ninja Rope posted:Well, ssh thinks you're giving it a hostname. Are you sure you're entering a proper IP address? Can you ping it? Bohemian Cowabunga fucked around with this message at 18:15 on Dec 26, 2010 |
# ? Dec 26, 2010 18:04 |
|
|
# ? Apr 27, 2024 02:36 |
|
Well, ssh thinks you're giving it a hostname. Are you sure you're entering a proper IP address? Can you ping it?
|
# ? Dec 26, 2010 18:09 |