Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

2011-10-12

screen tricks

GNU screen has been a staple tool for a few years now that I do most thing on remote machines. My main hangup with it is switching windows which I do a lot and requires multiple keypresses (C-a #).  This can be alleviated some by splitting the screen (C-a S) so I don't have to switch as often. But that introduces yet another sequence of key strokes (C-a TAB). It's something I can only stomach on a larger screen since I hate terminals with too few lines.

It occurred to me today that I could open up to ssh sessions and have both joined to the same screen session, so that I could keep different windows open in each. Simply open the second terminal with "screen -x".

Another trick I discovered was to add the following to my bashrc.
if [ "$TERM" = "screen" ]; then
  screen_set_window_title () {
    local HPWD="$PWD"
    case $HPWD in
      $HOME) HPWD="~";;
      *) HPWD=`basename "$HPWD"`;;
    esac
    printf '\ek%s\e\\' "$HPWD"
  }
  PROMPT_COMMAND="screen_set_window_title; $PROMPT_COMMAND"
fi
And now my windows have a more sensible name; I do find myself constantly cycling through windows till I find the right screen in the right directory.

2011-04-10

Tramp at work

One major change in workflow that I had to get used to with the company change a few years ago was doing most of my work and development through remote terminals.  Try as I might to do at least some work on my local machine there was just no escaping that it was just more convenient to do my script writing and edits and tests on the remote machines.  A shell is a shell so I can manage: windowless emacs and vim for editting, and screen sessions for stuff.  But I hate the lag introduced working remotely, I hate not being able to exploit having remote drives mountable to my local machine, I hate not being able to exploit my local tools and environment.  All of this could go away partly if they just enabled sshfs so that I could at least access some of the data for development purposes (much to much to xfer locally and there's policy against it).  But alas, they are unwilling to enable it, even if there's no good reason.  It's not like i would be able to access anything more than I could anyways.

So one thing I tried before was at least being able to use my local emacs editor to edit remote files with Tramp.  I recall having to munge my commandline prompt to get it to work and that it was a little clunky and so I gave up.  But I've tried recently tried it again and it went a lot more smoothly to my surprise.  It even came with my latest Ubuntu installation (finally updated after a year+ of laziness) vs my downloading and installing it myself previously.  So it was trivial to try again and I was pleasantly surprised.  Saving and loading has the lag still but everything else gives me the snappiness of a local machine (save for when I have a network interruption).  I guess I'm going to try this method out until I come up with a more satisfactory method of doing more work locally without all the constant syncing.

Unfortunately what got me thinking of this again was wanting to try another editor to edit Python.  As much as I like (or rather am used to) emacs and vim, Python feels like it require a lot more editor support to do right and to overcome annoyances.  So I've been wanting to move to an IDE so I'm testing out Eclipse and the remote access plugin, but so far I am thwarted by it's need to have SFTP enabled remotely or another server running remotely in order to work.  Not having root there I just don't have the time or energy to work around trying to hammer that together.  I'm bugged to no end that there is no easy facility for installing packages as a user without root.

2006-11-08

Linux Layout

Over the course of my life in the Unix/Unix-like world it's every so often occurred to me that there's just gotta be a better directory layout for the beast. 2 things about that: 1) it's messy with items belonging to the same program spread all over the place and mixed in with other applications making it hard to keep track of; and 2) the places programs want to install to are root-owned so adding new programs on my own as a non-root become more work, if not downright frustrating, to put it somewhere else.

WHY!!! is it standard operating procedure in the Linux community to assume that everyone has root?

Anyhow, one of the frustrating things is wanting to try out new packages and having to jump through hoops to get it to work in place without installing files into X different directories. I'd envisioned many times a system where applications were self contained in their own sub-directory tree that can be easily maintained and deleted if desired. There would of course be a convention for searching and sharing dependent libraries and items. I guess this is how it's done in the new OS-X world, good for them.

I recently read about a Linux distro that does exactly that: GoboLinux. It's nearly exactly what I was thinking of and I strongly suspect that it has occurred to the minds of a LOT of Unix/Linux users.

Reading the forums and talkbacks and comments though, it seems like there are a lot of people that are against the idea of re-organizing the Unix layout of /bin /sbin /usr/bin /usr/sbin /usr/lib /opt /etc etc. etc. They seem to fall into 3 camps:

  1. Too Windows like... dumbing it down for the n00bs... things of that nature
  2. There are good reasons for the layout, aint-broke-don't-fix
  3. Too set in our ways
Number 1 I dismiss outright... partly because I don't find it really true (being more Windows like) and partly because I think they just like being "in the know" of some esoteric stuff and want a barrier to entry.

