Linux.com

Community Blogs



War Thunder Free Steam MMO Now with Linux Client

War Thunder, a free, popular MMO based on World War II, has received a Linux client, so you can now install and play War Thunder for free on Steam.

 

Full article

 

12 Awesome Themes for Mint 17.1 Cinnamon

With Mint 17.1 Rebecca being days away from release, and Cinnamon 2.4 looking so good, here is an overview of some of the best looking themes which allow you to beautify your desktop.

 

Full article

 

Scripting made fun: Creating a melody of simplicity

Last time I uncovered a language that created a two-way communication tunnel with my Linux system. When you learn a two-way method of communication, the intentions of both communicators are understood. My Linux systems understand my intentions. It knows that my objective is to make my system very simple to operate in accordance to my standard of simplicity. This way I can understand more thoroughly how my system works. Once approved, more of the underlining functions of my system are revealed. What I started creating was a melody of simplicity.

Last time, I wrote a blog titled β€œscripting made fun”. The article was to inspire a new way of scripting that removed boredom and fear of learning programming. When you enjoy what you are doing, you do more of it and differently. I found my unique communication style.

My system must be psychic; a voice repeatedly recited, β€œtake a sentence of mundane commands and reduce them to one word”. I did this using variables. From variables now moving to actually writing scripts with multiple lines of code. For assistance, you can learn how scripts work by reading script files like β€œfstab” or β€œinit.d”. Take time to dissect them. When learning Linux, allow yourself time to take things apart.

I kept the scripts in my home folder, and modified the default search path. This time, they have been placed in one of the already declared default search folders. As I furthered my readings of The LPI Linux essentials study material, It was recommended to place compiled or custom made programs in the β€œ/usr/local/ directory”. I don't have to worry about my scripts being moved when my system upgrades.

When I placed the scripts in this directory, the owner changed from me to β€œroot”. Give me back what is rightfully mine. I am not running β€œsudo” before my OWN programs. Management is under revision.

The command β€œchown” changes the ownership of a program. 

#sudo chown <new profile name> <name of file or diretory> 

Your files, directories, or scripts will have your profile name as the owner. That means, no sudo (HA!) 

These are the scripts in prototype form.

  1. endsystem

  2. opendvd

  3. playdvd

  4. systemrestart

  5. update_debian

Most of them are of basic β€œcommand and argument” format, β€œdo this on/to this”. Simple? Perhaps. But something happened. I took it a step further. I am now using the if-then-else statements. Rather than just following orders, you follow orders based on logical conditions. Lets look at the β€œplaydvd” script as an example.

 

Playdvd

 

#!/bin/bash

#This script will run vlc on DVD drive mounted in the /media folder as cdrom0

#If not, it will run vlc on dvd device /dev/sr0

if

[ -d /media/cdrom0 ]

then

vlc /media/cdrom0;

else

vlc /dev/sr0;

fi

#end

 

The if-then-else programming statements simply mean, if a condition is satisfied, execute a command on that condition, otherwise run the alternative if the condition is not.

 

β€œif

[ -d /media/cdrom0 ]

then

vlc /media/cdrom0;”

 

This statement means β€œif the directory '/media/cdrom0' exists, then run 'vlc' on that directory. The β€œ-d” switch represents a directory as I have come to understand. In fact, if you were to run, β€œ#ls -al” on the β€œ/usr” directory, you would see that same β€œd” switch in the output attributes of a directory.

 

ls -al

total 132

drwxr-xr-x 10 root root 4096 Jun 23 10:09 .

drwxr-xr-x 22 root root 4096 Aug 31 22:51 ..

drwxr-xr-x 2 root root 65536 Nov 8 08:52 bin

drwxr-xr-x 2 root root 4096 Jun 23 10:22 games

drwxr-xr-x 18 root root 4096 Jun 23 10:24 include

drwxr-xr-x 163 root root 20480 Nov 8 08:52 lib

drwxr-xr-x 10 root root 4096 Jun 23 10:09 local

drwxr-xr-x 2 root root 12288 Oct 27 14:47 sbin

drwxr-xr-x 277 root root 12288 Nov 8 08:52 share

drwxr-xr-x 6 root root 4096 Oct 21 14:23 src

 

If you look at the line ending with β€œgames”, you will notice that it begins with a β€œd”. This β€œd” label means β€œdirectory”. Going back to the [ -d /media/cdrom0 ] code line, what we are saying, if you find the directory β€œ-d” of β€œ/media/cdrom0”, then run β€œvlc /media/cdrom0”.

