Category

shell

  • 07.30.10
    Vim. Saving keystrokes: abbreviations shell | n0str0m0 | (0)
    Welcome to a new issue of this short Vim tutorial! As we saw in previous posts, Vim is the perfect tool if you want to save time in your daily work. It helps you in the write-compile-debug cycle, it indents and autoindents code, it is extremely powerful for searching, replacing and many other frequent tasks. In this post I will introduce an interesting feature meant to make you type less: abbreviations. Abbreviations are, as their name indicates, a way to create an association between a short set of characters and a piece of text (or a command). Abbreviations can be used in insert, replace ...
  • 05.20.10
    echo -n woes scripts, shell | pfortuny | (2)
    It took me quite a while to realize that the following line does not do what you think it does: $ echo '$1$CSmo96nX$G0PL/Cs/of5qDN2vMnyHp0' | openssl base64 | tr -d '\n' You should always use the -n option if you want to make sure there is no spurious trailing newline: $ echo -n '$1$CSmo96nX$G0PL/Cs/of5qDN2vMnyHp0' | openssl base64 | tr -d '\n' (By the way, the encrypted message says just 'patata0' and it is not my password). Or... is it? Tested on two Linux systems (Fedora & Ubuntu) and one Snow Leopard.
  • 04.27.10
    Setting variables in emacs at file header shell | pfortuny | (0)
    When editing LaTeX files, I usually call the master file of a project 00father.ltx for historical reasons. Moreover, the following line is part of my .emacs: (setq-default TeX-master "00father.ltx") because most of the time I am editing multifile projects. However, from time to time I need to write a single-file document and in this case, naming it 00father.ltx is not that useful, and I do not want to have to set the master-file variable each time I load the file. There is an easy way to get this done. Just include a line at the top of the file -as a comment in the ...
  • 04.22.10
    Reverting to a previous version with svn (rollback) shell | pfortuny | (1)
    To rollback (that is, revert to a previous version) some files/dirs... using subversion, you need as Aral Balkan explains to Merge the previous version Commit Like this (assumming you want to roll back from version 61 to 58): pera $ svn merge r61:58 https://my.project.at.sourceforge/svnroot/project/dir1/src/ [... output ...] pera $ svn ci -m "Reverted to version 58" which is strange but works. Forget about the revert command, it has a different functionality. You may want to run pera $ svn merge --dry-run r61:58 ........ to check the changes which will take place before messing everything up.
  • 04.15.10
    IPCS shell | n0str0m0 | (0)
    ipcs shows the status of SYSV inter process communication facilities. $ ipcs -s ------ Semaphore Arrays -------- key semid owner perms nsems 0xdd3adabd 0 fernape 600 1 I had forgotten about this command but I remembered it when we ran out of semaphores in our Linux system two days ago. Other ...
  • 03.19.10
    Shell scripting for Nautilus shell | n0str0m0 | (0)
    It 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.10
    Running e2fsck on a mounted filesystem shell | rafacas | (0)
    I 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.10
    Vim for programmers (III) shell | n0str0m0 | (0)
    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.10
    RPM: Listing dependencies of an rpm file shell | rafacas | (0)
    rpm 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.10
    Vim for programmers (II) shell | n0str0m0 | (1)
    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 ...