Number 2 probably has some valid points but I don't fully buy it. They seem to think Unix was designed to be sensible. There were indeed decisions for the layout but by and large I'm convinced that it grew organically from a day when there were far far fewer applications and when memory and space and speed were at a premium. IMHO, there was really no long-term plan for this organization and this directory structure just doesn't scale well to the number of users and applications now. It's created a mess and all the work on packaging and dependency tracking were grafted on and only serve to obfuscate the basic underlying cause being this antiquated file tree.

Number 3 is probably why we're forever going to be stuck with complicated system management.

Thing of it is, there are already good examples to refute the reasons not to have an alternate organization scheme for applications and files. OS-X is one example it's a BSD based system. But there are other sub-examples in the typical Linux world. Rubygems comes to mind immediately. It's relatively simple (only 1 command organizes the whole thing), gracefully handles multiple versions of the same package, and casual inspection of the tree proves it to be fairly logical.

I may try out GoboLinux at some point, they even have a Live CD which I find impressive. They made a couple of design decisions that I find practical and interesting and possibly even better than what I was originally imagining. The linking of pertinent files to the old tree structure is sensible. I had imagined turning the includes, paths, and library finding features into more of a device such that any attempted access to /usr/local/lib/xxx.so would be handled by the system as a redirect, like the way web pages are. It was just a thought experiment. Links (and the possibly clever use of hiding) seems more practical. I just fear that dependence on the old tree structure will remain if one always assumes it's there.

But again there's the inertia problem. Not enough people would conform to the new layout. The spark of hope is that if developers would make their program installs well enough to easily allow installation to non-standard places, then this may become less and less of an issue. I'd certainly welcome a system where the organization is implicit and not reliant on a myriad of package handlers where there are as many as there are distributions.

2006-10-12

Distro feel

I finally allowed the IT guys at work to replace/upate my machine to the new regime. I have a Gentoo box sitting on my desk now. It's actually been ready for a couple of weeks but I had to make them wait because I couldn't afford the interruption in the meantime. At last I got my upgrade. Most of the folks in my group are very resistant to system updates and changes... some notoriously so. I can see their point of view, I just don't share it. And knowing that I'm very amenable to updates and changes despite the glitches that always appear, the IT folk had slated me as one of the earlier guinea pigs (though not the first). I'd been waiting for this update for quite some time actually. Newer software with newer features and at last I can use my USB flash. I also like that my machine seems more responsive all around (mostly due to newer machine with more memory but I suspect some of it is due to how Gentoo builds things).

One thing that kind of surprised me this time around, though, is that the feel of the Gentoo distro is not what I expected. True, I've only used it for a few days but it almost feels like I'm really just using a generic KDE box. Here's what I mean. When I was using RedHat it somehow felt like I was using RedHat. When I was using Debian it felt like I was using Debian. My home machine has Ubuntu and it definitely feels like I'm using Ubuntu. But right now, I don't have this strong feeling that I'm using Gentoo. Not that I feel like I'm using some other distro, but more that I'm just using some generic Linux with KDE. It's just a feeling and I'm sure it's more than just splash screens and extra icons here and there. It's a bit hard to define precisely and maybe it's largely subconscious. It's probably a good thing but is that not wierd?

2006-08-22

Firefox bound

Ever have something nagging at you for the longest time and yet you do nothing about it and just try and deal with it. I do that all the time. I'd always been bugged that when entering web forms in a browser, namely Firefox, I didn't have my emacs-style keybindings for editing text. And yet, I did nothing about, not even something as trivial as doing a web search. I think there's a certain amount of learned helplessness in there somewhere. Well, now that I've set up my work Instiki, I will be doing more and more text entry into my browser than I used to and enough was enough.

Thank the maker! My solution was within a few keystrokes reach. As usual, I feel like an idiot for not looking this up ages ago.

Sadly, those keybindings don't seem to work in Blogger. Curses!

ADDENDUM:

Speaking of binding Firefox, I had an issue when I upgraded to 1.5 and Thunderbird as well. They didn't work together by default on my workstation. Now... there's a reason for this. The IT guys were so overworked that our workstations are way out of date. Not their fault really, there are other political reasons why our systems stay out of date. Anyhow, I ended up installing it locally in my home directory and using it there. When I clicked on a link in the email client, it would try and bring up epiphany, and when i clicked on an email address in the browser, nothing would happen. I did a web search and all the pages pointed to making sure the "Default Browser" was set properly. I changed it everywhere I could with the control panel(s) and such. None of it work. So I got stuck with doing the cut/paste method of following links and I was irritated for months. Fed up I finally cornered an IT guy for help and he was able to dig up a couple web pages that had the solution. Ugh! I did web searches but he used one or two different words in the search that I did not (nonobvious ones like "force") and was able to get the result whereas I was not. I applied the changes and voila, all fixed in a snap. What a difference a search makes. I feel like a n00b. In my defense, he had done that fix before so remembered what to look for, but still.

