Archive for category Linux

Saturday, June 19th, 2010

Command line file management

I have been a fan of the command line for a while now, about from the time I moved from Ubuntu to Arch. The most difficult thing to get used to was command line file management but I think I can do anything now comfotably from the command line and I think I am a lot faster doing it thanks to a couple of wonderful applications.

First of all there is coreutils, this is the thing every one knows and is used to. It has the regular things like cp, rm, mv and ls. It is however the basic of everything. Combined with shell globs this is a very powerful thing, and it can do any I wont go into the basics of those commands but I will share some examples that I found very useful and weren’t as obvious as others.

When you have a list of pictures, named pic001.png through pic732.png and you just want to remove pic051 through pic521, you can use shell ranges. They are defined like pic{<startno.>..<endno.>}, so in our example it will be like:

rm pic{051..521}.png

Also ls isn’t as useful as it could be by default. I think every distro has some basic options set for ls like --color=auto but there is a lot more. For example, I also like to have my directories and files seperate, and there is an option for that called --group-directories-first. I also like to see the size of the file as well as the permissions on the file, and ls -l is perfect for that, but the filesizes is in bytes by default, which isn’t really human readable. I mean, I don’t care my file is 45234786 bytes, I just want to know it’s 4MB. ls -lh is for that. I think by now we have a very useful ls, you can try it out by executing ls -lh --color=auto --group-directories-first in your favourite shell. Or, a lot more useful, you can make an alias.

Then we have cd which just does what it should, which is change to the directory specified. But as we all know, we mostly hang around a couple of directories, and we just want to switch to those easily and fast. Some archer named Joel Thelion made an application called autojump which he describes as The cd command that learns and that is exactly what it does. It keeps track of in what directory you are and how much you do in there and it calculates a weight of that. That weight is later used to determine where to move. I can explain it but it’s better to just try it, it is awesome!

I think that makes you able to do all the things you do in a normal file manager, but just with your fingers on your lovely clicky keyboard. We all know that you dislike the mouse, like you should according to a lot of linux elitists, although I have to be honest and I like it a lot for laid back browsing sessions. But to the point, and that is shell based file management. And the shell is so powerful because it’s scriptable, you can chain things together very easily. And the most amazing application for that is find.

For example, you have a directory filled with rars which you all want to unrar. Instead of unrarring them each on their own you can use find. We are trying to find the files ending in .rar in the directory “Archives”, so just to test what we find we can execute find Archives -name "*.rar" which should print out the path to those files. But we want to do something with those rars, not just know where they are, and find has a flag for that called -exec . -exec needs two things, the binary to execute, in our example it’s unrar e, and {} \;. The {} is replaced by the path it finds and \; mimics a return key being pressed.

I really hope I learned you something and if you have ANY comments/criticism please reply to this post!

Friday, October 23rd, 2009

Uzbl and Xmonad

I already showed you that I switched from Firefox to Uzbl. Uzbl has no tabs out of the box, so I had to come up with something else. Somebody made a tabbing plug-in for Uzbl, but somebody else pointed me to the tabbing layout for XMonad. But I don’t want my browser full-screen. I have 22″ monitors with a resolution of 1680 * 1050 so full screen is a little much. Fortunately XMonad has something for that as well. namely the ComboP layout.

ComboP is a way to combine multiple layouts in one workspace. I now have a portion of the workspace tabbed so that is where I can have multiple uzbl windows. On the other portion I have two terminals. One for Weechat and one for Mutt. These are situated in a tall layout that doesn’t resize so they will always have 50% of the available vertical space.

This would be useless to have on every workspace, I just want it on the one I have reserved for my browsing. So I went to look for another module and found it. It’s called PerWorkspace. It gives you the ability to set a layout for just one workspace and to have just one layout on a workspace, and multiple on all the others. It does make your layoutHook look like a mess.

Here is my layoutHook line, don’t forget the imports!:

,layoutHook = avoidStruts $ onWorkspace "www" (named "Tabbed" (windowNavigation (combineTwo (TwoPane 0.03 0.5) (tabbed shrinkText tabConfig) (Mirror (tiled))))) $ tiled ||| named "HintedTall" (hintedTile XMonad.Layout.HintedTile.Tall) ||| noBorders Full

I think this is a great example of what Xmonad can do. You can mold and craft it into anything you want and it will do it for you. I just love my setup at the moment. If only there was a good cli-feed reader that could synchronize with Google Reader

Wednesday, August 26th, 2009

August 2009 Screenshot

A lot has happened in the past year, but not a lot different in the screenshot. It’s uzbl now, the rest is pretty much the same. I like it.

xmonad, uzbl, urxvt, dzen2, weechat, Vincent Kriek

Config Files

Wednesday, August 6th, 2008

