Pages

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

Monday, September 27, 2010

Using Vi or Vim



     The title is perhaps alittle ambiguous. As far as I know(or am concerned really), Vim and Vi are the same thing: Extremely efficient keyboard input. They both have virtually the same interface, accept the same commands etc.. 99% percent of users probably don't care, but Vim is a tool that takes standard keyboard input and develops it into a science. This is similar to the more efficient, yet much less used Dvorák keyboard. But Vim does not demand that you change your entire keyboard layout(even I am using the standard QWERTY as I type this).

Vim: So whats the point?
     As mentioned earlier Vim is a way for extremely efficient keyboard input, so that means that should you use this, you can navigate faster, edit/create text documents much faster than the more widely accepted standard. It's a whole new interface on typing, and although it can be a daunting challenge to learn, most people will say that it definitely helps. You have way more advanced features in your arsenal. Totally unnecessary in daily life, but users of Vim will see these obvious benefits. And you will be hailed as the leader by all of your nerdy friends.
This post is not meant to spark up the holy war between Vim and Emacs. However, I recently saw a neat trick that would help you learn Vim. In a linux environment you, might already have it. Just run the command: 

vimtutor

It seems to be just a text file that gets loaded with the Vim editor. However that's would place the tutorial in the command line. There are graphical interfaces for both linux(search for vim-gui in your package manager) and Windows


You can also use cream. Seems to be yet another interesting variant.

Tuesday, August 3, 2010

Ls - List directory Contents

ls - List directory contents

This command is probably one of the most used commands when navigating through a Unix/Linux file system. You can open up the Command Line Interface(CLI) in Linux and type ls. This is a sample of what'd you see.

ls
ls *
This is a good start to see what's going on, but we can get pretty fancy. Typing in will give you the current list and a one level down on each folder. It gives you the list of the current directory and lists the contents one level into each folder. Quite useful.

ls -a
The -a is good for displaying all files and folders including hidden ones. In Linux, hidden files/folders are perpended with a ".". These files/folders aren't displayed by default.

ls -l
Another useful feature is the -l option. This gives more detail. It's alittle intimidating at first but it's not all complicated.
If you haven't messed with Linux file-system permissions the leftmost column will be the most confusing.
In this example :
drwxr-xr-x  2 root root  4096 2010-07-04 08:09 bin


The first d means that 'bin' is a directory.
drwxr-xr-x


Owner:
drwxr-xr-x
the following 3 characters are the owner permissions: rw, and x mean that the owner has permission to read, write, and execute.




Group:
drwxr-xr-x
the next three characters(r-x in this example) are for the group. Here, r give the group permission to read, x gives the group permission to execute. The dash '-' is shown in place of the write permission because writing data to this directory is not available to the group.




Others:
drwxr-xr-x
The last three characters represent the permissions available to others, or everyone else that has access to the system. As you can see, everybody else has the same privileges to that directory as the group.




The next column is for the number of directories, followed by the owner, group, size, date/time last modified, and finally, the actual filename.

So this was a in plain English overview of the ls command. Is there something else I should have included? What kinds of things would you like to see? Leave a comment.

Sunday, August 1, 2010

Learing the Command Line Interface(CLI)

To kick start this blog, I'm going to try to cover one Linux command in detail each week. So if there's something you would like to know how to do, just send an e-mail to freakinjonathan@gmail.com. This is going to be in plain English, and I'll try to go over the various options of each command. I'll figure out the structure as time progresses.