Ubuntu tips & tricks

Ubuntu is a Debian-based distribution. A number of Ubuntu flavors are available in addition to the gnome-based default. These include: kubuntu (kde-based), xubuntu (XFCE4-based), edubuntu (aimed at classroom use), and a number of others.

= Installing software = To install software, use the GUI Synaptic, Ubuntu Software Center or the cli apt. Example: apt install firefox

= Fun with Eject Command =

Lock the hardware eject button of the cdrom $ eject -i 1

This command will lock the hardware eject button of your cdrom drive. Some uses are:


 * 1) If you have a toddler that has discovered the cdrom button
 * 2) If you are carrying a laptop in a bag or case and don’t want it to eject if the button is inadvertently pressed.

To unlock the button use: $ eject -i 0

For more info see the eject's man page.

= Forget the 'cd' command ! = Using the autocd setting you can change into any directory without the use of cd command. To set it, type $ shopt -s autocd Here is how changing directories works now: thasu@tha-admin-da ~ $ /var/log/cups/

To make the above option a permanent one, edit the .bashrc file and add this line "shopt -s autocd" into it.

Enjoy

= lshw-The Hardware Lister =

lshw (Hardware Lister) is a small tool to provide detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc.

In Ubuntu 10.10, It works without installing extra packages.

$ sudo lshw

It takes it a little while to gather the data it is going to display, so avoid cancelling the command prematurely because you think it is hung. If you use Yum (Red Hat, Fedora, CentOS, etc), you can install lshw by running the following command in a terminal:

$ yum install lshw

$ lshw

Shorter Output:

If you just want to find the chipset version of a piece of hardware quickly, you can run the following to provide a very short output that should give you what you need:

$ sudo lshw -short

= Linux Terminal Shortcuts =

Get lightning fast and clever at the command line.

You can use keyboard shortcuts and other command line tricks to make entering commands easier and faster. You might already know about the ‘tab’ key which completes partial commands and even file and directory names.

Here are some other keyboard shortcuts you can use within terminal:

Ctrl-a   Move to the start of the line. Ctrl-e   Move to the end of the line. Alt-] x  Moves the cursor forward to the next occurrence of x.  Alt-Ctrl-] x     Moves the cursor backwards to the previous occurrence of x.  Ctrl-u    Delete from the cursor to the beginning of the line. Ctrl-k   Delete from the cursor to the end of the line. Ctrl-y   Pastes text from the clipboard. Ctrl-Shift-v   Pastes text from the clipboard. Ctrl-l   Clear the screen leaving the current line at the top of the screen. Ctrl-x Ctrl-u   Undo the last changes. Ctrl-_ Alt-r    Undo all changes to the line. Alt-     Ctrl-eExpand command line. Ctrl-r   Incremental reverse search of history. Alt-p   Non-incremental reverse search of history. !!        Execute last command in history !abc    Execute last command in history beginning with abc !n       Execute nth command in history ^abc^xyz        Replace first occurrence of abc with xyz in last command and execute it  Ctrl-t which swaps the last 2 characters before the cursor. Alt-d delete a word forward from cursor Ctrl-w  delete a word backword from cursor

= Difference between “cal” and “calendar” command =

Many of us know about the “cal” command. It displays the current month's calendar.

But ‘calendar’ displays the history of events for today and tomorrow.

Example for “cal” :

$ cal January 2011 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Example for “calendar ” :

$ calendar Jan 13    Horatio Alger born, 1834 Jan 13    Sophie Tucker born, 1884 Jan 13    Wilhelm Wien born, 1864, Nobel prize for blackbody radiation laws Jan 13    National Liberation Day in Togo . . . Jan 14 Albert Schweitzer born, 1875 Jan 14 Julian Calendar New Year’s Day ..