ZSH, I love it

I was bored a couple of days ago. I installed xmonad and everything worked like it schould. So I started browsing the ArchLinux wiki searching for something new to install. I heard about zsh-completion being wonderfull but I never understould what zsh was. Zsh is a shell, an alternative to bash. I never had problems with bash but I never founf it really good. I liked it’s completion but I heard zsh’s completion was better.

Zsh is in ArchLinux’ extra repository. You can change from shell using the usermod command. You just do

usermod -s /bin/zsh USERNAME

You have to login and logout to activate the shell. Basic configuration is done in .zshrc. It works like .bashrc with some other commands. My .zshrc is bits and pieces from other people and form my .bashrc. You can find my .zshrc on my git branch. Gentoo’s documentation on zsh is rather good.

Since I now have succesfully installed and configured zsh I am looking for a new project, anyone tips? And also, i would love to see your .zshrc

Sunday, August 3rd, 2008

And the winner is…

Last week, I wrote that i was still looking for a window manager that I really like. I have tried all the mayor tiling ones and I finally settled with Xmonad. Yes, the window manager with the 300Mb haskell compiler dependecies. I’m okay with it now.

The way xmonad handles two (or more) screens is the way all window managers should do it. You have one set of workspaces. The screens are portals to these tags. So you can have workspace one on screen one and workspace two on screen two. Then you can have workspace two on screen one and workspace four on screen two. A picture to demonstrate:

Xmonad workspace screen explanation

The configuration file is easy to edit and I like it a lot. Even more so then the config file of awesome. It sounds scary to edit a haskell file but haskell is a nice, easy to understand language. My config file is found here.

So the reason I sticked with it were the multiple screen support, config file and the simplicity. I know a 300mb dependecy for a ~1 mb window manager is not really KISS but the way XMonad works is really KISS. That is because only manages your windows. You can choose youre own panel(if any). I like it!

When I started with linux, i started with Gnome. It was fine for a while but I didn’t like it very much. You weren’t able to delete all panels for instance, and I wanted to. Also, I don’t like the DE idea. I only want to install what I need.

So I installed Openbox. And it was amazing. The configuration file is very nice, and the whole wm is really clean. It’s in my opinion the best floating window manager. The right-click menu is amazing, you can choose your panel yourself and it has no dependencies! So I ran Openbox for a while. But I only had terminals and a movie and a browser. The browser on screen one, and the rest on screen two. So I figured that with a tiling window manager I would use the space on my screens more efficiently. Sadly, Openbox doesn’t have a tiling feature. Wich I pitty, and quite a lot of archers with me.

But tiling window managers are hard to configure. Xmonad is configured in haskell, wmii in ruby or python and dwm in C. And I am not a programmer (yet). But I tried Xmonad for a while, it’s very nice, the dual screen support is amazing, but I hate installing 300 MB(!) of dependency’s for one program.

But then I found Awesome. And Awesome has an awesome name ánd an awesome configuration file. It is easy to understand and edit. But awesome 3.0 (it’s 2.3 now) is going to have a lua configuration file. And I don’t think that is an improvement. Awesome was the window manager that made it easy to tile.

So I tried dwm, becuase I love the idea of simplicity. Also the configuration file is really nice and clear. More so than awesome’s lua configuration file. But dwm doesn’t do dual screen as awesome. So I am going to stick with awesome for the time being. Learning lua, but when dwm does dual screen like awesome, wich means one statusbar per screen and different tiling layouts for each screen, I am going to install dwm right away. Do, by any chance, you know if I can start two instances of dwm, one for each screen? And what window manager do you use and why?

Thursday, June 19th, 2008

Lvm is lovely

I am a neatfreak. Not in real life but on my computer. Everything must be in the right folder with the right name. I don’t like clutter on my desktop. I hate it. But i have a reasonably large video and music collection. But it’s difficult to keep it neat with three seperate hard drives. I used to have a /data folder with in that folder 3 different folders linked to the different disks. I had one disks for Animé and Music, one disk for TV-shows and one for Movies. But I don’t have that much Anime and Music so I have a lot of unused space on that disk. But I can’t put other stuff on there and still keep it organised. I was interested in raid but raid 1 is a waste of space, raid 5 is nice but for good performance you need a raid card, and raid 0 is too insecure.

And then I discoverd Lvm. Lvm stands for Logical Volume Manager. What it does is it combines hard drives and partitions (physical volumes) into a large volume group. Within this volume group you can make partitions that cover multiple hard drives.

So what I did was combine all my drives into one large 2.16 TB partition. And I love it. If your interested as well, use this howto. It’s all you need. And this is what I love about linux. I like to finetune my system. And this was so much easier than I thought but remember, ALWAYS BACKUP YOUR DATA.

Home