Oh, a solution can be found here and it didn't involve any system or window manager or desktop "Defaults".

2006-08-03

Happy with the Linux distro choice

These days I find myself rarely booting my Linux box (laptop) but when I do, I become more and more pleased with having picked Ubuntu. It is definitely the low maintenance distro that caused me to install and keep it in the first place. I'm still interested in Gentoo but until my office workstation uses it, I'm just as happy to not use it since it would require a lot more tinkering which at the moment I'm just not willing to do. I sit in front of Linux all day and with all of my other personal projects I just don't feel like booting up Linux at home unless I need to log in and such. That may and probably will change in the future, or at least I hope so. But for now, I'm pleased with Ubuntu and I think that so far it's the best distro that I've had at home.

What prompted this? I hadn't turned on my laptop in a month or so, and like clockwork, there was a new Ubuntu release. It updated without a hitch and I noticed that it did indeed correct some of the glitches that I had seen before. I later experimented with ripping a CD to mp3 to discover that it could not. Apparently, the philosophy of Ubuntu prevents the mp3 encoder from being installed by default due to the whole licensing BS. A little bit of due diligence and web searching through the forums and the solution was there in front of me. Install stated packages and voila it works. I read a lot of press about the helpfulness of the Ubuntu community and my experience so far has led me to agree.

Now, is it fully dumb-user friendly? No, I wouldn't say so. But for someone like me with a lot of *nix experience who at the moment doesn't want to take the time to tweak and tweak, it's as close as I've found.

2006-03-25

Just in time Linux

Fates have conspired in my favor for once in a minor way. Meaning... I'm really really glad that I got my home Linux box working last weekend. It turned out that all week long I was working long hours, like until 2am and such. The first day I sat in my cubicle all night, leaving only for breaks and dinner, but only because I didn't realize it was going to take that long so I kept staying a little longer and a little longer. Problem is, the stuff I was working on took a long time to run each step. Luckily, the web is a good time sink but doing it at the office that late seemed like a waste. The next day I saw it coming sooner because the compute servers were clogged with jobs from others in my group and it took half an hour to even get to mine (our job server is decrepit but we don't have the balls to change it). Screw you guys, I'm going home.

Fire up the Linux laptop, turn on the TV, grab some junk food. Ah, much better. Good thing I set my VPN up. Managed to catch up on some queued up shows including a Netflix DVD that I've had for months but was never in the mood to watch; all while monitoring my jobs, making adjustments, checking for errors, and taking the necessary time out to do some actual scripting. I was really really happy I had set this laptop up the previous weekend. I didn't want to go to work the next day, just work from home in front of the boob toob.

Ok, I could have done this anyways with my Winblows computer. I do have cygwin on it afterall, and cygwin is great. But it's more of a crutch and I resist using it too much. I think it has to do with the environment. Maybe it's because I'm used to working a certain way at work with Linux that I can't do completely on Windows. Little things like mouse focus, middle button, copy/paste, etc.; just the feel that I'm used to for that setting. Well there are a couple annoyances, I never figured out how to copy/paste in and out of cygwin windows reliably. Anyhow, I don't have an exact mirror distro and setup on the Linux box (different distro and a better one at that) but most of the basic use is there. It's all familiar and at my fingertips, man pages and all.

Only bad thing is I couldn't get the X forwarding to work. Works fine on my cygwin but won't accept my display on my laptop. It wasn't that important, it was all command line and text editting and thankfully emacs can run in that mode. X was always too slow and annoying remotely anyways but it was occasionally necessary. Correction, it was fine back in grad school when I had T1 in my room (oh how I missed it). On cable internet, there's just enough lag to get turned off, especially when it's just text stuff.

It also worked out that I ended up using Ubuntu instead of Gentoo because the packages are binary and install in a jiffy whereas Gentoo would have taken hours to get set up since it compiles from source. I could see myself getting frustrated knowing I had a lot of work to do but having to wait. There's still a big desire in me to try it out but this is good enough for now.

2006-03-20

First day with Ubuntu

The jury's still out but from what I can tell from a day's tinkering with Ubuntu I can sort of see why it's become so popular. It installed fairly cleanly and I was a little excited to see the login screen and get going rather quickly... and with the sound and screen and most things working. I remember having to do a lot of config file editting to get Redhat working on my old Toshiba (especially the video) and I had all kinds of problems with the sound. I remember moving over to the enlightenment system (still experimental back then) but Rasterman's esound stuff worked pretty well. Anyhow, the only setup problem I had was getting my wireless to work. My Linksys PC card wasn't set up for me. After some digging I finally found an excellent step-by-step guide that did the trick (wasn't about my particular card but close enough). After that was resolved, I could finally unchain my laptop to my switch and move it to the TV room.

