Old school Linux tips
Some times you just have to pull some tricks out of the vault. Â These tips can be timeless, classic, or just retro. But generally speaking they still apply to users today. I'm not talking about how to backup to a tape drive, or using punch cards to create a program. I'm talking about tangible tips and tricks that users can really use.Â Naturally, since these are mostly old school tips, they are going to be command line tips.
Why continue to break out more command line tips? Simple. Although it is very possible to get through the day (maybe even your entire Linux lifetime) without dropping to the command line, there are times when the command line is the best tool for the job. And knowing the command line in Linux is knowing power. So...let's put some power at our fingertips.
I had a friend once that had a Linux box with an uptime of over three years. THREE YEARS! The box finally came down because a NIC went bad and he had to shut it down to replace it. It broke his heart. Every day he would send me his uptime and we would both "oooh and ahhh" over it. How did he do this? The uptime command. This command does one thing and it does it well - it tells you how long your machine has been running. You issue this command like so:
When you issue the command you will see something like:
06:57:40 up 3 days, 22:15, Â 2 users, Â load average: 0.93, 0.66, 0.49
(My uptime is lame right now. We had a nasty thunderstorm and I had to shut down my machines).
Some people, like myself, add their uptime to their email signatures. You can see how to do this in my article "Add uptime and/or fortunes to your email signature".
less is more
One command line issue that might bug you is when you issue a command like dmesg and the output flashes by so quickly you can't read it. There is a very simple way around this. If you pipe the output of the dmesg command to the less command you can read the output "one page at a time". To do this you would issue the command like so:
dmesg | less
Or you use more to do the same thing (almost) like:
dmesg | more
The difference? With less you can scroll backwards. With more you can not.
Save that output
But what if you want to save your output of a command like dmesg so you look at it earlier or even email it to someone to look through? You can take multiple screenshots of each less page from dmesg...or...you can direct the output to a file. This is done like so:
dmesg > FILE_NAME
Where FILE_NAME is the name of the file that will hold the output. NOTE: If you will be sending that output to a windows user you might want to include the .txt extension for easy opening.
Sometimes those "old school" tips can really save your hide. Just because they are "old school" doesn't mean they don't have their uses. In fact, I make use of less and output re-direction every day. Once you start using them, you will find yourself using them more and more.Advertisement
Good to see these still are used by someone other than me :)