Linux

How to Use Awk to Remove the First Line of a File

Awk is a versatile pattern scanning application, installed by default on most Linux distributions. If you have Ubuntu, Debian, or openSUSE, it's already installed. You can use Awk to easily remove the first line or row of a text file. To do so, just run the following one-liner command. Make sure to specify the source file, and the file you want the processed data to go to:

awk '{if(NR>1)print}' source_file.txt > processed_file.txt

 

Teach Your Toddler How to Use a Mouse and Computer on Ubuntu Linux with Open Source Games

These games are designed for toddlers (age 1 - 3), but if the child has no experience with a computer/mouse, these learning games are great for children above this age. All the games can go in full-screen mode and all of them have sounds. They only require the mouse to play the games, however, some of them have optional keyboard commands also.

To install, run the following command for Ubuntu:

sudo apt-get install pysycache gamine gcompris

 

PySyCache - Several of the games included with PySyCache are targeted for slightly older kids (ages 4 - 7), but we are focusing on the 'hand' game (from the main menu, click on the hand on the left side). The object of the game is to move the hand over the overlying cover image and wipe it off to reveal the image behind it. The cover image is removed in small blocks that are about the size of the hand. Once completely cleared, a colorful image of a queen pops up for a few seconds, then a new image replaces the last one.

Teach Your Toddler How to Use a Mouse and Computer on Linux with Open Source Games 1

Ubuntu - How to Create Software RAID 1 in 12.04 Ubuntu Linux - Tutorial

There are several guides for creating software RAID's on Ubuntu on the internet. Most of them we've found to be not very comprehensive or difficult to understand and follow. This is why we've created this tutorial as easy to use as we could. Pictures on every step and detailed instructions. In fact, it may be a little to comprehensive, but that's ok. At least you'll be confident you created the RAID correctly. If you do have any questions or run into a problem, feel free to leave a comment below and we'll try to help.

Linux software RAIDs work differently than normal hardware RAID's. They are partition based, instead of disk based. This means that you must create matching partitions on all disks before creating the RAID. Hardware RAIDs have you add the disks to the RAID and then create the partition.

This tutorial was created while installing Ubuntu 12.04 64 bit Server Edition. It's intended to be the first in a series of Linux software RAID tutorials. Future tutorials will cover topics such as how to recover from a failed disk.

This server has two 16GB disks installed. We will be creating 2 partitions: a 2GB swap partition and a 14GB root partition. After we are done, the server will stay in operation if one of the two disks fails. Most of the pictures in this tutorial are self-explanatory. The option you need to choose will be highlighted. We will provide comments on the picture if there is any special considerations.

Linux - Watch Movies in ASCII Text Mode With mplayer

Other than showing off a cool trick, I can't think of a legitimate reason to do this. But for those interested, you'll need mplayer installed to play a video in ASCII text mode. If you don't already have it installed, run the following command to install it:

Ubuntu: sudo apt-get install mplayer

openSUSE (If you haven't added the packman repositories, you'll have to do that first here):

sudo zypper install mplayer

If you are looking for a video to test this out on, check out the trailer for Big Buck Bunny. You can download it by running the following command:

wget http://mirror.cessen.com/blender.org/peach/trailer/trailer_400p.ogg

To play the video in ASCII Text mode, run the following command:

mplayer -vo caca trailer_400p.ogg

Linux - Watch Movies in ASCII Text Mode With mplayer 1

Linux - Watch Movies in ASCII Text Mode With mplayer 2

Linux - History Command Tutorial - How to Run Previous Commands and Clear History

The history command is very useful for people who use the command line. If you haven't used it before, now is a great time to make it a habit, as it can save you time.

The history command by itself will provide a numbered list of previously executed commands:

history - tutorial run previous commands 1

To execute one of the previously ran commands, use the exclamation mark followed by the number of the command (no spaces):

!3

history - tutorial run previous commands 2

To clear the history, run the following command:

history -c

history - tutorial run previous commands 3

To simply run the last ran command again, run the following command:

!!

Hope this helps some of you become more proficient in the command line!

Linux - Change to Home Directory From the Command Line Terminal

A lot of people don't know you can do this, or don't know how. Obviously to change directories you use the cd command. To change to your home directory, run the following command:

cd ~

Change_to_home_directory_linux_terminal

You can also use this method to reference files or folders in your home folder. For example:

cat ~/Documents/send-connector.txt

is the same thing as this:

cat /home/user/Documents/send-connector.txt

Ubuntu Linux - How to Find IP Address from Terminal and GUI

Finding your local LAN ip address in Ubuntu Linux is very easy. There are 2 ways to find it, from the command line or from the GUI.

Command Line:

Just open the terminal and run this command: ifconfig

Ubuntu Linux - Find IP Address 1

 

GUI:

Right click on the Network Manger icon in the top right corner and click on "Connection Information". You will then see a window displaying your ip address and other useful network information:

Ubuntu Linux - Find IP Address 2

Ubuntu Linux - Find IP Address 3

Ubuntu Linux - How to Restart or Reboot System from Command Line Terminal

 

Restarting or rebooting an Ubuntu Linux computer or server from the command line is very simple. Just run the following command:
 
sudo reboot
 

Ubuntu Linux - How to Shutdown System from Command Line Terminal

Shutting down an Ubuntu Linux computer or server from the command line is very simple. Just run the following command:

sudo shutdown -P 0

-P means 'Power Off' and 0 is the number of seconds to wait before powering off.

How to Get and Download all File Type Links from a Web Page - Linux

This tutorial explains how to take a URL and get all of the links for a specific file type (pdf, jpg, mp3, wav, whatever extension you want) exported into a list and download all of the links in Linux. In my example, I have a web page with over 20 links to pdf files. Instead of downloading them individually and manually, this script will allow me to download all of them at one time, and give me a list of each link.

You need to have lynx and wget installed before running this script. To install, run the following command:

Ubuntu: sudo apt-get install lynx-cur wget

openSUSE: sudo zypper install lynx wget

Save the following text as link-dl.sh and execute it by running "sh link-dl.sh":

 

#! /bin/bash
lynx --dump http://www.appassure.com/resources/technical-documentation/ | awk '/http/{print $2}' | grep pdf > /tmp/file.txt
for i in $( cat /tmp/file.txt ); do wget $i; done

Pages

Subscribe to Linux