Mental notes from a first day's playing with Ubuntu
  • Hey, sudo isn't so bad afterall! No need to keep a root terminal up. Menu'd items work after typing in the password. Fairly straight forward even if it means I'll eventually hate my password from all the typing.
  • The system really is more for the commoner... gcc and g++ not installed by default??!!? Now that's a first.
  • It defaults to Firefox 1.0.7, not 1.5. What's more is there seems to be a dependency on this version of Firefox. I had to do some trickery (found online) to get 1.5 installed and usable. That worries me.
  • The community seems nice and large, some fixes and tweaks were readily findable online.
  • Ugh, package managers. The dependency problems creep in. The package manager app I find quite good but there seems to be stuff missing. See below.
The first thing I did after getting the wireless set up was try and install Ruby. Fine. Go to package manager, select all Ruby related packages. Install. Uh... Interactive Ruby (irb) doesn't seem to be listed in the manager. WTF? Ok, download it from somewhere else. Dependency problems from hell. Look online, do a few more things, try some apt-getting. Nada. So I delete it all, all the Ruby related packaging, and just download the source. Looks like I'll be managing Ruby by myself. This is, incidentally, how I found out my normal compilers were missing.

Ok now for Openvpn and something else I can't recall right now. Package found, great! Uh, looks like the dependencies aren't quite there. I needed to get the -dev packages for some other things.

I admit, managing software manually from source is often the way to go but takes more time and effort grabbing the right things. So I can appreciate package managers for what they do right when they work right, which I guess is most of the time.

So far though, it hasn't been so bad. No matter what distro I use there's bound to be a lot of fixing and tweaking and such. So it's a good thing to start from a system where as much works as possible when one doesn't want to invest the time in starting more from scratch (though that can be its own reward at times) and Ubuntu seems to have a lot of the raw equipment setup stuff down fairly decently (my particular wireless card excepted of course).

I'll probably switch later.

Distro choice

So with my new home Linux box, I was only strongly considering two distros. Gentoo and Ubuntu which from what I understand are at the opposite ends of the user spectrum; Gentoo being geared more towards the hands-on and Ubuntu more towards the commoner.

I wanted Gentoo because
  • I haven't managed my own box in some 8 years and was therefore very rusty with Linux innards. Quite a bit has changed/advanced. I wanted to get back into it.
  • I like the philosophy of Gentoo. I like the idea of optimizing performance for my machine.
  • Someday my office workstation is supposed to use Gentoo.
  • It has a strong following.
But
  • I know it's more time consuming in getting things setup.
  • It would take me quite a bit of digging to learn the ins and outs and details.
  • I just have too many other projects as it is.
Ubuntu was the other option, the fallback options. I was interested because
  • I read a lot of press on it. It seems to be the most popular new distro around.
  • It was easy to set up and use.
  • One of the IT guys tried it out and said it just works pretty cleanly out of the box. Very simple to set up. Sound works, CD works, etc. etc.
  • Seems like the low-maintenance solution
But
  • The feel-good global-tribe theme I find kind of creepy. The naming convention too.
  • No root? Everything is sudo. Now that's odd. Interesting.
  • Having been using Debian for the past many years I've grown disenchanted by it and things based on .deb packages. Same with .rpms and the Red Hat line.
Turns out Gentoo failed to install on the first couple attempts but Ubuntu started up almost perfectly. And there-in lies the deciding factor. I was just not willing to do too much tinkering to get things working and at 4-5am decided I would stick with what worked. I could always switch later. Or maybe I should just face facts that I've become a commoner.

Home Linux again

I haven't had a working home installation of Linux since grad school. Back then it was an ancient Red Hat on my old Toshiba Satellite Pro. Came in really handy. I eventually put Winblows back on it near the end when I lost my home-T1 access but also because I wanted to use Illustrator to work on the graphics in my Diss and a couple other pieces of software. When I finally got a new laptop some 5-odd years ago, I tried several of the newer distributions on that old Toshiba. The install scripts always failed. I did a modicum of research and with the help of a company IT guy I got X to work, like for a day. Rebooting always crashed though. I gave up and gave the laptop away. It was way old anyways with a small drive, little memory, slow processor, small screen... only thing I truly liked about it was the keyboard keys.

So after getting a new computer last year I figured it was time to do it again but with my older Dell laptop. This time, I didn't want to put a lot of time into it, I have enough personal projects to keep me busy. I was going to use the first distro that worked, starting with Gentoo. I burned the latest install CD 2006.0. Tried both install scripts with a couple different configs including the defaults and it failed each time. Did a couple searches but decided that rather than fix it I moved on to Ubuntu which I was also curious about. It worked as advertised, with only a couple gotchas.