Neko

Tag Archives: shell

COTD: fuser - identify processes using files or sockets

Today’s Command Of The Day is the “fuser” command.
Have you ever wanted to unmounted an NFS share, or local filesystem and couldn’t because it was in use?  The same applies to CD/DVD’s, PenDrives, etc.  Generally, you receive a message similar to the following:
# umount /dev/sdc1
umount: /media/disk: device is busy.
The fuser has many options.  The ones [...]

Renaming files with spaces to dashes

I was just playing with some old disk images of SCO Xenix to try to get it to boot in an emulator.  It was quite frustrating that all of the disk images had spaces in the file names.  A few files would have been ok, but I have multiple version of multiple releases for multiple [...]

COTD: tee - read from standard input and write to standard output and file

Today’s COTD is the “tee” command.
Have you ever wanted to redirect the output of a script or program to a file, but be able to view it right away? Without putting the file in the background, and then tailing the file?
The tee command allows you to do just that.
Here is how we could use [...]

COTD: touch - change file timestamps

Todays COTD (Command Of The Day) is the “touch” command.
The touch command is used to update the access and modification times of files.  However, I see it more commonly used to create a new file.  There are many times when you want to create a new file, but not actually put anything in it.  For [...]

Bash Shell Version 4.0 released

The latest version of the Bash shell was recently released.  Version 4.0.   Bash is pretty much the default shell is most Linux distributions, and seems to be preferred by most Sys-Amins on other flavors of UNIX as well.
I just downloaded and compiled the source on my Ubuntu 8.10 workstation as I didn’t see it in [...]

Using command-line Perl to search and replace

One of things I always seem to be doing is searching for strings in files and changing them.   I’ve gotten used to using Sed and VI for this.  But perl also makes it easy to do via the command line.
Consider the following text file:
$ cat resolv.conf
search theunixzone.com
nameserver 10.1.1.1
nameserver 10.1.1.2
nameserver 10.1.1.3
By doing a command similar to [...]