[131010470010] |Getting text from last marker to EOF in POSIX.2 [131010470020] |I have a text with marker lines like: [131010470030] |I need to get a text from the last marker (not inclusive) to EOF. [131010470040] |In this case it will be [131010470050] |Is there an elegant way within POSIX.2? [131010470060] |Right now i use two runs - first with nl and grep for the last occurrence with respective line number. [131010470070] |Then i extract the line number and use sed to extract the chunk in question. [131010470080] |The text segments may be quite large so i'm afraid to use some text-adding method like we add the text to a buffer, if we encounter the marker we empty the buffer, so that at EOF we have our last chunk in the buffer. [131010470090] |Upd: 5 views for 24 hours, so i'll update the tags so incorrect ones:( [131010480010] |A two pass strategy seems to be the right thing. [131010480020] |Instead of sed I would use awk(1). [131010480030] |The two passes could look like this: [131010480040] |to get the line number. [131010480050] |And then echo all text starting from that line number with: [131010480060] |This should not require excessive buffering. [131010490010] |Use "tac" which outputs a file's lines from end to beginning: [131010500010] |The first sed ouputs line numbers of the "---" lines... [131010500020] |The second sed extracts the last number from the first sed's output... [131010500030] |Add 1 to that number to get the start of your "ccc" block... [131010500040] |The third 'sed' outputs from the start of the "ccc" block to EOF [131010500050] |Update [131010500060] |Well I was wondereing about how glenn jackman's tac would perform, so I time-tested the three answers (at the time of writing)... The test file(s) each contained 1 million lines (of their own line numbers). [131010500070] |All answers did what was expected... [131010500080] |Here are the times.. ( Glen wins!.... [131010500090] |I just noticed the comment that tac isn't Posix (but I'll use tac :) [131010500100] |glenn jackman [131010500110] |Gilles sed [131010500120] |Gilles awk [131010500130] |Gilles 'two-pass' [131010500140] |fred.bear [131010500150] |Mackie Messer [131010510010] |Unless your segments are really huge (as in: you really can't spare that much RAM, presumably because this is a tiny embedded system controlling a large filesystem), a single pass is really the better approach. [131010510020] |Not just because it'll be faster, but most importantly because it allows the source to be a stream, from which any data read and not saved is lost. [131010510030] |This is really a job for awk, though sed can do it too. [131010510040] |If you must use a two-pass approach, determine the line offset of the last separator and print from that. [131010510050] |Or determine the byte offset and print from that. [131010520010] |Unable to git clone over ssh [131010520020] |I created a bare git repository and pushed to as root. [131010520030] |Then I ran su myuser and ran the following commands: [131010520040] |Why is ssh failing? [131010520050] |I can clone it by using the local path, and whoami shows myuser -- I am not root. [131010520060] |Just to make sure I have the addr right I wrote ssh myuser@mybox.net -p 1234 by copy/pasting the info rather then typing it. [131010520070] |I don't understand why ssh isn't working. [131010520080] |I know i had it working on this remote box, but I upgraded from debian lenny to squeeze and recently I made various config changes. [131010520090] |I don't understand why I can't use git with ssh here. [131010530010] |erm, don't you need: [131010530020] |?? [131010540010] |How do i encrypt git on my server? [131010540020] |Heres the closest I've gotten: I installed gitolite in the /Private folder using ecryptfs-utils (sudo apt-get install ecryptfs-utils adduser git ecryptfs-setup-private then the rest was configuring gitolite using a root install). [131010540030] |It worked just fine as long as someone was logged in as the user git using a password (su git using root does not work). [131010540040] |Since the private folder activates through logging in with a password and gitolite uses RSA keys (required) the private folder is hidden thus error occurs. [131010540050] |Is there a way i can log into my server after a reboot, type in the password and have the git user private folder available until next time the machine restarts? [131010540060] |Or maybe theres an easy way to encrypt a folder for git repositories? [131010550010] |Sorry, can't post as a comment... [131010550020] |Maybe you could mount your ssh through sshfs and use encfs inside? [131010560010] |Use screen. just create a screen, su into the user and do what you need to do. [131010560020] |Detach from it by using Ctrl+A,d. [131010560030] |Then you should be able to disconnect without killing the process thus someone is logged in at all time. [131010570010] |Unix install best practices, append to path or link through [131010570020] |I have some software I am about to ship (gradschool project) and I want to know on a unix machine what the best practices are for installing software. [131010570030] |I originally linked through /usr/local/bin my project, but recently I looked into installing it by appending to the .bashrc file for the specific user, with the special case that if the user is root, it appends to the global path rather than user specific. [131010570040] |This bought me some easy functionality additions as I can quickly link to other resources with a single variable addition to the .bashrc folder of the installing user. [131010570050] |However, I am beginning to doubt this decision. [131010570060] |To append to path or not to append to path, that is the question. [131010570070] |Whether 'tis nobler to symbolic link in /usr/local/bin, or to take arms and append to an ever growing path variable. [131010570080] |More information: [131010570090] |It's a C++ back end with a TCL front end. [131010570100] |There is also a java archive (created much earlier in my career) that the TCL front end launches. [131010570110] |On top of this, there is a extension of the TCL front end that plays with another program with its own TCL interpreter. [131010570120] |I need to provide the bwidget tcl package to the program with the interpreter. [131010570130] |So providing the bwidget package and launching the jar file necessitates having a location to link to. [131010570140] |Further more, I need to make it easy on the users as they are primarily chemistry users and are not very familure with unix and might be on mac. [131010570150] |The platform nees to work on Mac or Unix. [131010570160] |Ideally I want the user to be able to launch the TCL script with a single command and not make them remember the location. [131010570170] |This is a previously closed source project that is now open source and we want users to be able to easily compile and install the program [131010570180] |I am using make to create an install option. [131010580010] |Don't symlink to either /usr/local/bin or mess with PATH. [131010580020] |Particularly not the latter. [131010580030] |Just write an installation program that installs stuff to a specified location. [131010580040] |Check a similar, preferably well-known program for how it does stuff. [131010580050] |If you can provide more details of your program, we could offer some concrete advice if you want it. [131010580060] |Also, nobody writes installation programs from scratch. [131010580070] |People customarily use programs like Make, Cmake, scons etc. [131010580080] |And some languages have specialist installation software like distutils for python, if you want to use it. [131010590010] |I've seen packages (usually stuff you wouldn't find on a distro's package repositories) that install themselves to /opt and add .desktop files to ~/Desktop and ~/.local/share/applications to launch them. [131010600010] |How to keep the content of the BuildRoot? [131010600020] |The good old rpm while building package in steps simply kept the content of the BuildRoot -- it was very useful for me, because if some piece of software was difficult to create, I could check BuildRoot if everything is OK. [131010600030] |Now, with all "improved" rpm -- the content of BuildRoot is deleted automatically, so I cannot really dive into it (installing step is not that long). [131010600040] |One hack I know of would be adding some kind of sleep at the end of install stage to rpm spec. [131010600050] |But this is ugly. [131010600060] |So -- QUESTION -- how to keep the content of BuildRoot in nice way -- in other words, how to disable auto delete once and for good? [131010610010] |Shell console clearing [131010610020] |Is there a way to clear up what is displayed on the shell console (in ubuntu linux) in just a single key or two? [131010610030] |When I get flood of lines from grep and that exceeds the height of the window, I want to quickly scroll back to the position where I typed the command after the prompt. [131010610040] |I can do so if I had opened a fresh terminal before I type the command, and just go to the initial position. [131010610050] |But if keep using the same terminal window, I have to manually find the position. Ctrl+l is not an answer because it just scrolls, and the contents of the terminal remains. [131010610060] |I cannot use less because the colored output of grep does not show up in color. [131010620010] |The [131010620020] |command, which is part of ncurses, and is located in the ncurses-bin package on Debian, will completely clear the console. [131010620030] |Is that what you want? [131010620040] |Brief summary of reset from the man page: [131010620050] |reset sets cooked and echo modes, turns off cbreak and raw modes, turns on new-line translation and resets any unset special characters to their default values before doing terminal initialization the same way as tset. [131010620060] |As discussed in http://superuser.com/questions/122911/bash-reset-and-clear-commands, and as pointed out by Erik in Shell console clearing, clear will just clear the screen, reset will (as bignose put it), "reset your terminal when it gets messed up by control sequences". [131010620070] |Personally, I'm good at messing up my terminal, and when I clear it, I'm not looking to get anything back that was there before, so I just use reset. [131010620080] |But ymmv. [131010630010] |It's not an answer to your question, but you can use less, and maintain your color see: http://serverfault.com/questions/26509/colors-in-bash-after-piping-through-less [131010630020] |hint: [131010640010] |I usually just use: [131010640020] |clear clears your screen if this is possible. [131010640030] |It looks in the environ- ment for the terminal type and then in the terminfo database to figure out how to clear the screen. [131010640040] |clear ignores any command-line parameters that may be present. [131010650010] |GPG check regarding packages on various distributions [131010650020] |It's ok that the various linux distributions use gpg to verify e.g. new packages downloaded with http. [131010650030] |But what happens if the server that holds the packages gets hacked? [131010650040] |OK, they need a new gpg key, but how do they guarantee that the new gpg keys are the valid gpg keys? [131010650050] |There is no valid gpg key until the new one gets downloaded to the client, so there is a window when the packages [containing the new gpg keys] are not "validated" with gpg keys. [131010650060] |Is there any method to give the new gpg keys to the clients in an "authoritative"/secure way? [131010660010] |The standard process to give new "authoritative" key is through a package that is signed with the old key. [131010660020] |If you trust the old key (and you trust GPG) then the new one is distributed in a package signed with the old one. [131010660030] |Now, you can begin to use the new one. [131010660040] |The packages can be hold on an insecure server as each package will be checked for correct signature. [131010660050] |A problem occurs only is the packaging private key is compromised. [131010660060] |I.e. the master key that sign all packages. [131010660070] |(Debian SecureApt, Ubuntu SecureApt, Fedora). [131010660080] |If it would happens once, it would be really ugly. [131010670010] |If only the server holding the packages is compromised, and not the private signing key, there's not much to do. [131010670020] |The old key remains valid, and packages modified by the attacker will be detected as such. [131010670030] |I assume your question is what happens if the signing key is compromised. [131010670040] |As long as the old key hasn't expired, people will continue to download the old packages, blissfully unaware that the key has been compromised. [131010670050] |Ideally the package management tool should check that the key hasn't been revoked (I don't know if apt, yum and friends do it). [131010670060] |However, the first step in responding to a compromise would be to stop distributing packages signed with the old key, and start distributing packages signed with the new key. [131010670070] |So any maliciously modified package would linger only in mirrors before they are updated. [131010670080] |When people start receiving packages signed with the new key, they'll get an error message telling them that the packages are unsigned. [131010670090] |This will hopefully prompt them into inquiring what is happening and trying to obtain the new key. [131010670100] |The compromise will also be announced in security mailing lists and in various industry news channels. [131010670110] |So if you follow these, you'll get notice. [131010670120] |Of course you should be wary of these as well: an attacker might compromise the list server or a developer's account and send a fake key compromise warning with a new public key that is actually for his own private key. [131010670130] |There's no magic bullet for distributing the new key. [131010670140] |You need a trusted channel to distribute the key in the first place, or more precisely to establish trust in the new key. [131010670150] |This is exactly as difficult as establishing trust in the old key. [131010670160] |(In other words, most people will get it from the HTTP website or from an unsigned CD image.) [131010670170] |You can get the new key from an HTTPS website, if you trust that the website (and the CA that made the site's certificate, and the browser you're using and its trusted base!) hasn't been compromised. [131010670180] |Or if you know and trust someone who has the key, you can ask them for it. [131010670190] |Note that above, I'm using “package” in a loose sense, assuming a simple model where the packages are directly signed with the distribution signing key. [131010670200] |In fact, in some distributions (e.g. all the ones that use APT), what is signed is files containing a list of cryptographic checksums of packages, and there's a two-stage process whereby the installer checks that the package has the expected checksum, and that the list has the expected signature. [131010670210] |The principle is the same: the attacker who compromised the key would inject both malicious packages and list files with the checksums for the malicious packages, signed with the compromised key. [131010670220] |The resolution requires restoring both the list files and the packages. [131010680010] |Is there an equivalent to whitespace-mode in emacs for vim? [131010680020] |Is there a way I can see spaces and tabs wonderfully visualized in vim, like I can in emacs by toggling whitespace-mode? [131010690010] |:set list [131010690020] |This will show you whitespace characters like tabs and EoLs. [131010690030] |It won't show spaces, however; to my knowledge that's not possible (except for non-breaking and trailing spaces), although in a monospace font any "space" that's not a tab would obviously be a space. [131010690040] |You can change the characters vim uses with the listchars option; type :help listchars to learn more about how to use that and what your options are. [131010690050] |This is what I use in my .vimrc file: [131010700010] |is there a way to make the prompt definition multiline? [131010700020] |This is my current prompt definition [131010700030] |and I'm working on integrating this. basically I'm starting to find it very unreadable. [131010700040] |is there any way that I can make it multiline in a way perhaps similar to what Perl cand do with regex's (e.g what /x mode does. like m{ ... }x. the ... can be multiline in that)? [131010700050] |something like this [131010710010] |You could do something like: [131010710020] |etc.? [131010720010] |since you're probably wanting a quick answer here's a solution [131010720020] |but please note that you can not comment inside a string [131010730010] |getting 256 colors to work in tmux [131010730020] |I have 256 colors working just fine in konsole, I thought I'd give tmux a try because unlike screen it seems to support vi mode. [131010730030] |However I find that the colors of my prompt show up, this i most likely because I have a 256 color mode prompt. what do I need to do to get tmux to recognize all 256 colors [131010740010] |Try setting 256 colors explicitly in your bashrc or zshrc: [131010740020] |or [131010740030] |If you have problems with tmux not clearing the background colors correctly when using the screen term setting, you can try: [131010750010] |The tmux FAQ ( http://tmux.cvs.sourceforge.net/viewvc/tmux/tmux/FAQ ) explicitly advises against setting TERM to anything other than screen or screen-256color in your shell init file, so don't do it! [131010750020] |Here's what I use: [131010750030] |and in in my .tmux.conf: [131010750040] |Aliasing tmux to "tmux -2" should also do the trick. [131010760010] |How to give a normal user permission to change root password [131010760020] |Please do not ask why, but is it possible to do it? [131010760030] |p/s: I know it's not a good thing, let's just say someone from the top management who is computer illiterate want some sort of control over the server. [131010770010] |Don't do that... you can either give them root's password or you could execute sudo passwd root (this assumes that sudo is set to use the users password or no password, and that passwd is a command that sudo has authorized to be run by that user). [131010780010] |Maybe you can add this line to the sudoer file (using visudo), replacing phunehehe with the username. [131010780020] |I don't know if that breaks your condition of a "normal user", though, because after that he/she has so much power. [131010780030] |EDIT: as per xenoterracide's comment :) [131010790010] |sudo is the swiss-army knife of customized permissions. [131010790020] |You could ask the user to run [131010790030] |To see how this might be enabled, here's a related example from the sudoers(5) manpage. [131010790040] |You'll have to invert the logic to achieve your ends, of course. [131010790050] |So, you would execute the visudo, and add a line like [131010790060] |to /etc/sudoers. [131010800010] |Can't he use run level 1 to change root password? [131010800020] |What I have in mind is [131010800030] |
  • Set grub password so that not every user can change the run level at boot time.
  • [131010800040] |
  • This password is given to the normal user who might need to change root password in future.
  • [131010800050] |
  • Now if needs arise to change the root password, he can modify grub parameters at boot time. [131010800060] |Press 'a', give grub password and then give 1, so that machine boots into run level 1.
  • [131010800070] |
  • Once in run level 1, he can change root password.
  • [131010800080] |The obvious disadvantage of this procedure is that machine has to be rebooted and while its in run level 1, it will be offline. [131010800090] |Kindly mention the flaws that you find in this procedure. [131010810010] |If you trust that user so that he has permission to change root password, it should be safe to give him the current root password in the first place. [131010820010] |If you don't trust the owner of the root account then there's probably no way to prevent that root user from removing this special permission. [131010820020] |If you do trust the root user then just ask him for the current password. [131010830010] |chroot "jail" - what is it and how do I use it? [131010830020] |Hi All, [131010830030] |I have heard/read a lot about the chroot jail under linux but have never yet used it (I use Fedora day-to-day), so what is a chroot "jail"? [131010830040] |When and why might I use it/not use it and is there anything else I should know? [131010830050] |How would I go about creating one? [131010840010] |A chroot jail is a way to isolate a process from the rest of the system. [131010840020] |It should only be used for processes that don't run as root, as root users can break out of the jail very easily. [131010840030] |The idea is that you create a directory tree where you copy or link in all the system files needed for a process to run. [131010840040] |You then use the chroot system call to change the root directory to be at the base of this new tree and start the process running in that chroot'd environment. [131010840050] |Since it can't actually reference paths outside the modified root, it can't maliciously read or write to those locations. [131010840060] |On Linux, using a bind mounts is a great way to populate the chroot tree. [131010840070] |Using that, you can pull in folders like /lib and /usr/lib while not pulling in /user, for example. [131010840080] |Just bind the directory trees you want to directories you create in the jail directory. [131010850010] |Basically you are just changing the root directory of your environment. [131010850020] |So [131010850030] |becomes [131010850040] |When an application accesses / they'll get /some-jail/. [131010850050] |Also the application can't break out of /some-jail/ so you know it won't access anything else on your machine. [131010850060] |Its a very simple way of saying 'hey you can only access these things that I am giving you, and you can't access anything else on the system. [131010860010] |"chroot jail" is a misnomer that should really die out, but people keep using it. chroot is a tool that lets you simulate a directory on your filesystem as the root of the filesystem. [131010860020] |That means you can have a folder structure like: [131010860030] |If you chroot foo and do ls /, you'll see: [131010860040] |As far as ls (and any other tools you run) are concerned, those are the only directories on the filesystem. [131010860050] |The reason "jail" is a misnomer is chroot is not intended to force a program to stay in that simulated filesystem; a program that knows it's in a chroot "jail" can fairly easily escape, so you shouldn't use chroot as a security measure to prevent a program from modifying files outside your simulated filesystem [131010870010] |Concern about logging in as root overrated? [131010870020] |For personal linux on my personal notebooks, I've usually set my environment to autologin as root even under X or lower runlevels. [131010870030] |I've found my workflow is very pleasant and fast, without any cumbersome need to type su or sudo or being asked by keyring or auth or something. [131010870040] |So far I've never had any problem with it, so why are most people freaking out about it? [131010870050] |Is the concern overrated? [131010870060] |Of course this assumes the user knows what they are doing and doesn't really care about system reliability and security issues. [131010880010] |You will find some answers here [131010890010] |Apart from the obvious point of security, it is clear you've never hosed your system by mistyping a command in the shell or a lapsus. [131010890020] |If it happens, you'll understand why people freak out about it. [131010890030] |And then you will cry in horror, and also realize that it was a highly educational experience, but you're not getting your system back anyway. [131010890040] |A thought: if you're being asked for the root password during normal use of your system (ie not installing packages or some other system administration task), you're doing it wrong. [131010900010] |For the same reasons why each daemon should have minimal rights. [131010900020] |Apache can run as root. [131010900030] |It is designed to perform one task and surely nothing bad can happen? [131010900040] |But assume apache is not bug-free. [131010900050] |Bugs are discovered from time to time. [131010900060] |Sometimes it can be even arbitrary code execution or similar. [131010900070] |Now with apache runned as root it can access anything - for example it can load a rootkit into kernel and hide itself. [131010900080] |On the other hand user-level rootkit is very hard. [131010900090] |It have to override different programs (like ps) inside /home which can make it suspectable more filled. [131010900100] |It might not know exact configuration and 'forgot' to include gnome-system-monitor therefore exposing itself etc. [131010900110] |It have to cover bash, tcsh and any shell you happen to use (to start itself). [131010900120] |It would have to work with different configurations instead of 'simply' overriding buch of callbacks. [131010900130] |Consider that not so long ago there was arbitrary code execution discovered in... [131010900140] |Adobe Reader. [131010900150] |Other reason is user mistakes. [131010900160] |It is better to be warned that erase whole disk by one command. [131010900170] |Third reason is different shells. [131010900180] |Root shell should be installed on / in case that rescue of system needed to be performed. [131010900190] |Users' shells can be installed on /usr (for example user can use zsh). [131010900200] |Forth reason is that different programs does not work as root. [131010900210] |They specificly know they are not suppose to so you would need to patch system. [131010900220] |Fifth reason is that /root should not be on separate partition while /home can (and should). [131010900230] |Having /home separate helps for various reasons. [131010900240] |ALSO: WHY NOT USE AS NORMAL USER. [131010900250] |You more often don't need to have root rights then do. [131010900260] |It is a very little cost for security. [131010910010] |I agree with Maciej for the concern over security &having control over certain powers. also, as you are the owner of your system you can disable this functionality if you want ;) its your choice. [131010920010] |Picking up on a comment of yours to another answer [131010920020] |but linux is about freedom, including freedom to destroy your own data, privacy and security [131010920030] |Even forcing people through sudo, Linux offers this freedom. [131010920040] |The whole security argument that you want to shun is there to protect you from things are aren't you (read: malicious programs or programs controlled by malicious people). [131010920050] |Think of it as a seatbelt. [131010920060] |Takes a second to use. [131010920070] |Could save your life from other idiots out there (as well as yourself). [131010920080] |If you don't want to type your password all the time, sudoedit /etc/sudoers but if you keep running as root, one day you're probably going to run something that nukes your system and all your data. [131010920090] |If you're happy knowing that even something as crappy as Flash could reformat your computer, nobody here cares what you do. [131010920100] |Run as root. [131010930010] |Why not run Damn Vulnerable Linux as your main system while you're at it. [131010930020] |If you're going to ignore system security you might as well ignore all of it... [131010940010] |I can't see any great problem logging in as root for a normal session, as long as you don't do anything stupid. [131010940020] |I don't do it personally, because, occasionally I do something silly. [131010940030] |I have never noticed that anything stupid I've done has been potentially a big problem, but I am not arrogant enough to think that I'd never do anything really stupid. [131010950010] |You can also ride a motorcycle in the nude, and nothing may happen. [131010950020] |But I bet you'd feel better if you had when you crash the bike... [131010960010] |You're talking about an OS that is the collaborative effort of countless people. [131010960020] |If you run nothing but stable software you MAY be safe for a time. [131010960030] |As mentioned before, you would be surprised how small a thing can trash your entire HD. [131010960040] |In my first year, I tried running in root alot because, well, back in the days of Fedora-core 3, there weren't as many fancy ways to admin your system from user. [131010960050] |At the time, I made a small xorg edit without backing up, because I didn't think it would hurt. [131010960060] |Desktop gone. [131010960070] |Then I tried to fix it manually, but couldn't figure out what I'd done, exactly. [131010960080] |Later, I thought that maybe I could reinstall my drivers and desktop, but inadvertedly disconnected my ethernet, since it was also nvidia. [131010960090] |While running Arch for the first time, I ignored warnings to create a user and ran as admin for a while. [131010960100] |I installed a package from AUR that I needed and after I rebooted, my entire install was busted. [131010960110] |Since I was in root, fixing these problems became a lot worse than they needed to be. [131010960120] |You might conclude I was just incompetent. [131010960130] |But as others mentioned... typing "sudo" is a small price to pay for some peace of mind. [131010960140] |EDIT: Oh... and certain programs, like WINE, are expressly not supposed to run in a root environment. http://wiki.winehq.org/FAQ#head-96bebfa287b4288974de0df23351f278b0d41014 [131010970010] |Safety reasons - a daemon or script vulnerability targeting Linux would have the Sysadmin power over your system. [131010970020] |Running as a simple user AND using sudo is a lot different in term of security. [131010970030] |My Firefox is running as my user, so any Firefox vulnerability will only hit my account. [131010970040] |Nothing else. [131010980010] |No, it's not overrated. [131010980020] |In practice it's most under-appreciated. :-) [131010980030] |My small team at work for example is sharing an RHEL machine for development work: building stuff, testing etc. [131010980040] |Everyone uses individual user accounts, but we also share the root password since people need this time to time for quick sysadmin tasks. [131010980050] |This also has resulted in us managing to hose the OS a few times in its short lifespan. [131010980060] |Someone building a certain version of libc removed the system libc by a silly rm invocation. [131010980070] |In another curious incidence the partition table was missing. [131010980080] |(Ok, this had nothing to do with previleges.) [131010980090] |Rest of the team is blocked until the breakage is fixed. [131010980100] |One solution is to have someone volunteer to take up the sysadmin tasks. [131010980110] |To this point we have not cared too much, except to allow people to learn their lessons: all of us need some teeth marks on our rear ends, and these are relatively inexpensive teeth marks. [131010980120] |The really curious might want to follow the principle of least privileges, and Ken Thompson's paper, "Reflections On Trusting Trust." [131010980130] |("The moral is obvious. [131010980140] |You can't trust code that you did not totally create yourself.") [131010990010] |block specific IP from accessing gateway [131010990020] |suppose you are on linux internet gateway/router. how would you do to block a client with specific IP using bash script. [131010990030] |I prefer something like ./block_client.sh 192.168.1.123 to block and ./unblock_client.sh 192.168.1.123 [131011010010] |You might want to deploy something like apf which you'll be able to execute apf -d 192.168.1.123 and apf -u 192.168.1.123 to block and unblock respectively. [131011010020] |In addition APF keeps it's blocks list local and will insert them into the iptables on each reboot. [131011020010] |Oldest Linux machine you still run [131011020020] |What is your oldest machine you ever installed Linux on and currently still run? [131011020030] |What are the specs, kernel version or distro, and for what purpose? [131011030010] |this isn't exactly old but it's interesting, and slow like it was old hardware [131011030020] |
  • that's about 211MHz CPU
  • [131011030030] |
  • kernel version 2.6.32.10
  • [131011030040] |
  • 16MB of RAM
  • [131011030050] |
  • 4MB of flash
  • [131011030060] |
  • no: [131011030070] |
  • hard drive
  • [131011030080] |
  • screen
  • [131011030090] |
  • video card
  • [131011030100] |
  • it has a built in ADSL Modem that powers my Internet
  • [131011030110] |
  • Distro is OpenWRT
  • [131011040010] |I have a HP Visualize C3000 from around 1999/2000, it was given to me last week. [131011040020] |I have no reason to run it other than to tinker. [131011040030] |
  • PA8500 400mhz processor
  • [131011040040] |
  • 2Gb Ram
  • [131011040050] |
  • SCSI HDD
  • [131011040060] |
  • Linux Debian 2.6.26-2-parisc [131011040070] |# cat /proc/cpuinfo processor : 0 cpu family : PA-RISC 2.0 cpu : PA8500 (PCX-W) cpu MHz : 400.000000 model : 9000/785/C3000 model name : AllegroHigh W hversion : 0x00005bb0 sversion : 0x00000481 I-cache : 512 KB D-cache : 1024 KB (WB, direct mapped) ITLB entries : 160 DTLB entries : 160 - shared with ITLB BTLB : not supported bogomips : 798.72 software id : 2014670675
  • [131011050010] |I installed redhat 5 on my 486 $many years ago. [131011050020] |Oldest machine I have running currently (openbsd at the moment) is an old grey dell optiplex I found in a plie of scrap at the University I went to. [131011050030] |It's been running as my network router/firewall/wireless bridge/DNS server for three years now. [131011060010] |I have a 400MHz Dell box (K6 CPU, I think) from circa 1999. [131011060020] |I've run Slackwares up to about 12.0 on it, but last summer, I put Slackware 3.2 on it, just to see what it felt like with a contemporary Linux. [131011060030] |Very interesting. [131011060040] |I had to recompile the kernel (2.0.xx) to get support for a 3c905 ethernet card, and I recompiled XFree86 to get ATI card support. [131011060050] |I was able to complie the latests OpenSSH with only a few glitches for remote access. [131011070010] |I ran CRUX on a Compaq Armada with a Pentium MMX 166 MHz, 64 MiB of RAM and an around 2-3 GiB hard disk. [131011070020] |Booted into an XFce desktop in less than 1 minute! [131011070030] |Just for kicks, I also installed Ubuntu 5.04 on that machine once (the whole thing, running a full GNOME install, Firefox, etc.). [131011070040] |That was somewhat slow though... ;-) [131011080010] |SLS distribution, Linux kernel v0.9 1992 era on a 386sx 16Mhz w/16MB RAM [131011090010] |The oldest machine that I currently have installed is an old HP Pavilion desktop that I picked up from a repossession for $20. [131011090020] |It's my main web, DNS, DHCP, NFS, CUPS and SSH server as well as firewall and gateway. [131011090030] |It has 512MB of RAM with 100GB hard drive space. [131011090040] |It's running Debian GNU/Linux stable. [131011090050] |Kernel version is in the prompt. [131011100010] |The one I'm currently running on is reasonably old. [131011100020] |384 MB RAM, less than 80 GB hard drive. [131011100030] |Currently running Debian Testing. [131011100040] |I once installed AntiX (based on Debian) on it, and it felt far newer than it is, but then I began to miss my GNOME environment. [131011110010] |How can I kill a particular thread of a process? [131011110020] |This shows the process myp with PID = 797 and four threads with different SPIDs. [131011110030] |How can I kill a particular thread of the process without killing the whole process. [131011110040] |I understand that it might not be possible at all in some cases when there are fatal dependencies on that particular thread. [131011110050] |But, is it possible in any case? [131011110060] |Is yes, how? [131011110070] |I tried kill 799 and the process itself was terminated. [131011110080] |Now I am not sure this was because there were dependencies that made myp fail without the process 800 or because kill is simple not able to kill individual processes. [131011120010] |Threads are an integral part of the process and cannot be killed outside it. [131011120020] |There is the pthread_kill function but it only applies in the context of the thread itself. [131011120030] |From the docs at the link: [131011120040] |Note that pthread_kill() only causes the signal to be handled in the context of the given thread; the signal action (termination or stopping) affects the process as a whole. [131011130010] |pthread_cancel() [131011140010] |What directories do I need to back up? [131011140020] |What are the directories one should back up, in order to have a backup of all user-generated files? [131011140030] |From a vanilla debian install, I can do enough apt to get the packages that I want. [131011140040] |So if I don't want to backup the entire system, where all in the filesystem do user-generated configuration and data files reside? [131011150010] |It depends on what you mean by "user-generated". [131011150020] |Most of the configuration you will have are about services/daemons and applications running on your system. [131011150030] |Most of them put their configuration in /etc. [131011150040] |The user-based applications have their configuration in your home directory (usually in a application directory). [131011150050] |But you can have some applications that also store their data in /var/lib or /var/spool. [131011150060] |So the answer, is: "it depends on what you're running on your machine". [131011160010] |You'll be backing up some 'garbage' doing this... but if you just backup all of /home, /etc, and /var/ you should have everything (unless you know you put something somewhere else). [131011160020] |You'll want to leave out /var/tmp, /var/run/, /var/lock for sure. [131011160030] |After that I'd read Luc's reply. [131011170010] |In short, you want to backup /home (generally where user-generated files reside), /etc and /usr/local. [131011170020] |The last two will backup your configuration files. [131011170030] |I would recommend using some backup software like sbackup which does what you need and is easy to use. [131011180010] |Need advice in choosing a tiling WM [131011180020] |I've used GNOME's default window manager for some years, but now I want to try a tiling window manager. [131011180030] |I want it to satisfy these two criteria: [131011180040] |
  • WM must be lightweight
  • [131011180050] |
  • WM should not be complicated to configure
  • [131011190010] |There are a few out there, but there's one that sticks out (to me) which I found suited my needs [131011190020] |
  • It was not just configured in a nice language, but was also programmed in it (Python)
  • [131011190030] |
  • The ability to make my own layouts (which I found awesome didn't do)
  • [131011190040] |
  • Lightweight even though it's programmed in a dynamic language (just 6.6MB of ram)
  • [131011190050] |The name was Qtile [131011190060] |Come join us on the IRC channel; we'll be happy to help you out [131011200010] |Have a look at awesome, name says it all. :-) The awesome wiki has lots of configuration advice. [131011210010] |"Complicated to configure" varies greatly depending on what languages you're proficient in. XMonad was extraordinarily complicated for me to configure, but that was because I know absolutely no Haskell, and that's the language the configurations are in. [131011210020] |The two tiling window managers I've used and quite liked are: [131011210030] |
  • Awesome. [131011210040] |Awesome configurations are in Lua (as of awesome 3; before that they were in a custom syntax), but it's quite easy to configure and comes with a bunch of widgets; here's a screenshot of what my bar looked like at one point (there's also a graph widget, although I wasn't using it at the time): [131011210050] |The main reason I stopped using Awesome was the constant backwards-compatibility breaks; every point revision changed the API enough that I needed to spend days trying to fix my configuration file to work with it. [131011210060] |It's possible that's stabilized more now
  • [131011210070] |
  • wmii, my current WM. [131011210080] |Configurations by default are in shell scripts, but can be done any way you like as wmii exposes a 9p interface, which means you control it by reading and writing to files on a pseudo-filesystem. [131011210090] |My current configuration is a shell script for the main configuration with a python utility script to do some of the work. [131011210100] |The main downside is a lack of built-in widgets; it doesn't come with progress bars or graphs or icons. [131011210110] |It's certainly "lightweight" though, which was one of your requirements
  • [131011220010] |I personally use Ratpoison when I need a light weight tiling WM - The configuration worked pretty well out of box, and since I'm quite adjusted to using GNU Screen for many years the leap to Ratpoison wasn't very difficult. [131011220020] |I've also been using StumpWM Which has been more active in development than Ratposion. [131011230010] |If you know Haskell, definitely Xmonad! [131011230020] |Ratpoison is also quite nice, but I like Xmonad's tiling algorithm better and workspaces are a big win IMO. [131011240010] |There's a Arch Linux wiki entry comparing 13 different Tiling Window Managers, in grid-like fashion, here on the Arch Linux Wiki. [131011240020] |Perhaps it would be hepful. [131011240030] |I haven't tried any of them yet, personally, but plan to in the near future when I have some time, so I'm following this thread closely as well. [131011250010] |I've been using wmii for quite some time. [131011250020] |The configs are pretty easy to understand and you can use any language you want to further tweak the config you want. [131011260010] |I'd like to recommend two different tiling window managers, one dynamic and one manual. [131011260020] |
  • XMonad is very powerful yet easy to learn, there is a short guided tour that explains its basic features and key bindings. [131011260030] |It integrates smoothly with GNOME, the documentation is comprehensive and there are lots of additional extensions available. [131011260040] |It supports the dynamic tiling paradigm, where windows are automatically positioned according to a selected dynamic layout. [131011260050] |The downside, at least for some, is that XMonad is configured in Haskell and depends on the presence of a Haskell compiler.
  • [131011260060] |
  • i3 supports the manual tiling paradigm, where a screen acts like table divided into columns and cells. [131011260070] |The user can freely rearrange windows, which allows for greater flexibility, but also requires more effort. [131011260080] |In my opinion i3 feels modern in comparison to other tiling windows managers. [131011260090] |It provides out of the box features that either require configuration or don't exist at all in other window managers, eg. maximize, urgency hooks, mouse resize. [131011260100] |It's configurable with a simple plain-text file, which obviously is not Turing-complete. [131011260110] |There's a nice video presenting i3 features that I suggest watching.
  • [131011260120] |Of course both support multiple monitors without any problems and have a floating layer for applications that don't like to be tiled. [131011260130] |PS. [131011260140] |One day Bluetile might be a good gateway drug for GNOME users, but it's still in an early phase of development. [131011270010] |Personally, i3 takes the best features of the other big tiling-wm's (Xmonad, Awesome, DWM, etc) and combines it into one, Combined with dmenu/conky/dzen2 it's just what I look for in a WM. [131011270020] |Check out the page; http://i3.zekjur.net/ [131011280010] |What are the best general purpose programming tools to complement Vim? [131011280020] |I've been using Vim as my text editor for a little while now and I feel like I'm taking the long way to do anything. [131011280030] |I use ctags to tag my code base for navigation and I use grep (although inefficiently) to find where certain methods are used. [131011280040] |But I have a feeling there are some very useful tools out there that I don't know about that could make me more productive. [131011280050] |What is the best software stack I could use for general programming that would complement Vim? [131011280060] |How do you navigate a code base, run make, push changes to your source control system, etc? [131011280070] |Do you have a 2nd console open next to Vim? [131011290010] |my favorite is cscope. [131011290020] |If you have compiled vim with cscope support you can directly use cscope commands from VIM. e.g. searching for included file , functions called by xyz function etc. [131011290030] |I have tried it with very large source code repository. [131011290040] |Its helps alot. [131011290050] |http://cscope.sourceforge.net/cscope_vim_tutorial.html [131011300010] |Only Chuck Norris programs in VIM. [131011300020] |As a long time Linux programmer, I'd advise using an IDE. [131011300030] |Bash coding is a possible exception. [131011300040] |I don't think there are any IDE's for bash. [131011310010] |There's a great plugin for VIM that does syntax checking Syntastic. [131011310020] |There are many other tools available as well for file management, building, etc. [131011310030] |Go to IRC #vim on freenode.net, there are lots of helpful folks there. [131011320010] |Whatever your language you'll want to use a feature called ctags that lets to browse around source definitions. [131011320020] |This requires an external tool to generate TAGS files that are used by VIM to discover the locations of various code definitions within a project. [131011320030] |Get the exuberant ctags tool, it works for many many languages and is v simple to use. [131011320040] |from VIM :help ctags [131011320050] |ctags will create an index of all identifiers in a source tree. [131011320060] |You can then use the tag commands to navigate around your source tree. see :help tag-commands. [131011320070] |The easiest is to place the cursor over a keyword and press CTRL-]. [131011320080] |To get back to where you came from press CTRL-T [131011320090] |Beyond this you might want to look at some of the VIM tips and improvements discussed here, it's a very comprehensive discussion of some of the things than can be done to improve a vimmer's experience. [131011330010] |If you are programming in any of the languages supported by GCC (C,C++,Java,Fortran) then Clewn is a great plugin that integrates the GDB debugger into VIM. [131011330020] |I've actually found it to be one of the best interfaces to GDB that there is. [131011340010] |A great feature of vim is the ease of integration with existing shell commands. [131011340020] |Some of the most useful external tools are the ones that are included in coreutils and other simple text maniplulation tools. [131011340030] |For example, we can get the number of lines in a file with: [131011340040] |or the number of words: [131011340050] |Any command that works on the shell will work here. [131011340060] |This can be powerfully combined with the :read (:r) command to put the output of the command into the file. [131011340070] |For example: [131011340080] |Will place the word line count into the file you are editing. [131011340090] |Another advantage of this is replacing the text you are currently editing with the output of one of these commands. [131011340100] |For example, you could format the entire file with par by executing the command: [131011350010] |I find NERDtree indispensible for navigating through my codebase. [131011350020] |Alongside that, investing some time in becoming proficient in moving around your buffers/windows is really worthwhile. [131011360010] |Vim is a very powerful tool, I am sure all of you already know that. [131011360020] |You'll start getting a productivity boost by using vim within a couple of weeks. [131011360030] |But you will never saturate your knowledge of Vim. [131011360040] |So, I for one am always on the lookout for new and efficient ways of doing things in Vim. [131011360050] |There is a guy named Derek Wyatt who's done some great screencasts on the usage of the Vim, and also on the plugins he uses. [131011360060] |A few of the plugins which I use [131011360070] |
  • command-t This makes browsing files a breeze, and it is very intelligent. [131011360080] |The Command-T plug-in provides an extremely fast, intuitive mechanism for opening files with a minimal number of keystrokes. [131011360090] |It's named "Command-T" because it is inspired by the "Go to File" window bound to Command-T in TextMate.
  • [131011360100] |
  • fuzzyfinder I use this mostly to broswer buffers and change the current directory. [131011360110] |FuzzyFinder provides convenient ways to quickly reach the buffer/file/command/bookmark/tag you want. [131011360120] |FuzzyFinder searches with the fuzzy/partial pattern to which it converted an entered pattern
  • [131011360130] |
  • NERDTree This is the best file browser plugin for vim. [131011360140] |The NERD tree allows you to explore your filesystem and to open files and directories. [131011360150] |It presents the filesystem to you in the form of a tree which you manipulate with the keyboard and/or mouse. [131011360160] |It also allows you to perform simple filesystem operations.
  • [131011360170] |
  • XPTemplate The best templating plugin in the world. [131011360180] |Code snippets engine for Vim, with snippets library. [131011360190] |XPTemplate let you write codes in a smooth, quick and comfortable way.
  • [131011360200] |
  • rails.vim If you do rails dev stuff, this is indispensable. [131011360210] |TextMate may be the latest craze for developing Ruby on Rails applications, but Vim is forever. [131011360220] |This plugin offers the following features for Ruby on Rails application development.
  • [131011360230] |
  • NerdCommenter Makes commenting in any kind of code easy.
  • [131011360240] |And those are just a few of the plugins which I use, To download all the plugins with my vimrc, checkout my dotfiles [131011370010] |Is PXE in a 802.1x network for LTSP possible? [131011370020] |I have an LTSP server in a network that requires 802.1x authentication. [131011370030] |Is it possible to boot the terminals through PXE without disabling the 802.1x authentication? [131011370040] |If not, are there alternatives to simply disabling auth for the terminals? [131011380010] |It is possible if the PXE boot ROM/image supports 802.1x (e.g. Intel's vPro systems should support it). [131011380020] |It seems like gPXE has some support too. [131011390010] |Is a journaling filesystem a good idea with an dm-crypt encrypted drive? [131011390020] |Hi, [131011390030] |I was looking at dm-crypt and have seen that you can use whatever file-system you like on top of the encrypted drive. [131011390040] |So I was wondering if a journaled filesystem is a good idea as opposed to a non-journaled filesystem? [131011390050] |And what filesystem would be best to deal with power failures with an encrypted drive? [131011390060] |Thanks! [131011400010] |Journaling is a technique that helps with recovery from problems that occur when multi-write operations are interrupted. [131011400020] |Such interruptions can leave the file system in an inconsistent state between writes. [131011400030] |Interruptions can happen with "normal" block devices and dm-crypt block devices alike. [131011400040] |For a file system, a block device is a block device. [131011400050] |Block device encryption and file system journaling are completely separate concerns. [131011410010] |Journaling is orthogonal to encryption. [131011410020] |You would run an encrypted device to protect your files private, and you would use a journaling FS to protect the integrity of the data. [131011410030] |Given the advancements over the last decade in Linux-based journaling systems, there's really no reason not to use one, except for possibly special scenarios like embedded systems or specially tuned database environments. [131011420010] |Output the common lines (similarities) of two text files (the opposite of diff)? [131011420020] |Diff is a great tool to display the changes between two files. [131011420030] |But how to display the similarities of two text files (while ignoring the differences)? [131011420040] |I.e. sample input: [131011420050] |Pseudo output (something like this): [131011420060] |Just sorting both files and using comm is not enough, because in that case the line information is lost. [131011430010] |comm can be used. man comm for all the options but you'll want to use comm -12 ... to show only lines that exist in both inputs. [131011430020] |As people have pointed out, you need to pass your input through sort first. [131011440010] |I don't think there is a single command that does what you want it to do. [131011440020] |You can try to combine the output of diff with grep, though. [131011440030] |If your text files contain none of the characters |,<,>, the following gives you somewhat useful output: [131011450010] |How about using diff, even though you don't want a diff? [131011450020] |Try this: [131011450030] |Here is what I get with your sample data: [131011460010] |-f means matche plain strings (not regexps, -x means only whole-line matches, -F means take 'patterns' (i.e. lines with -f and x) from the file named as its argument [131011470010] |su options - running command as another user. [131011470020] |I was wondering how to run a command as another user from a script. [131011470030] |I have the script's owner set as root. [131011470040] |I also have the following command being run within the script to run the command as the hudson user: [131011470050] |Is this the correct syntax? [131011480010] |Yes. [131011480020] |Here's the --help: [131011480030] |And some testing (I used sudo as I don't know the password for the nobody account) [131011490010] |Note: "I have the script's owner set as root" doesn't do anything; even if you have the setuid bit set it still doesn't work [131011490020] |Assuming you're actually running the script as root, however, you can use sudo. su is primarily for switching users, while sudo is for executing commands as other users. [131011490030] |The -u flag lets you specify which user to execute the command as: [131011500010] |How do you work with old servers? [131011500020] |I've recently fallen into doing more work on LAMP servers, which is pretty new to me. [131011500030] |At first it wasn't a problem migrating my preference files, but as I've grown and learned more, my preferences and workflow has become more specific (and less portable*). [131011500040] |This morning I was asked to work on an old Red Hat 4 server and it's... it's just so old I don't know what to do with it. [131011500050] |Vim 6? [131011500060] |Everything installed through RPMForge? [131011500070] |Can't even install tree without having to add repositories? [131011500080] |No actual user accounts except root? /sbin/ and /usr/sbin/ aren't even in the root user's path? [131011500090] |This thing was installed once and never modified. [131011500100] |Every installed package is from the ice age. [131011500110] |The first ice age. [131011500120] |So what do you do in this situation? [131011500130] |Should I even bother trying to work on on the server, or is there a better way to go about this? [131011500140] |* - really the only thing that broke is support for the Jellybeans color theme, and my usage of Vim tabs. [131011500150] |edit - I guess the way I posed it was unclear, but the emphasis in the question should be on you. [131011500160] |What I'm really trying to get a sense for is what other people would do in a similar situation. [131011500170] |Remember: I'm consulting. [131011500180] |It's not my job to reinstall the server. [131011500190] |It's not my job to do a security audit and harden the server. [131011500200] |It's my job to take vague requirements from a non-technical client running a very old server and make them happen in as little time as possible. [131011500210] |That's it. [131011500220] |I'm a developer, not a sysadmin; it's all pretty new to me, and getting it up to speed properly would take more time than I can afford to spend. [131011500230] |It's been in production for years; I'm just making modifications. [131011500240] |Do I want this server to be improved? [131011500250] |Of course! [131011500260] |Would I want this project to be something I'm proud of? [131011500270] |Yes! [131011500280] |Is that going to happen? [131011500290] |No. [131011500300] |I'm maintaining old software that I have zero interest in that doesn't even receive a lot of traffic. [131011500310] |I just want to do the task in a comfortable way without too much hassle. [131011500320] |edit 2 - after a bit of searching and fiddling around, I eventually mounted what I need locally with sshfs and MacFuse. [131011500330] |That way I can stay in the terminal and use a mix of local and remote tools based on what I'm doing. [131011510010] |Your choice is to either go in a update all the packages and add new repositories or just backup the data and sites and reinstall the server. [131011520010] |Enter "you damn kids" mode. [131011520020] |Your tools should help you do your job more efficiently, without preventing you from understanding what is going on. [131011520030] |Really, RH 4 is not that old, and mostly similar to what is around today. [131011520040] |It might not have the latest and greatest, but should be sufficient to do what you need (what is it that you need). [131011520050] |Rant over. [131011520060] |On the other hand, if this is going on the net, it really needs to be updated with at least the latest RH 4 packages. [131011530010] |Most service professionals eventually reach a point where they are comfortable telling clients "Your current setup is wrong/dangerous. [131011530020] |I'm not going to touch it without making it right." [131011530030] |While it might or might not be legally or morally accurate, from a practical point of view, nontechnical people are going to blame the last person who worked on a system that fails. [131011530040] |If you're the last person who even logged in to a server that gets compromised or that stops working, you're likely to be blamed for the failure, even if the things that you changed (or just looked at) have nothing to do with the failure. [131011530050] |This is more obvious with physical things (imagine going to a tire store with bald tires and asking to have the bald tires patched, or going to a brake shop with all 4 wheels' brakes bad, and asking them to fix just 1 wheel's set; or asking the gas company to relight the pilot light on a dangerously rusted water heater) the same principles and considerations apply with software and servers. [131011530060] |It sounds like your client has at least two problems: an unmaintained server environment, and they've got the development and production environments operating on the same physical hardware, so it's not possible to modify one without affecting the other. [131011530070] |If you pretend that's a reasonable way to run things, you'll be expected to fix it when it blows up, and you'll probably be expected to do it for free because it's obviously your fault that it failed at all. [131011530080] |To directly answer your question, I'd tell the client that their shared hardware system is a problem that needs to be fixed, and that the unmaintained server environment is so old that it's cheaper to pay you to move their existing data to a new system versus tracking down all of the changes and dependencies necessary to upgrade the old system. [131011530090] |They should (a) get new hardware to run the development system, and (b) install up-to-date software on the new hardware, and then migrate development to that new hardware. [131011530100] |The bonus that you get for fixing the shared hardware problem is that you can test the new dev environment prior to making the move, which should make for a more graceful transition. [131011540010] |You should understand how to use common(ish) unix tools. vim may have changed between redhat 4 and redhat 300, but I bet you vi is the same (even if they are using vim as a replacement for vi, the vi commands will work as expected). [131011540020] |The package tools may not be familiar to you, but I bet you can still download a tgz file, ./configure, make, sudo make install it. [131011540030] |Learning on the latest and greatest is great, but you should also learn the tools your tools are built on. [131011540040] |There are things in unixland which remain fairly constant, and if you know and understand how to work with them, you will find yourself more at home on any variant you end up on, regardless of age (within reason here people). [131011540050] |Tree's not installed? [131011540060] |I bet grep, find, awk, and sed are. [131011540070] |These are your friends. [131011540080] |As an alternative to cygwin/etc, it's not hard to install VirtualBox and setup a Linux box in a virtual environment that you can then use for your development, and push files out to the server later. [131011550010] |grep -- removing text after delimiter token [131011550020] |I have a file in which I need to eliminate everything after the first ; on every line. [131011550030] |So a file like this: [131011550040] |Will result in this: [131011550050] |I have looked into grep and sed. [131011550060] |I would appreciate an answer incorporating either of these commands. [131011560010] |I typically use awk for things like this: [131011560020] |cat a.file | awk -F=";" '{ print $1 }' [131011560030] |That will take each line of a file and print the first group before the delimiter -F [131011570010] |sed is probably easiest and faster than awk or perl in this circumstance: [131011580010] |another option is to use the cut command [131011590010] |Here's a way to do it using GNU grep: [131011600010] |How can I tweak my Linux desktop to be more responsive? [131011600020] |I have the experience that Linux works fine until the physical memory is exhausted. [131011600030] |As soon as swap space is used the performance is severely degraded and the GUI becomes unresponsive. [131011600040] |This problem is not limited to a specific distro or desktop, because I've tried a few (and the issue remains). [131011600050] |What can I do about this? [131011610010] |Purchase more memory? :) [131011610020] |If you are running applications that are using more memory than you have present in the system, there's nothing that any operating system can do about this other then to swap to the swap partition. [131011610030] |If this is a situation you find yourself in often, stop running some of the programs that you do not need, or, really, buy more memory, it is very inexpensive these days. [131011620010] |Some pointers: [131011620020] |
  • Don't run so many GUI programs at once.
  • [131011620030] |
  • Make sure that any programs running in the background that you don't need e.g. Apache are stopped.
  • [131011620040] |
  • Use a distro aimed at low-memory situations (e.g. for a netbook)
  • [131011620050] |
  • Buy more memory.
  • [131011620060] |
  • Buy a faster HD (or SSD) for your swap partition. :)
  • [131011630010] |Purchase faster RAM and make sure your system is using all of it. [131011630020] |What CPU and architecture are you using? [131011640010] |Swapping will heavily decrease performance no matter what, so it's best to avoid that altogether. [131011640020] |This may sound stupid, but one option is to not configure a swap partition. [131011640030] |I've been running swap-free on all my systems for some time now: [131011640040] |
  • 1 GB on the netbook is enough for browsing the web, listening to music and other lightweight stuff.
  • [131011640050] |
  • 4 GB on my desktop is enough for all above things plus development (even in Eclipse) and basic image editing.
  • [131011640060] |If you do something that's really memory intensive (Gimp with large images, 3D modelling, CAD) than you should probably purchase some RAM. [131011650010] |I suggest reading SwapFAQ , in particular the swapiness parameter. [131011660010] |I run the System Monitor applet in a dock on the right side of my screen. [131011660020] |Any time that the system feels sluggish, I take a look at the meters. [131011660030] |If anything is running at above 10% capacity, that is an indication that a process is getting out of hand. [131011660040] |If you click on the system monitor, you can dig in to the processes that are consuming resources on your system. [131011660050] |http://www.colliertech.org/~cjac/tmp/screenies/system_monitor.png [131011670010] |A few years ago it was usual to use a dedicated drive for swap, while connected to it's own IDE/ATA bus - swapping data around on the same drive just didn't make sense in terms of performance. [131011670020] |That trick worked ten years ago, but with drive speeds now you really shouldn't see such hectic performance degradation, unless you're swapping the library of congress, otherwise I'd be concerned about your drive's health - have you checked that lately? [131011670030] |You can always give it a try, you don't have much alternatives if your RAM is already maxed out. [131011670040] |If anything I hope it makes your GUI more responsive. [131011680010] |I do believe these are two separate questions actually, after reading all the comments and the OP's responses to those. [131011680020] |Tweaking of the Linux graphical desktop is something which could be done tweaking how X11 is running on the system. [131011680030] |Also, when you're running 'expensive' things like compiz/beryl stuff, then it could be wise to see if you're running the best-performance driver for your graphics card, seeing as it's that heavy on the graphics card. [131011680040] |Make sure you have a graphics card which is supported for those heavy features. [131011680050] |Next to that, if your "maximum" memory isn't enough to run a desktop because it's going to swap; that's something else entirely. [131011680060] |Seems to me some process is going rogue on you and eating up valuable RAM on its way which eventually makes your system go 'swap'. [131011680070] |If this is the case, then it's Linux-Tuning-Time(tm). [131011680080] |Something which completely falls out of scope of a generic answer. [131011680090] |It comes down to making sure your system is running optimally and then go for searching out the specific application/program which is the cause of the memory leak (Java anyone? :)) [131011690010] |You can try compcache, if you can figure out how to set it up in your distro. [131011690020] |For example, on Ubuntu, you can enable it by editing /etc/initramfs-tools/initramfs.conf and editing the "COMPCACHE_SIZE" line. [131011690030] |I don't think my on-disk swap has been touched once since I enabled compcache. [131011690040] |Here are my current swap stats: [131011690050] |Notice that the compcache device (ramzswap0) is used, and the on-disk device (sda5) is not. [131011700010] |Install a second Linux system on your network with a good amount of RAM, NFS mount it to your main system, and put the swap file on that. [131011710010] |proxifier-like software on Unix? [131011710020] |Having some pleasant time with Proxifier, I just wonder if that kind of software is feasible under Unix/Linux? [131011710030] |Is it easy to start a project like that, or are there existing projects available? [131011710040] |Are they nearly as good as Proxifier (capture all TCP/IP packages and forward them through the proxy)? [131011720010] |There is tproxy. [131011720020] |Alternativly you can use SocksTun + iptables if you cannot control preload veriables. [131011730010] |you can try ProxyChains and Tor [131011740010] |SDK for Developer [131011740020] |is there any SDK for developer under linux? i mean more than man pages, it would be more like MSDN Library or Windows SDK under windows, where all documentation about programming and developer guide is documented and structured in one place. [131011750010] |A unified SDK implies a single source for all the core libraries. [131011750020] |That just isn't the way open source operating systems work. [131011750030] |Bits and pieces come from all over, and they're all separately documented. [131011750040] |EDIT: If paper's not a problem for you, the closest thing to what you're asking for is Advanced Programming in the Unix Environment 2/e by Stevens and Rago. [131011760010] |MSDN only documents Microsoft technologies, and not other libraries or frameworks to use on Windows; it doesn't include documentation from other vendors. [131011760020] |Now, linux distros use software from much more organisations &companies, so the documentation also tends to be more distributed and less uniform. [131011760030] |(And sometimes documentation isn't done very well, unfortunately.) [131011760040] |Also, most linux distros come with a documentation browser that bundles the documentation from various sources in one place. [131011760050] |Many of the important parts of a linux distro do have nice documentation libraries BTW, e.g.: [131011760060] |
  • http://library.gnome.org/devel/
  • [131011760070] |
  • http://docs.python.org/
  • [131011770010] |For GNOME, you can check out devhelp or library.gnome.org. [131011770020] |But as everyone has already stated, there is no single SDK for "Linux". [131011770030] |You need to have some idea of what you want before we can recommend specific developer resources. [131011780010] |What I recommended if you're also interested in developing cross-platform applications is the Nokia Qt SDK which provides the Qt framework and other tools, which from my experience has one of the best documentations available, see http://doc.qt.nokia.com/ and http://qt.nokia.com/developer [131011780020] |Some videos to watch: this and this [131011780030] |For understanding what Qt is and what you can do with it check out: http://qt.nokia.com/ [131011780040] |Also Qt is the framework of choice to build apps for MeeGo platform. (watch this) [131011790010] |How to update gnome keyring password? [131011790020] |Last weak I updated my password on my laptop. [131011790030] |Then every time when I logged in, it would prompt for my old password to open the keyring for network manager. [131011790040] |To fix this in a terminal I use [131011790050] |Is there a different or better way of doing this? [131011800010] |If you change your password through the GUI, it should automaticly synchronize the keyring that stores your WiFi passwords etc. too. [131011800020] |You can also always change it from seahorse's control panel ("Encryption &Keyrings" or something like that in the Preferences). [131011810010] |How can I get a count of files in a directory using the command line? [131011810020] |I have a directory with a large number of files. [131011810030] |I don't see a ls switch to provide the count. [131011810040] |Is there some command line magic to get a count of files? [131011820010] |Using a broad definition of "file" [131011830010] |For narrow (I hope) definition of file: [131011840010] |This is obviously generalizable to any glob. [131011840020] |The -- can be omitted if you're sure the first file doesn't begin with -. [131011840030] |In a script, this has the sometimes unfortunate side effect of overwriting the positional parameters. [131011840040] |You can work around this with a function (Bourne/POSIX version, you can write it more clearly in fancy shells) (warning, typed directly into the browser): [131011840050] |An alternative solution is $(ls * | wc -l). [131011840060] |If the glob is *, the command can be shortened to $(ls | wc -l). [131011840070] |Parsing the output of ls always makes me uneasy, but here it should work as long as your file names don't contain newlines, or your ls escapes them. [131011840080] |And $(ls * 2>/dev/null | wc -l) has the advantage of handling the case of a non-matching glob gracefully (i.e., it returns 0 in that case, whereas the set * method requires fiddly testing if the glob might be empty). [131011850010] |... [131011850020] |... [131011850030] |PS: Note ls - | wc - [131011860010] |Here's another technique along the lines of the one Gilles posted: [131011860020] |which creates an array with 13,923 elements (if that's how many files there are). [131011870010] |How can I make ubuntu UI uniformly use bash keyboard shortcuts? [131011870020] |On my default 10.04 Ubuntu install I am consistently tripped up by the fact that some UI text areas/input boxes treat ctrl-a as "select all" vs. "move my cursor to the beginning of the line." [131011870030] |Is there some sort of global conf file that exists for these sorts of things? [131011870040] |I would really like to unify all text input areas to use bash conventions. [131011880010] |Those are Emacs keybindings, and you can enable them for Gtk applications. [131011890010] |Testing precedence of resolving addresses from commandline [131011890020] |There was such tool but I cannot remeber its name. [131011890030] |I needed to configure precedence of addresses by /etc/gai.conf. [131011890040] |Finally I manage to find error but for future - what's the name of tool which displays the addresses of hostname as getaddrinfo(3) is displaying it? [131011900010] |I know there is a tool resolveip for this that comes with MySQL. [131011900020] |It should also be dead-simple to write something with e.g. Python or Perl... [131011910010] |Firewall change control [131011910020] |At the moment I'm using a Python script to generate iptables rules. [131011910030] |Each set of changes gets committed to a git repository before deployment so there's a trace of who changed what and why. [131011910040] |What tools/processes do other people use to manage changes to their firewall rules? [131011910050] |Is there a guide on best practice for firewall change control that anyone likes? [131011910060] |UPDATE: I guess what I'm asking is for tools/processes around the area. [131011910070] |For instance I find testing large firewall scripts quite difficult. [131011910080] |Anyone use/written a test script or know of a unit testing type approach that's possible with iptables? [131011920010] |I don't think change control for firewalls is much different than for anything else, so standard source control would work. [131011920020] |Use git or svn and automate the checkins in your script. [131011930010] |You could use a higher-level software that generates iptables rules, like shorewall. [131011930020] |It has a command 'shorewall check' that checks the consistency and errors in your rules. [131011940010] |Standard source control tools are likely perfectly adequate for this. [131011940020] |One thing you might also consider if you're automating this is adding validity checks (like the 'shorewall check' Luc mentioned) to your checkin hooks to provide a level of protection against deploying a bad config. [131011950010] |Batch renaming files [131011950020] |I have a directory full of images: [131011950030] |And I would like a one-liner to rename them to (say). [131011950040] |How do I do this? [131011960010] |ls *png | while read -r f; do f2="`echo $f | sed -e's/image//'`"; mv $f $f2; done [131011970010] |If you are using bash [131011980010] |This has worked. [131011980020] |Perl's rename: [131011990010] |

    zmv

    [131011990020] |The zsh shell has a powerful batch rename command called zmv. [131011990030] |First you need to enable the zmv command as follows (this can go into your ~/.zshrc). [131011990040] |The basic syntax is zmv PATTERN REPLACEMENT. [131011990050] |The pattern is a shell glob expression. [131011990060] |Parts of the pattern can be surrounded by parentheses. [131011990070] |The replacement text can contain $1, $2, etc. to refer to the Nth parenthesised group in the pattern. [131011990080] |For example: [131011990090] |You can also ask zsh to automatically define $1, $2, etc. to match the wildcard characters in the pattern: [131012000010] |I like Perl so: [131012000020] |You can also use the same pattern for other tasks like copying the files to another directory: [131012010010] |I normally use the nice and simple mmv utility for this usecase: [131012010020] |will perform your task. [131012010030] |The #1 in the target pattern will be substituted with whatever matches the wildcard in the source pattern. [131012010040] |This also works for several wildcards and can be used for example to change the order of parts of filenames. [131012010050] |You can also easily do more complicated things like converting lower case to upper case letters. [131012010060] |Make sure to protect the patterns from the shell by quoting. [131012020010] |What are the user interface subsystems, their components and responsibilities? [131012020020] |I am trying to understand the different subsystems that are in charge of the user interface, the terminology to refer to them, and how they are structured; so far I know there are: [131012020030] |At the top level: [131012020040] |desktops? (kde, gnome, etc) [131012020050] |Then we have: [131012020060] |
  • a display manager (also called desktop manager or desktop environment)
  • [131012020070] |
  • window manager
  • [131012020080] |
  • anything else?
  • [131012020090] |I'm making this a community wiki, I'd like this to be a central place for *all there is to know (from the user perspective) regarding user interface subsystems in Linux; what I would like to know is what are the components of each, and what are the responsibilities of each, i.e. [131012020100] |I would like to know things like: [131012020110] |
  • what exactly is in charge of the global shortcut keys, when I open up the "run application" dialog, who is doing that, when I press a key to show the desktop, run a terminal, maximize a window, etc, who is capturing that and sending it over to the right window;
  • [131012020120] |
  • who is in charge of drawing the desktop, the workspaces, etc.
  • [131012020130] |
  • what are the environment variables that can give me information regarding these components
  • [131012020140] |
  • Is the "main menu" a subsystem, or a component of a subsystem?
  • [131012020150] |It would also be nice to compile a list of the most popular desktops/subsystems, which ones run under each, can you mix and match desktops/desktop environments/window managers, etc? [131012020160] |Finally, how do I tell which desktop/subsystems are actually running (active?) on the system, can different users have a different subsystem each? [131012030010] |A desktop manager manages your hardware mostly, while a window manager manages your software. [131012030020] |For example, power management, screen savers, system performance, login screen, etc are managed by a desktop manager. [131012030030] |Your theme, window placement, widget and icon set, fonts, etc are managed by your window manager. [131012030040] |You can have a window manager installed without a desktop manager. [131012030050] |It's common to login to a virtual terminal, then have a login script execute your window manager to start up your "desktop". [131012030060] |Desktop managers are GNOME, KDE and CDE. [131012030070] |Window managers are Metacity, Openbox, Enlightenment, Awesome, etc. [131012030080] |To answer some of your questions directly: [131012030090] |
  • the window manager is mostly in charge of desktop keyboard shortcuts.
  • [131012030100] |
  • the window manager is in charge of drawing the desktop, workspaces, placements of windows, etc as mentioned before
  • [131012030110] |
  • there aren't a lot of environment variables for the GUI. [131012030120] |These are usually just applicable to the shell behind a terminal. [131012030130] |However, you can run set and env to get an idea of what is set.
  • [131012030140] |
  • not sure what you mean by the "main menu" as a subsystem or component of a subsystem. [131012030150] |Menus are part of the window manager.
  • [131012030160] |I've mentioned some popular desktop managers and window managers already. [131012030170] |More can be found by using Google. [131012030180] |Depending on your operating system, there is probably an ASCII config file that has defined your preferred desktop. [131012030190] |For example, on Debian GNU/Linux, this is defined in the /etc/X11/default-display-manager config. [131012030200] |You could also run 'ps -ef | grep user' where 'user' is the name of the login of some user on the system, and see what processes are listed, and which is the graphical desktop running. [131012030210] |For me, it's 'metacity'. [131012040010] |First of all, a Display Manager (or DM, e.g. xdm, gdm, kdm) is not the same as a Desktop Environment (or DE, e.g. GNOME, KDE, XFCE). [131012040020] |The Display Manager takes care of graphical login, and decides (or lets you choose) what session to run. [131012040030] |Or what session*s* in case you choose the "switch user" menu option. [131012040040] |A Desktop Environment is basically a collection of programs (display manager, window manager, session manager, panels, configuration tools, etc.) and libraries (e.g. Gtk) that intend to give a consistent and integrated environment to work in. [131012040050] |A Window Manager manages windows: where to place them, move them, resize them, minimize/maximize them, tile them, etc.). [131012040060] |It also handles the shortcuts to do those things. [131012040070] |In some cases the window manager also paints the borders of windows, in other cases this task is off-handed to a "window decorator". [131012040080] |The "Run Application" dialog in GNOME is part of gnome-panel, but in another DE it could be another part of the environment. [131012040090] |Who is in charge of painting windows etc. depends; in case there is a "compositor" in use (often part of the window manager, e.g. in Compiz) then the compositor paints the windows on the screen, otherwise (as was usual in the past) it's the X-server doing that. [131012040100] |The Main Menu(s) are put on the screen by a part of gnome-panel, but the data used comes from a bunch of files in /usr/share/applications/ (possibly combined with an equivalent directory in your home for personal changes). [131012040110] |Those files have a structure defined by FreeDesktop.org (a platform for different DEs to collaborate on common infrastructure), so that GNOME and KDE know about the same programs (but still can show them differently, and in some cases prioritize "native" programs over "foreign" ones). [131012040120] |And yes, different users can use a different session configuration (and can even define their own ones). [131012040130] |In GDM, try the Session drop-down for the available choices. [131012040140] |Furthermore, it is possible to mix &match several components, but that will sometimes result in less cooperation and a loss of "smoothness" in how things work. [131012040150] |One very well known example where things get exchanges is of course Compiz, which replaces Metacity if you want fancy desktop effects. [131012040160] |But there are lots of other changes possible. [131012050010] |libX11.so.6 Not found [131012050020] |I tried to make &&make install package, but I get an error: [131012050030] |libX11.so.6 not found [131012050040] |Where can i get this lib? [131012060010] |You need to install the libX11 package: [131012060020] |Just go [131012060030] |One more thing though: if you don't know how to find and install a library package, care to share why you are trying to compile a piece of software that is officially packaged for Fedora 13 in the most recent version? [131012070010] |I bet a more appropriate response would be to install libX11-devel... [131012080010] |How to add a feature to Vim if it's not compiled with that feature? [131012080020] |I am trying to use clewn (full gdb support in the vim editor), but the vim I have on my box doesn't have the netbeans_intg feature enabled. [131012080030] |Is it possible to enable it without recompiling vim? [131012080040] |I am using Cygwin. [131012080050] |EDIT: I did fix it by recompiling vim, but I was wondering if there were an easier way. [131012090010] |No, it's not possible. vim doesn't support compiled-code plugins, and as you've discovered, vim script plugins can depend on compiled-in features which you may not have. [131012100010] |how to glob every hidden file except current and parent directory [131012100020] |I want to glob every hidden file and directory, but not the current (.) and parent directory (..). [131012100030] |I am using bash. [131012100040] |Observe current behaviour: [131012100050] |I would like .* to behave like this [131012100060] |There is the shell option dotglob [131012100070] |that works in a way; now I can use * to glob everything (hidden or not) but not . and .. [131012100080] |but now I can't differentiate between hidden or not. [131012100090] |Also, .* still globs . and .. [131012100100] |Is there a way to make .* not expand to . and ..? [131012120010] |Are you just looking for files? [131012120020] |Are you in a position to use find? [131012120030] |Something like: find . -maxdepth 1 -name ".*" -f -printf "%P \n" [131012130010] |This answer (while it does work) does not properly answer the OP and I withdraw it. [131012130020] |Try [131012130030] |for the ls command. [131012130040] |More generally, [131012130050] |or equivalently [131012140010] |You can use the GLOBIGNORE variable to hide the . and .. directories. [131012140020] |This does automatically also set the dotglob option, so * now matches both hidden and non-hidden files. [131012140030] |You can again manually unset dotglob, though, this then gives the behavior you want. [131012140040] |See this example: [131012150010] |Which steps I have to follow to configure Ubuntu server with mac and windows workstations? [131012150020] |I've recently installed Ubuntu Server 10. I already have configured the basics and now I want to associate Windows and Mac OSx machines with the users created on ubuntu so that when I login in one of these machines, the network be configured automatically with user home directory and permissions. [131012150030] |Currently the network is working with Samba, and the login is typed when a try to access the server. [131012150040] |So, what I need now is the login associeted with workstations initial login prompt. [131012150050] |Also, in Mac machines I want to automatically mount the network when I login. [131012150060] |I will apreciate if someone provide me some resources and best pratices to do such thing. [131012150070] |Thanks [131012160010] |For serving files to Windows machines you need Samba. [131012160020] |Samba can also handle user identities, but I think that Samba's passwords and access rights are entirely separate from those of regular Linux users. [131012160030] |This piece of documentation makes me think so, go to "Samba as a Primary Domain Controller". [131012160040] |Disclaimer: I have really no knowledge on the subject. [131012160050] |I have neither installed nor administrated any Samba server. [131012160060] |Edit: [131012160070] |This seems to be Sambas's main documentation: http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/index.html [131012160080] |Samba has a PAM module for providing login information for Linux. http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/winbind.html http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/pam.html [131012170010] |Sometimes no sound in flash videos after boot? [131012170020] |Sometimes after I boot up the machine, I get no sound in flash videos. [131012170030] |First I didn't know why it was happening, but as I read a few articles here and there, I found out it was because of my USB webcam (logitech) - alsa was messing something up and didn't know how to handle sound drivers well (so they say). [131012170040] |So one of the suggestions I found was to force the (in my case) snd_hda_intel module load before snd_usb_audio module during the boot process. [131012170050] |I thought it worked, but after a while the same problem appeared again. [131012170060] |If I just unplug the webcam from my computer, sound works perfectly on each boot, but I don't want to get down and insart the cam everytime I need it... [131012170070] |Anyone have any suggestions what I should try to fix this? [131012170080] |thanks [131012180010] |You might be able to fix it by creating a ~/.asoundrc see http://alsa.opensrc.org/.asoundrc [131012180020] |Specifically you want the opposite of the case here: http://alsa.opensrc.org/.asoundrc#Default_PCM_device [131012180030] |so aplay -L with out the usb audio in and and asoundrc like this might work: [131012180040] |If your card (Like mine) gets named Intel by alsa just putting that in ~/.asoundrc should work (if you want it to affect stuff that's not run as your UID then put it in /etc/asound.conf) [131012180050] |Oh also none of this really applies if you're using pulseaudio... you need to do different stuff in that case. [131012190010] |is the behaviour of .* to include . and .. defined in LSB or POSIX or some other specification? [131012190020] |as title: is the behaviour of .* to include . and .. defined in LSB or POSIX or some other specification? [131012200010] |Probably you mean the functionality in bash expansion about globignore. [131012200020] |By default the bash expansion match . and .. but reading the man: [131012200030] |You can set the variable GLOBIGNORE=.:.. so when you tipe something like this: [131012200040] |you are removing only the current directory. [131012200050] |The POSIX standard only specify that . is the current directory and .. in the parent of the current directory. [131012200060] |The special meaning of .* is interpreted by bash or other shells (or programs like grep). [131012210010] |The Linux man-page references POSIX.2, 3.13. [131012220010] |Quoting from the Single Unix specification version 2, volume ”Commands &Utilities", §2.13.3: [131012220020] |If a filename begins with a period (.) the period must be explicitly matched by using a period as the first character of the pattern or immediately following a slash character. (…) It is unspecified whether an explicit period in a bracket expression matching list, such as [.abc] can match a leading period in a filename. [131012220030] |There is no exception that would make the second period in .., or the empty string following the only period in ., not matched by the wildcard in .*. Therefore the standard says that .* matches . and .., annoying though it may be. [131012220040] |The passage above describes the behavior of the shell (sh command). [131012220050] |The section on the glob C library function refererences this passage. [131012220060] |The language is exactly the same in version 3, also known as POSIX:2001 and IEEE 1003.1-2001, which is what most current systems implement. [131012220070] |Dash, bash and ksh93 comply with POSIX. [131012220080] |Pdksh and zsh (even under emulate sh) don't. [131012220090] |In ksh, you can make .* skip . and .. by setting FIGNORE='.?(.)', but this has the side effect of making * include dot files. [131012220100] |Or you can set FIGNORE='.*', but then .* doesn't match anything. [131012220110] |In bash, you can make .* skip . and .. by setting GLOBIGNORE='.:..', but this has the side effect of making * include dot files. [131012220120] |Or you can set GLOBIGNORE='.*', but then .* doesn't match anything. [131012230010] |Lock some accounts during some time periods [131012230020] |Is it possible to lock some accounts in order to be accessible only during specific time periods? [131012230030] |For instance the account joe should only be accessible during office hours. [131012240010] |In FreeBSD you can use the pw utility: [131012240020] |and [131012240030] |So now all you have to do is create a script to add logout and kill commands as required, loop through the users, execute via cron job and you're done! [131012250010] |If you are talking about Linux, it depends if the distro ships pam_time.so or not. [131012250020] |That PAM module can support limiting access to certain times of day, with user exceptions, fully looped into the PAM stack. [131012250030] |For other *NIX, if they support PAM (like Solaris) you can probably get and compile pam_time.so from somewhere. [131012260010] |Help with a find command [131012260020] |I have a bunch of directories. [131012260030] |Inside these directories is a cover letter and a zip archive of work. [131012260040] |I wanted to run a quick and easy query to open up all the cover letters so I can decide if it's worth looking at the work folder. [131012260050] |This doesn't work. [131012260060] |I've also muddied around with various print0, xargs -0 variations with little success. [131012260070] |What's the proper way to do this? [131012270010] |This should work: [131012270020] |You can test like this: [131012270030] |Not sure what the man page looks like on OSX, but there are various examples in the find man page, if you search for EXAMPLES. [131012270040] |I often find myself refreshing my brain by checking those. [131012280010] |If your xargs on your system supports -n option you can try following. [131012280020] |find . | grep cover\.pdf | xargs -n 1 open [131012290010] |First, always check what versions of find/xargs you actually use on your Mac-OSX box. [131012290020] |Perhaps you expect BSD/GNU behavior/options and use GNU/BSD versions. [131012290030] |Don't know if open supports multiple arguments. [131012290040] |If not call xargs like this: [131012290050] |(which means that xargs executes for every argument an extra open process) [131012290060] |And keep in mind that find | xargs without -print0/-0 is expected to fail if your filenames/paths contain spaces. [131012290070] |Aha, if you use something like [131012290080] |then grep is confused by all the \0 characters. [131012290090] |GNU grep (at least) knows the -z option. [131012290100] |Thus, which should work is: [131012290110] |Check what grep version you use via [131012290120] |Or check the man page of your grep for \0 (zero character) support. [131012300010] |Good website to link to for generic linux advocacy [131012300020] |I would like to have a link on website, both advertising the fact that I use (GNU/)linux, and pointing the curious reader to a source to learn more information. [131012300030] |But I'm having trouble finding the right place to link. [131012300040] |Desiderata: [131012300050] |
  • Not distribution specific. [131012300060] |(It would seem inappropriate to link to anything but the distro I actually use, but Arch Linux is not really right for beginners.)
  • [131012300070] |
  • Beginner friendly. [131012300080] |Says in very simple terms what linux is for those who don't already have any idea. [131012300090] |Links to download and beginner resources.
  • [131012300100] |
  • Not overly preachy. [131012300110] |Doesn't shame or scold people for being bad, naughty Windows/Apple/non-free-software users.
  • [131012300120] |
  • Professional looking and up to date.
  • [131012300130] |
  • Presents linux in a positive light.
  • [131012300140] |But I'm having trouble finding a destination that matches all these criteria. [131012300150] |Here are some of the things I've considered, but don't seem right for one reason or another: [131012300160] |
  • Linux online! [131012300170] |Provides decent summary, but the page is extremely unprofessional looking (IMHO); straight out of the mid-1990s.
  • [131012300180] |
  • Linux.com or the Linux foundation: To me, these seem more aimed at those who already know what linux is, and want to learn more about the foundation, or recent linux-related news, rather than beginners; but the first link may be a possibility; some the pages buried deeper down are more promising.
  • [131012300190] |
  • Switching to Linux page on Grokdoc; a very good source of information, but is just information only, no pizzazz.
  • [131012300200] |Thoughts? [131012310010] |This site does not comply with the "Not distribution specific" but you know what they say: "...Learn Slackware, Learn Linux", so, in that spirit, check out the Slackbook =) [131012320010] |Let people explore themselves. alternativeto.net allows you to find alternative applications for different operating systems. [131012320020] |People love pictures, whylinuxisbetter.net has a great summary style landing page with pictures, click on them for a detailed breakdown. [131012320030] |Update: There are so many sites that advocate GNU/Linux, and just found this list of links that will keep anyone busy for quite a while. [131012320040] |There is also sites like http://badvista.fsf.org that advocate via FUD, but I think it's best to stick to sites that focus on the positive of Linux, and not the negatives of the competition (for newbies at least). [131012330010] |http://www.youtube.com/watch?v=bDxMJQLXmBE http://www.gnu.org/gnu/manifesto.html http://www.kernel.org http://www.kernel.org/pub/linux/docs/lkml/ [131012340010] |I found linuxquestions.org to be a great forum, especially for beginners. [131012340020] |I still ask a question sometimes there, when I need a somewhat quick response and don't want to use Usenet, especially when it's concerning legacy hardware, etc. [131012340030] |Don't know if you want to put this on your website, but it's definitely a good place to start. [131012350010] |Multiple USB wireless devices? [131012350020] |I have a broadcom wireless card in my laptop and as far as I know, it acts as an USB device. [131012350030] |I also have one USB stick wireless device (TL-WN422G - uses ath9k_htc driver) which I want to use at the same time as the first (Broadcom) device. [131012350040] |The problem is, after I load ath9k_htc - iwconfig does not show the new USB device (the TL-WN422G - wlan1 / ath0 / whatever), but only the old one (wlan0 - Broadcom, checked by MAC). [131012350050] |I tried this USB device (TL-WN422G) on my other computer that has PCI wireless card in it, and they both worked just fine together after I pluged it in... [131012350060] |I get wlan0 (Ralink) and wlan1 (TL-WN422G). [131012350070] |Is it some kind of a problem for the laptop that both devices are recognized as USB? [131012350080] |How do I make wlan1 appear on my laptop? [131012350090] |also, my system is fully up to date 2.6.35 kernel (Arch) [131012350100] |edit: I've already downloaded the needed ar9271.fw from linuxwireless.org and I put it into /lib/firmware - something wrong in that? [131012350110] |dmesg gives me this on laptop: [131012350120] |and this on the computer that does work: [131012350130] |thank you [131012350140] |p.s. - moderators, could you please add this tags (I can't, don't have enough reputation): wireless atheros broadcom [131012360010] |for some reason the ar9721.fw file was empty... downloaded the file again - put it into /lib/firmware and now it works...