Author
The Archives
-
04.07.10Setting a TimerSometimes I need a timer to focus on something and to alert me when to stop. Remember, we are real commandliners, so we do not want those fancy applications with a lot of features, we need a script ;-) so here it is: #!/bin/bash usage() { name=`basename $0` echo "Usage: $name hh:mm:ss" echo "Example: $name \"00:15:30\"" } if [ $# != 1 ] then usage exit fi IFS=: set -- $* secs=$(( ${1#0} * 3600 + ${2#0} * 60 + ${3#0} )) while [ $secs -gt 0 ] do sleep 1 & printf "\r%02d:%02d:%02d" ...
-
03.27.10Downloading a file with wget through a specific interfaceSometimes I need to download a file from a computer with multiple net interfaces, but only one is connected to the Internet. In these cases I use the bind-address option of the wget command, which binds the connection to the address specified in the local machine. $ wget --bind-address=192.168.213.141 \ > ftp://ftp.icm.edu.pl/vol/rzm1/linux-fedora-secondary/development/source/SRPMS/ppp-2.4.4-11.fc11.src.rpm --2010-03-27 12:25:56-- ftp://ftp.icm.edu.pl/vol/rzm1/linux-fedora-secondary/development/source/SRPM/ppp-2.4.4-11.fc11.src.rpm => `ppp-2.4.4-11.fc11.src.rpm.1' Resolving ftp.icm.edu.pl... 193.219.28.140 Connecting to ftp.icm.edu.pl|193.219.28.140|:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD /vol/rzm1/linux-fedora-secondary/development/source/SRPMS ... done. ==> SIZE ppp-2.4.4-11.fc11.src.rpm ... 724348 ==> ...
-
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 ...
-
02.23.10Force fsck at next boot# touch /forcefsck Creating an empty forcefsck file in the root directoy will force fsck to run at the next boot.
-
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) ...
-
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.05.09SysAdvent Calendar 2009SysAdvent is a project started by Jordan Sissel last year. It consists of sysadmin related posts. A post a day from 1st to 25th Dec. Jordan takes that idea from the Perl Advent Calendar. This year there are some bloggers helping Jordan on this task. I recommend subscribing to it, their posts are quite useful.
-
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