Category
shell
-
03.19.10Shell scripting for NautilusIt has been a while since I wrote my last post. Sorry for the delay, but I was a bit busy lately. In this post, I shall explain how to get the most of your nautilus file manager by using shell scripts. Nautilus provides some facilities available from shell scripts. Combining them with a small utility called zenity can improve your daily tasks. Nautilus has the ability of executing shell scripts applying them to the selected files. The executable scripts are those present in the following directory: ~/.gnome2/nautilus-scripts Every script present in that directory will be shown in the "Scripts" entry of the contextual ...
-
02.24.10Running e2fsck on a mounted filesystemI know, running fsck on a mounted filesystem is utterly unrecommended. The command warns you (it actually frightens you) with the following message: # fsck /dev/VolGroup00/LogVol00 fsck 1.41.4 (27-Jan-2009) e2fsck 1.41.4 (27-Jan-2009) /dev/VolGroup00/LogVol00 is mounted. WARNING!!! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage. Do you really want to continue (y/n)? no check aborted. But sometimes I need to check a filesystem in a remote host, so I cannot boot from a liveCD to run fsck in the unmounted device. Looking for an option allowing me to overcome this nuisance I found the following in e2fsck's man page: Note that in ...
-
01.22.10Vim for programmers (III)Welcome to the last "Vim for programmers" issue. Ironically, in this issue I will show you some nice characteristics despite they are not specific of programming. However they make much more sense when they are applied to programming. Getting C help This first feature is oriented directly to C programming. In most UNIX systems, there is a collection of system manual pages available with the command "man". Although I will not explain man in detail (you can read more here (or type man man) it is worth saying it shows information about the command, system call, file, etc passed as parameter. ...
-
01.17.10RPM: Listing dependencies of an rpm filerpm is a powerful Package Manager, which can be used to build, install, query, verify, update and erase individual software packages. It is the default package manager for several popular distributions such as Red Hat, Fedora, Suse and many others. The list of dependencies an rpm package has, that is, the packages that must be installed in the system for it to work properly, can be shown with the following command if the argument is the rpm file: # rpm -qpR rsync-3.0.6-0.fc10.i386.rpm config(rsync) = 3.0.6-0.fc10 libacl.so.1 libacl.so.1(ACL_1.0) libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.2) libc.so.6(GLIBC_2.3) libc.so.6(GLIBC_2.3.4) libc.so.6(GLIBC_2.4) libc.so.6(GLIBC_2.8) ...
-
01.07.10Vim for programmers (II)In the first part of this series, we visited some Vim features that help us in programming. In this second issue, I will show you some other important things you should know to really appreciate the power of Vim. Completion Completion is not a programming specific feature in Vim, however it is in programming where I find it to be more useful. There are several completion options, but I will explain the ones I find more interesting. Completion is a sub mode of insert mode. This means the commands are applied while being in insert mode. Line completion: Ctrl-x ...
-
12.21.09Mounting and unmounting a disk image (dmg) in OS XA file with the extension .dmg uses a proprietary disk image format commonly found on Mac OS X (well, usually: you can use any extension anywhere, obviously) . The command used for manipulating disk images is hdiutil $ hdiutil attach nmap-5.00.dmg esperado CRC32 $C955C266 /dev/disk2 Apple_partition_scheme /dev/disk2s1 Apple_partition_map /dev/disk2s2 ...
-
12.18.09Are your DNS Servers failing?Some days ago Google launched its public DNS service. Another older, public DNS service is OpenDNS. Both let you use their DNS servers insted of your ISP's. I have been using OpenDNS for a year because I had problems with my ISP's DNS servers. They were down frequently, so I searched for a reliable alternative. There are some ways to know if your service provider's DNS servers are working properly. You can use nslookup, which is a program to query Internet domain name servers. $ nslookup google.com Server: 208.67.222.222 Address: ...
-
12.07.09Vim for programmers (I)Vim is suitable for a myriad of applications. However, it is in programming where it specially shines. Vim offers facilities that make the programming workflow especially easy and efficient. Some people use newer editors (or IDEs) just because they think Vim lacks some new cool features. That is not the case as I will show you in this issue. (I will use C source files in the examples, but most of the information in this post is applicable regardless of the language programming you use) Syntax highlighting Vim supports syntax highlighting for hundreds of file types. Having a look at /usr/share/vim/vim64/syntax (this is ...
-
12.03.09screen: working with the scrollback bufferscreen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. That is, multiple console applications can be run from the same terminal, each one with its own window. But we have already talked about the screen command before. In this post we are going to focus on the scrollback buffer feature. There is a scrollback history buffer for each virtual terminal, allowing to browse, or even to search, through the history of your windows. There is a copy-and-paste mechanism as well that allows moving text regions between windows. By default, the buffer has only ...
-
11.30.09Changing file extensionI usually change the annoying JPG extension to jpg (I do not like uppercase file names or extensions). For this I use a function I found in shell-fu: rename_ext() { local filename for filename in *."$1"; do mv "$filename" "${filename%.*}"."$2" done } I copied it into my .bashrc file, so that I use it as follows: $ rename_ext JPG jpg