BASH Prompt Fun

The Bourne Again Shell aka BASH has been around for a while. For those of us that also have been around for a while…this shell possibly could be the one you choose to use for your Linux distro. I first started using BASH when I was in college. We had Solaris 2.0 Servers that allowed me to mess around quite a bit back then.

But most new users fear the shell (or as windows likes to call it, command line) and venture there as little as possible. The prompt that greets most users that open a Linux shell is static and unyielding; yet, there are small adjustments that can make your Linux shell bend to the will of your force. Today, I’ll be going over some simple and fun ways to alter your .bashrc file, which is where your BASH “profile” is kept and read each time you login. Changes to this file can make your Linux shell a little bit friendly and less frightning.

Most shell’s look similar to this by default:

[devnet@lostgate root]$

This doesn’t do much for you other than tell you who you are, what your hostname is, and what directory you are in. If you are like me, you want some useful information to be there so that what is above, becomes what is below:

(devnet@lostgate:/var/www/html)#

Why is this so different? For starters, after seeing how to add color to your prompt you’ll be able to add your own color scheme to things. You’ll also be able to check out various ways to display information you want such as dates, times, whether you have mail, and your directory path you are in. Do you need l33t programming skills to accomplish this? Not at all! If you’re ready, let’s give this thing a try…

Continue reading “BASH Prompt Fun”

Making sendmail a better place

Recently, I’ve had a rash of both [SPAM] and hacking attempts at the site. With this being the case, my intrusion detection system has been working overtime. Something I forgot to do though was to forward all system mail to my main email and user account. So I had to read 5 different email accounts in order to get ‘the whole picture’ To combat this, a very nice little trick with sendmail/procmail can come into play and allow forwarding of all email to the correct box. Very handy…especially if you have rootkit detection software installed such as rootkithunter which is a handy program to alert you to hacker attempts. So this entry will be dedicated to some handy sendmail tips. Most of these tips will apply at a server level…but some can be adapted to desktop. To see the full list of tips, hop into the forum and check them out. Registration isn’t required but would be nice 🙂 (check out the navigation pane at the top of this blog for registration/login links). If you have any of your own tips, go ahead and post them in the forum while you’re there!

Sendmail tips and tricks

Alternative Screenshot Methods

Are you trying to take screenshots in Linux but don’t want to use KSnapshot or the built in Gnome Screenshot Utility? There are quite a few ways you can take screenshots in Linux. The thing is, most of them are unknown. It’s almost like the ability to take a screenshot is the best kept secret in Linux. So if taking screenshots is something you need to do on the fly or from a shell, or in a GUI that doesn’t have the utilities you need…read on.

XWD & XV

For X Window desktops such as GNOME and KDE, the command xwd -out filename.xwd lets you click a window to make an XWD image of it. Adding the -frame option will capture the entire window manager as opposed to just the open application. The popular utility xv also does screen captures so check that out as well. Use xwd and xv in the following ways:

%> xwd -root -out myimage.xwd

%> xv -grabdelay 2 myimage.jpg

IMAGEMAGICK

If you have imagemagick installed, you can use it to capture your screen as well. This is done by executing a simple command via shell:

%> import -window root wholescreen.jpg
(to grab the entire screen) or:

%> import window.jpeg

(and then click a window you want captured)

If you’re not sure whether you have ImageMagick installed, type any of the above commands just to see if they respond, or type in “man import” for help/instructions on usage.

SCREENSHOT ‘MOVIE’

There is also a really great tutorial on how to make a bash script take a ‘screenshot movie’; that is, multi-screenshots of every single window you open up.

THE GIMP

The GIMP can also be used to grab screenshots. Go to File >> Acquire >> Screenshot

FBGRAB

Another really great utility is fbgrab which can be used to capture the Linux framebuffer and convert it to a PNG image. This is handy for shell screenshots. This package is in the testing branch of Debian.

SCROT

This little utility allows you to do lots of things you wouldn’t even think of doing with screenshots such as autogenerating filenames and other things like taking screenshots of multiple displays and gluing them together. Find out how to use scrot here.

Conclusion

Screenshots don’t have to be a hassle. The use of many different utilities can simplify and streamline the process. Now you can capture various screens and show them off to all your friends…or capture various screens and hide them from your friends so they don’t know what a big Linux geek you are 😉

