Learning never exhausts the mind
Home >  Technology > Linux > Linux Tips for Beginners

Published 20th July 2010 by

This post is going to contain a list of tips and tricks used to the beginner Linux user. It covers lots of tasks which are second nature to Linux veterans, but hard to grasp for new users.
Introduction to Linux Series
  1. Installing Linux Step by Step
  2. Linux Tips for Beginners
  3. Beginners guide to Reading and Finding Files in Linux
  4. Using Grep to Search for Text in Linux
  5. Understanding Linux File Permissions
  6. How to Archive, Compress and Extract files in Linux
  7. Linux Piping and Redirection
  8. Linux Hardlinks and Softlinks
  9. How to Create and Use Bash Scripts
  10. Basic Data Recovery in Linux
  11. Apache Administration on Linux
  12. MySql Administration on Linux
  13. Switching from Windows to Linux

This is my collection of Linux tips beginners, which I am adding to as I learn more about using Linux. This page serves as my notepad and reminders for commands and is published online in the hopes it helps others starting out with Linux.

Creating a Symbolic Link

A symbolic link is a pointer to another file or directory, like a shortcut in Windows. Unlike shortcuts however, the symbolic link can be used just like the original file or directory. Symbolic links are very good if you need to have multiple copies of the same file in different locations.

You can use the command below to create a symbolic link to a file.

ln -s {/path/to/file-name} {link-name}

Example below will create a link to /home/timtrott/public_html and create a "false" folder called /www. When you change directory to /www, you will really be in /home/timtrott/public_html.

ln -s /home/timtrott/public_html/www /www

Creating Shell Scripts

A shell script is a Linux version of a MS-DOS batch file, only a bit more flexible and powerful. They can be created using any text editor. I'm going to create a sample shell script that will mount a network drive.

All shell scripts start with #!/bin/bash. The following lines are executed line by line.

sudo mount -t cifs // /usr/www

The script must have it's permissions changed to allow execute.

chmod +x scriptname

I like to keep my scripts in my home folder /home/tim/ That way I can call them using ~/scriptname.

See the article below for a more in-depth look at bash scripts.

Creating Multiple IP Addresses

I will be working on multiple websites at a time and as such, I need to allocate an IP address to each one. I can do this by using IP alias. This is done easily enough by adding some entries to /etc/network/interfaces.

sudo pico /etc/network/interfaces

And add the following block of code. Repeat as required.

auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card

Once complete you need to restart the network interfaces.

sudo /etc/init.d/networking restart

Host Tables

A host table is a simple text file that associates IP addresses with host names, one line per IP address. It isn't normally necessary to change this, however I have a situation in which I need to redirect a host name for my database server to my local host.

sudo pico /etc/hosts

The format for the file is ip_address hostname alias. My hosts file looks like this:       localhost     mydomain.com   ubuntu       my.databaseserver1.com       my.databaseserver2.com

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Modifications to this file normally take effect immediately, except in cases where the file is cached by applications.

Enable the Power Button

By default on my installations, the power button does not function, except to immediately power off. Instead I'd rather send a power down message to the OS so that my server can gracefully close and power off.

First we need to install the Advanced Configuration and Power Interface (ACPI) package

sudo apt-get install acpid

And edit the config file if required

sudo pico /etc/acpi/powerbtn.sh

When the power button is pressed, the system no goes down with a message stating the power button has been pressed.

/sbin/shutdown -h now "Power button pressed"

Linux Cheat Sheets

Here are a few very handy Cheat sheets for Linux which will introduce you to the basic commands.

Above all, the best way to learn Linux is to use it. Use it a lot.

Whenever you run into a problem with a command, do some online searching. Almost any time you run into a wall, you're going to find that a lot of people have run into it before you and a number of them will have written something about how they got over it.

Tutorial Series

This post is part of the series Introduction to Linux. Use the links below to advance to the next tutorial in the couse, or go back and see the previous in the tutorial series.

Leave a Reply

Fields marked with * are mandatory.

We respect your privacy, and will not make your email public. Hashed email address may be checked against Gravatar service to retrieve avatars. This site uses Akismet to reduce spam. Learn how your comment data is processed.