The β€œthen” statement tells the script what to do after the first condition has been met.

β€œthen

vlc /media/cdrom0”

The program looks for a directory named, β€œ/media/cdrom0”. My dvd drive mounts itself in this directory whenever I insert a DVD or audio CD.

If for some reason, the directory β€œ/media/cdrom0” does not exist, then the script must an. Alternative. β€œ/dev/sr0” is the actual DVD/CD-ROM device. This line tells the script to run vlc on this directory if the first condition is not met.

β€œelse

vlc /dev/sr0;”

fi

#end

You must also end a conditional script with an β€œfi” which means β€œend if”, otherwise the program won't know when to quite.

For every script created, it must be made executable, meaning it has to look like something the shell has to run not read. The command β€œchmod” does just that. The β€œchmod” command tells the shell what type of file permissions to give a user or group. There are three types, execute, read and write. Well, I wanted to give myself execute permissions on this script. The shell then allows me to run the script as a program.

#sudo chmod u+x playdvd = β€œu” means β€œthe user, β€œx” means execute. The β€œ+” means add the permission.

This command tells the shell to make the β€œplaydvd” file an execution program. When the shell reads the commands β€œplaydvd” it will execute all the lines in the file and perform the action.

Me and my mouse need consulting. I am spending way too much time on the terminal than on the point-and-click device. Can't help it. All I have to do is press a three-key combination, terminal opens, and I type my desired program. I even stopped physically opening up the dvd drive. I type a command to do that, and a command to close it.

Looking at it from another perspective. I am learning how to operate my system with or without the mouse.

 

Dooscape 1.2 Released – A Web Browser with a Simple and Neat Interface

Dooscape is a web browser written in Qt which features a simple and clean interface and is based on the QtWebKit engine. Dooscape has some neat features and takes a different approach compared to traditional web browsers.

 

Full article

 

15 Apps Which Ship in Mint 17.1 Cinnamon [Overview with Screenshots]

Two days ago I had a look at the release candidate of the upcoming Mint 17.1 Cinnamon, which is set to arrive in late November. Today I will take a quick look at the main applications that come bundled by default in the Mint 17.1 Rebecca installation disc, with a short overview and screenshots for each of them.

 

Full article

 

11 Linux Games Up to 86% Discount During This Steam Weeklong Deal

This Monday Steam has kicked off a new Weeklong Deal which will last until November 24, during which 11 titles for Linux are available at special promotional prices.

 

Full article

 

10 Great Plasma Widgets for KDE with Screenshots

Since the introduction of Plasma widgets in KDE4, the whole desktop took a new direction, starting to become a more interactive way to communicate with the user, to say nothing about the fact that a desktop with widgets will look more beautiful than a plain, icon-only desktop.

 

Full article

 

Rassam-paint 1.1 Is a Simple Painting Program [How to Install in Ubuntu and Mint]

Rassam-paint is a free painting application using GTK with support for formats that include PNG, JPG, BMP, CUR, ICO, TIFF, PGM, PBM and basic image editing tools such as shapes or text.

 

Full article

 

UbuTricks 14.11.17 Released with Support for 6 New Apps, 20 Updated Apps

This new version adds support for six new applications and 20 apps with updated versions. The new applications are Exaile, Yarock, GNOME Commander (Trusty), SimpleAudioPlayer, Kid3 and Fotoxx (DEB).

 

Full article

 

Bash: 10 Examples of Parameter Expansion

Parameter expansion is a powerful feature of Bash which will allow you to work on strings with great ease and just a little typing. Here are 10 simple examples on how to use just a bit of the power of parameter expansion to quickly modify and work on strings.

 

Full article

 

Mint 17.1 with Cinnamon 2.4 Looks Beautiful [Overview, Screenshots, What's New]

The next Linux Mint Cinnamon edition is knocking on the door and a Release Candidate was put out yesterday. This release will bear the version number 17.1, and it is codenamed β€œRebecca”. In this overview I will look at the release candidate for Mint 17.1, focusing on the main new features in Cinnamon, which ships the latest bleeding edge version in Rebecca, and will accompany it with screenshots for the desktop and the new changes that went into it.

 

Full article

 
Page 2 of 137

Upcoming Linux Foundation Courses

  1. LFD312 Developing Applications For Linux
    05 Jan » 09 Jan - Virtual
    Details
  2. LFS220 Linux System Administration
    05 Jan » 08 Jan - Virtual
    Details
  3. LFD331 Developing Linux Device Drivers
    12 Jan » 16 Jan - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board