Do you have another method for screenshots? Visit the forum and post your method so that others can benefit. Not a member? Register here.

Extend Laptop Battery Life

Found a great tip when doing some reading…

When running linux on a laptop, it’s a good idea to mount hard drive partitions with the -noatime option. This prevents extra writes to the hard drive every time a file is read. Add the noatime option to the entry in /etc/fstab.

Example (from /etc/fstab)
LABEL=/ / ext3 defaults,noatime 1 1

By default, access information on a file is updated every time that file is accessed, including just being read. It’s very rare that you’ll need this feature, and disabling it can result in a lot less disk-writing, which translates into an increase in performance and battery life.

Some Nice Apps to Use

Having used Linux for quite some time, I run across some really cool apps. So, I’ve decided to share a few of them with readers of LinuxBlog. Having only been a GUI kid in Linux for about 2 years now, I’ve only recently begun to find GUI tools.? Since this blog is sort-of geared toward desktop distros of Linux, we’ll concentrate on applications that will work there.

So without further pointless banter, I will give you the apps I find are little known and very useful:

Cantus

Cantus is an easy to use tool for tagging and renaming MP3 and OGG/Vorbis files. It has many features including mass tagging and renaming of MP3s, the ability to generate a tag out of the filename, filter definitions for renaming, recursive actions, CDDB (Freedb) lookup (no CD needed), copy between ID3V1 and ID3V2 tags, and a lot more. Screenshot.

I use Cantus for all my tagging needs. I like the fact that it provides a clean and simple layout for everything and it is self explanatory so I didn’t need to read a manual four inches thick to get going in it. Project Page. Quick, fast, and simple. I wish all apps were like this.

Prozilla

Prozilla is a download accelerator for Linux. It makes multiple server connections to download a file, and also supports FTP searching for faster mirrors. Screenshot.

I saw about a 200% increase in my speed when using this. The great part about it is that it offers http and ftp redirecting, resume, bandwidth maximization (the file is downloaded at the maximum allowed speed), and automatic mirror selection of fastest mirror available. What a kick arse tool! Sourceforge Project Page.

* Please note that I use the console based tool for my needs. There is a GUI based tool available here.

The Rox Desktop

ROX is a fast, user friendly desktop which makes extensive use of drag-and-drop. The interface revolves around the file manager, or filer, following the traditional Unix view that `everything is a file’ rather than trying to hide the filesystem beneath start menus, wizards, or druids. The aim is to make a system that is well designed and clearly presented. The ROX style favours using several small programs together instead of creating all-in-one mega-applications. Screenshot1. Screenshot2. Screenshot3.

This desktop kicks arse because it allows directory based installs. In other words, you copy the entire directory of whatever it is you want to install and you?can run it immediately. Removing is as easy as deleting the directory. It also has?a feature called drag-and-drop saving that saves time and effort. It is exactly what it sounds like…you drag a file, drop it, and it is saved. For example, if you were working on an office doc that you needed to alter in 4 different office programs (Hence, 4 different directories under this?desktop) you would be able to open up the doc in each program, edit it, drag it and drop it into a central window where you want the doc located, and it will update each time on the fly to the most recent copy. Quick, fast, and efficient.

This also provides a nice feature called ZeroInstall. ZeroInstall allows you to run programs through the authors website by utilizing caching. Now you’d think that this would slow you down…well, if you have dialup it probably will…but with a cable modem, it runs as smooth as if I had the app on my own computer. Imagine operating your own computer without any programs installed on it! You’d have the saved projects you started but no vulnerabilities of the programs (if there are any). It boggles the mind. I really dig this desktop…KDE and Gnome should take into consideration what this desktop can do. Sourceforge Project Page.

Continue reading “Some Nice Apps to Use”

Daniweb.com, free help, free community

TKS has contributed to the DaniWeb community

I’ve been a member of Daniweb.com for about a year now and have seen it grow leaps and bounds in member numbers and content. I’m proud to be a part of what I consider the largest still ‘for free’ support site on the web today.  Daniweb.com isn’t just for windows…it has code snippets for php, C++, VB, webhosting tips, tutorials for linux, soooo much.  This is one of the best places you can possibly go to find help for anything…hardware, software, programming…the whole 9 yards.  If you’re in a bind with something, go on by and check out Daniweb.com.  You won’t be sorry.  Make sure you pass me a PM along too and say hello.