Setting the from address field when sending command line e-mail
To set the from address field when sending mail from the command line in linux use the following syntax:-
The trick is that after the e-mail you want to send it to you add -- (double dash) (space) (single dash) (NO space) f
Example:-
I've been trying to find out how to specify the from field in email for ages. Some people in forums even claimed that this cannot be done. (Hint: Never believe every word people write). Finally I found this post that outlined a quirk in the mail program that allows you to specify sendmail parameters in the command line. The man documentation in my RedHat Linux distribution doesn't even mention the possibility of specifying sendmail parameters.
How-to check for large directories (or files) in linux
The du command will give you a listing of the disk usage of each different file in the current directory. Without any parameters du will list the number of bytes in each directory. This is hardly very useful but if combined with the sort command the output will be sorted by from smallest to largest files.
Some useful parameters for du
-a: will list file size as well as directories
--max-depth=: allows you to specify the subdirectory level depth
-h: report the figures in KB, MB and GB instead of bytes (does not work well with sort)
Some useful parameters for sort
-n: sort based on numbers rather than characters (i.e. 10 comes after 9)
-r: reverse sort. display the largest number first.
Examples of using du
du | sort -rn | less (reverse sort the output displying one screen at a time)
du --max-depth=2 | sort -n (display and sort only down 2 directories)
du -a | sort -n (display all files not only directies)
du -ch --max-depth=1 /home (display the size of all the directories in the /home directory and display the total size used by /home)
Tip 29: Pausing Applications in *nix
In most *nix applications you can pause the application using Ctrl-Z. To resume the application use the fg command. Typing fg alone will resume the first job that was paused. If type fg [#jobnumber] you resume the job with the specified number. The job number is the sequence number, starting from 1, of the jobs that are paused in the order they were paused.
For example, start editing a text document with vi, then press Ctrl-Z. Now, you are sent back to the shell, as you would if you quit vi (or typed the :sh command), however vi is still running in the background. To get back to vi type fg.
Sources: Vim tips: Working with external commands
Linux and UNIX fg command help
Lonely George
The day has come when my cheerful office sharing mate, which also happens to be my better half, left our department in search for better luck. The change wasn't that drastic moving to a different department in the same company but it still feels strange sharing the office with only a bird.
As a meagre consolation today I played a bit with my Debian installation from where I'm also writing this post. I've learned a couple of things also:-
Debian Packaging 101:-
apt-get install [package-name] => Installs a package
apt-cache search [package-name] => Search for a package in the defined apt sources
dpkg -L [package-name] => List all the files that make up a package (like rpm -ql in Red Hat)
dpkg -l => List all packages
Others:-
ls -lhSR | grep "[0-9][G|M]" => lists all files sorted by size (-S), recurse through directories (R) keeping only those files in Megabytes of GB. I crafted this to check which files are taking most space in some directories.
cat >> [file] << "EOF" => Open the file for writing (append in this case) and you can enter multiple lines. End the input with EOF.
Deep thought from the Penguin Girl
I'm a bit late on catching up with the Linux User Show but in show 8 Kelly Penguin Girl expressed a thought worth of a computer guru.
Kelly ditch you job and get into computing full time, the industry needs more people like you. The guys at the Linux Link Tech Show also realised this. You're making a name for yourself.
While talking about Kelly Penguin Girl, I tried to search for the string Kelly Penguin Girl in Google and Kelly's real site (the one about art) turned up in the first page. The great thing is that there isn't anything mentioned about "Penguin Girl" in the site yet Google still managed to identify it.
Knoppix is mmmmmmmmm ....
Knoppix is as easy as ABC and as useful as a Swiss knife, it's just too good. The whole thing about it is that it's a live CD which means that you pop it in your CD-ROM, reboot and off you go with a 600Mb Linux installation that's got all the software you'd normally use on a personal home PC and more, with loads of eye candy and user friendliness. In the words of Kelly Penguin Girl, eye candy is good (I took of my sys admin hat here). Apart from being a desktop Linux tool it's got hundreds of other useful uses;
- you want to browse the web and loose any trace of the history now you can with Knoppix
- you haven't got any rights to do anything on your work PC because the windows machine is tightly secured and you've got no Administrator password - run Knoppix;
- you need to run a program on a machine and you don't want to install the program - run it from Knoppix;
- you want a mobile software repository so you can use any machine as your own familiar machine - customize Knoppix and run it;
- one of your web servers died and you need a quick backup fixer - run Knoppix to minimize down time ...
Start using this great tool and the ideas keep flowing and flowing. Knoppix Hacks from O'Reilly has another 100 hacks to get you started.
RHCE Result
Yesterday the RHCE exam results arrived and I just missed the RHCE passmark by a miserable 5.7 marks. I got 100% in the first session, 81.8% in the RCHT exam and 64.3% in the RCHE exam. I'm obviously a bit disappointed at not managing to get the RHCE certification especially because I got so close to the passmark. In reality I didn't think I'd do that well in the second part. Most probably I didn't pass because of the lack of motivation from my side because otherwise I could have made it.
The exam made me more conscious about the importance of security. Since I'm a developer not a systems administrator I usually tend to go towards the implementation of functionality rather than security. The more access to information people have the higher systems are at risk so it's better to close the holes before others find them. Saying this I must now learn how to use iptables.
Btw, if your interested in Linux (or want to start out using it) you should try Ubuntu. They are shipping their free CD's for free.
Word of the day: Ramify
Definition (by dictionary.com):
- To have complicating consequences or outgrowths: The problem merely ramified after the unsuccessful meeting.
- To send out branches or subordinate branchlike parts.
RHCE Exam
This last week has been damn busy studying for the RHCE Exam. I don't remember being so concentrated on a single goal because usually before an exam I get into all sorts of different activities and find anything interesting but this time I was 100% concentrated on a single aim. I didn't blog, didn't browse, didn't love my tiny devils (kittens) and did dozens of stupid mistakes because my mind was not on the tasks at hand. At least the people around me realized that I was under pressure and coped with my state of mind - thanks for understanding.
Overall the exam was not as difficult as I thought it would be, but this does not imply that it was easy in any way. I followed the course book RHCE Red Hat Certified Engineer Linux and basically the exam contained material covered in the book. The amount of work was astounding considering that the actual course was only 4 days long and my experience with Linux was rather limited. The first day I sat down in class everybody introduced himself and basically everyone was a seasoned Linux System Administrator with me having almost the least experience of the lot. This though turned in my favor because it made me work much harder to be able to cope and gain ground with the rest of the group. I think by the end of the 4 days I managed to do some huge improvements.
The exam consisted of 2 papers; a troubleshooting session and an installation session. In the troubleshooting section we had 5 compulsory problems that had to be completed within 1 hour and an additional 5 problems. The first 8 problems were really easy and in fact I completed them in less than 30 minutes but the last 2 problems boggled me down a bit and I spent some time working on them but I managed to complete them all successfully. The afternoon session required us to install a server machine and with local services and a network services. I went pretty well in the local installation but I found some problems in the second party mainly because of the lack of experience in certain subjects. Anyhow we'll wait and see what happens.
Linux Linux Everywhere
At the moment I'm having Linux for breakfast, lunch and dinner in a desperate attempt to learn anything about Linux in preparation for the RHCE course next week. The more I learn the more I realise how little I know, and how unlikely I'm going to pass this exam. At least though its fun learning, and I'm gradually uncovering the huge community of Linux Users which seems bigger and bigger every day. These are some interesting sites I came across these few days.
- FrozenTech
- Has got loads of Linux live CD's. Live CD's are Linux distributions that run only from a single CD without touching anything of your current OS. I've downloaded a Kill Bill edition of SLAX and Kanotix both of which were very easy to install and use.
-
- Distrowatch
- With all these distribution you need something to help you choose. Distrowatch is the answer.
- LUG Radio
- The site of the most popular Linux Radio show around. Worth downloading some podcasts there's much to learn from hear (including some swear words).
- The Linux User Show
- Home of the best podcast I've listened to till now. This was the first show but I'm eager to hear what Jon has to offer. Highly recommended
- linuxiso.org
- Download any Linux Distribution from here
- Really Linux
- For those who're still new to the Linux world this is a friendly introductory site to this new world.

Comments (0)