Looking for a SHOUTCast Host ? look no further!

Check out http://lmas-networks.com you seriously cant beat what they offer for only £1.00 p/month tons of features in the centova cast control panel and if you currently have shoutcast services hosted elsewhere just drop them an email they will give you a price match deal and give you a month free 😮 !!

Shoutcast hosting

They also allow you to use your own amazon affiliate ID (free to get) so you can make some money if anyone buys a track they hear on your stream!

Try them or ask for a free trial you wont be dissapointed.

Advertisements

Using the /proc Filesystem to Examine Your Linux Inner Working

Quick – answer me this: How much swap space is in use on your system right now? How big is the cache on your CPU? What kernel modules are currently loaded? How many total drives and partitions are you running? If you’re running Linux, all these questions (and a whole lot more) can be answered one easy way: take a look in /proc. It’s a goldmine of system information, just waiting to be retrieved by users, administrators, and scripts. In this guide we’ll take a trip through /proc to see just what valuable system information you’ve been missing out on.

About /proc

Probably the most important thing to understand about /proc is that it’s not a normal directory with normal files. It’s more like a viewscreen into the system internals. Files in this directory are not read and saved to the hard drive like your average document or MP3, they’re generated by the Linux kernel on the fly. Accessing the file /proc/meminfo will likely give you different results each time, because memory usage is nearly always fluctuating.

By putting this kind of system information into a virtual filesystem like proc, the developers adhere to the UNIX philosophy “everything is a file”. They do this so that it can be easily read by any person or software as easily as a normal text file, no special libraries or languages necessary. For us, this means that up-to-date system information is always easily available.

Note: The files mentioned here should all open cleanly in any text editor of your choice. The examples here are showing the contents using the standard cat command from within a terminal.

/proc/cpuinfo

If you’ve spent any time at all in proc, there’s a good chance you’re familiar with this file. Displaying the contents of cpuinfo will give you a detailed picture of exactly what CPU you have and what features it supports.

proc-cpuinfo

/proc/meminfo

The other most well known file in proc, meminfo is an extremely handy file to keep around. It shows you information about memory and swap usage, and is one way that scripts and programs can find out what’s available.

proc-meminfo

/proc/cmdline

This file shows the options that were used to start the kernel. This can be handy when troubleshooting boot problems, or if you need to verify exactly which kernel file was used for boot.

proc-cmdline

/proc/filesystems

A lesser known but still useful file is filesystems. From here you can read the (somewhat extensive) list of filesystems currently supported by your kernel. Not all of these are the type of filesystems you’d use to store your data, some are like proc itself and have special-purpose uses.

proc-filesystem

/proc/PID

In this case, PID is the process ID of a running program. Each process has a unique number that the system uses to identify that particular instance of that particular program. For example, when you run the program top from the command line, you see a list of running processes and their PIDs. Each process has its own subdirectory in proc, which you can browse for information about that particular process.

proc-pid

/proc/modules

One of the most vital of the files in proc, modules contains a complete list of the currently active kernel modules. If you’ve ever had to work through video driver issues, you likely know how useful this can be. While likely not something you’d use every day, this file can be a lifesaver for troubleshooting.

proc-modules

/proc/mounts

You can quickly and easily check all your mounted devices by opening the mounts file. Once again, many of the items here are not necessarily mounts points that a user need be aware of. Most of the sections relevant to you will be found toward the bottom.

proc-mounts

Conclusion

There’s certainly more to proc than can be covered here, so I’d greatly encourage anyone reading this to do some poking around in proc to find the bits of information that could be really useful to you. While many of the files you’ll find there are intended to be used by the OS itself, they can all provide a valuable look into Linux’s operations.

Beginner’s Guide to Grep

There is a classic bit of computer wisdom that states “If you’ve got a problem, and decide to solve it with regular expressions, now you’ve got two problems.” This of course stems from the perception that regular expressions are a complicated mix of magic characters and Voodoo. Regular expressions can allow you to achieve elegant and concise program logic quickly and easily, but only once you’ve learned to understand how they work and why. Just about any Linux or Mac system comes with a powerful regex tool call grep and learning grep is an essential task for any power user or system administrator. Today, we’ll explore some of what you can do with grep and how it can be one of the most powerful tools in your geek arsenal.

How It Works

In short, grep’s job is to search through a block of input. That’s pretty vague, so it’s best described by example. Let’s say you’ve got a text file called distros.txt that has a list of Linux distributions, such as the one below.

Debian – Stable server distribution
Ubuntu – Desktop distro originally based on Debian
Kubuntu – Uses KDE desktop instead of Gnome
Fedora – Continuation of the free Red Hat desktop system
Gentoo – A fast, source-based Linux system for pro users
SuSE – Commercial Linux owned by Novell
Mint – Ubuntu-derived distro with additional restricted software

Grep can be used to read through the text and filter it to show only the parts you want. If you wanted to see only the lines that contain the word “Ubuntu”, you’d run the following command:

grep Ubuntu distros.txt

grep-simple

(Your version of grep may or may not include color highlighting like in the example above)

Case Sensitivity

You may have noticed that our last search did not return Kubuntu. Unless told otherwise, grep will assume that you entered your expression exactly the way you wanted it, and this applies to upper and lower case. If you search for “ubuntu” but your text file contains “Ubuntu”, your search will find nothing. To make your search case-insensitive, use the -i switch, as in

grep -i ubuntu distros.txt

grep-dashi

Whole Word

With the previous search, you included all capitalization variants of the word “Ubuntu”. It included Kubuntu because it contains the word you searched for. You may want to only include the standard version, not Kubuntu or Edubuntu, etc. If that’s the case, you can tell grep to match the whole word only by passing the -w option.

grep -i ubuntu distros.txt

grep-dashiw

Exclusion

Much as you can use grep to show only matching entries, you can also use it to show everything BUT the matching entries. To expand on our previous searches, we can now use the -v option to reverse our results and only show the lines that don’t match.

grep-exclude

Wildcards

Grep has full support for wildcards when matching patterns. When using wildcards and other special characters, you want to make sure your search pattern is in quotes, so the Linux shell doesn’t try to interpret them before grep can. Common wildcards include * for groups of characters and . to represent a single unknown character.

grep-wildcards

Ranges

If the wildcards are a little too broad for you, you can specify individual characters or a range to include in your search. Characters within square brackets will be included in your search pattern. For example, if you had a file with a list such as

Item 1 - apples
Item 2 - bananas
Item 3 - coconuts
Item 4 - peaches
Item 5 - Grapes
Item 6 - Apricot

You can choose a particular range by using something like

grep "Item [2-4]" items.txt

Grep is an immensely powerful tool, and learning it thoroughly can pay off in all kinds of ways. Understanding grep is also makes it much simpler to move on to other powerful console tools like sed and awk. Between those three tools, an amazing amount of console and script magic can be done with far less effort than seems possible. If you’re a fan of grep, or would like to see other tools like sed and awk covered here, please drop a note in the comments.

Introduction to the Nano Text Editor

Nano is an ncurses-based editor (which means it must be run from a terminal window) that focuses on simplicity. Nano is a clone of the aging Pico text editor,  the editor for the Pine email client that was very popular, back in the early ’90s, on UNIX and UNIX-like systems. Pine has now been replaced by Alpine and Pico by Nano, but some things haven’t changed — like the simplicity of editing with Nano.

Nano was first created in 1999 under the name “TIP” (a charming, recursive acronym that stands for “TIP Isn’t Pine”) by Chris Allagretta. Mr. Allagretta decided to create this clone of Pico because Pico wasn’t released under the GPL.  The name was officially changed on January 10, 2000 to alleviate confusion between the new editor and the tip command (The tip command is common in Sun Solaris).

Nano uses very simple key combinations in order to work with files. A file is either opened or started with the command:

nano FILENAME

Where FILENAME is the name of the file you want to open. Or, if you need to edit a file that only the root user has access to:

sudo nano FILENAME

When you have the file open in Nano you will notice, at the bottom of the terminal window, a short list of command key-combination examples. All key combinations for Nano start with the CTRL key. To execute a command you hold the CTRL (commonly referred to as the “Control Key”) key down and click the secondary key to perform the action. The most common key combinations for Nano are:

  • CTRL-x – Exits the editor. If you are in the middle of editing a file the exit process will ask you if you want to save your work.
  • CTRL-r –  Read a file into your current working file. This enables you to add text from another file while working from within a new file.
  • CTRL-c – Display the current cursor position.
  • CTRL-k – Cut text.
  • CTRL-u – Uncut (or Paste) text.
  • CTRL-o – Save file name and continue working.
  • CTRL-t – check the spelling of your text.
  • CTRL-w – Search your text.
  • CTRL-a – Go to the beginning of your current working line.
  • CTRL-e – Go to the end of the current working line.
  • CTRL-g – Get help with Nano.

There are plenty more commands to use in Nano. To see the command listing use the Get help command.

Installation

Not all distributions will ship with Nano pre-installed. Ubuntu, for one, does. If your distribution does not have Nano installed, fear not, you will find it in the default repositories. To install this tool all you need to do is follow these steps:

  1. Open up your Add/Remove Software utility.
  2. Search for “nano” (no quotes).
  3. Mark Nano for installation.
  4. Click Apply to install.

That’s it! Nano will now be installed. All you have to do now is open up a terminal and start editing.

Fun fact

The recursive acronym is very common within the Linux community. Although originated back in the early, often romanticized, days of the computer hacker, this type of acronym is one that humorously refers to itself. You have more than likely come across the acronym GNU in your Linux travels. Did you know that GNU stands for GNU is Not UNIX? Recursive acronym. Other fun recursive acronyms are:

  • LAME: LAME ‘AIN’T an MP3 Encoder
  • JACK: JACK Audio Connection Kit
  • LINUX: Linux Is Not UNIX
  • WINE: Wine Is Not an Emulator

You will often find Linux developers trying to create names for their applications that include recursive acronyms.

Yum Cheat Sheet

Hi Folks,

Had a few “yum howto” hits on my blog according to my search results so thought I would pop up a quick and easy cheat sheet.

package = e.g. proftpd or php or httpd etc etc..

Install package:
yum install package

Update package:
yum update package

Remove package:
yum remove package

yum erase package

Search for a package:
yum search string

Search for a package by file:
yum provides file

Display package information:
yum info package

List installed packages:
yum list installed

Update package list:
yum check-update

Update everything:
yum update

List repositories:
yum repolist

Hope it helps someone.

If anyone would like to see any other commands on here leave a comment and I will update.

Best desktop for linux beginners

 

Seriously though how good is the as a reference guide 🙂

Linux Commands a useful list that everyone should have.

Advanced ShoutCast Hosting

Hi Folks, 

Came across one of the best looking blogs I have seen in some time maintained by a guy called Yasir which you can see here: http://killershock.online.fr 

He said it would be ok to repost some stuff and I really like this list. 

Enjoy 😀 

Linux Commands 

Getting used to Linux seems to be a daunting task for Novice users as it is considered as a completely different exposure to an environment. In fact, the Linux Terminal (after the kernel) is the root of the system since it is a means of system administration and here you’ll learn some basic commands which are followed by a brief description of its utility. 

lpr file.ext   

 

Send the filename “file” with extension “ext” to the printer 

ls -ar   

 

List all files in the current directory using recursive mode 

cd /etc/   

 

Switch to the directory /etc 

who   

 

List users who are currently logged in 

tty   

 

List active Terminals – There are up to 7 terminals on Linux. You can switch to e.g terminal 5 by Holding ALT and Pressing F5 

cp file1 file2   

 

Duplicate file1 – Give it the name file2 

system-config-display   

 

Configure the display – Triggers the display manager using the above command 

cat /etc/fstab   

 

Display contents of the file /etc/fstab to the terminal 

rm file1.txt   

 

Delete file1.txt from current directory 

pwd   

 

Prints Working Directory – Tells the user the current directory 

mkdir dir1   

 

Create directory dir1 – Note Directory are case-sensitive Dir1 and dir1 are not the same 

rmdir dir1   

 

Deletes the Directory dir1 

useradd user1   

 

Adds a new user names user1 

userdel user1   

 

Deletes user1 from the system 

passwd user1   

 

Sets the password of user1 

su user2   

 

Switch to user2′s profile – Terminal will prompt for password if user2 is password protected 

groupadd hello   

 

Creates a new group called hello 

groupdel hello   

 

Deletes the group hello 

ln file.txt /home/user/Desktop/file2.txt   

 

Creates a hard link, in other words if file1.txt is deleted file2 is not and contains contents of file1.txt 

ln -s file1.txt /home/user/Desktop/file2.txt   

 

Creates a soft link – A shortcut! if original file is deleted shortcut cannot like to original file 

ps -ax   

 

Lists all processes and their pid 

ps axjf   

 

Prints a process tree – Parent and Child Process format 

kill -9 2304   

 

Sends signal SIGKILL (-9) to pid 2304. In other words, kills the process 2304 

Having fun yet?? 😀 

The following are for slightly more advanced users but allways good to have handy: 

Changing File Permissions 

chmod +x file1.sh    

 

Set file1.sh to executable mode. In other words, typing ./file.sh in the terminal will execute the script. To make the file read, write and executable, running the command chmod +rwx file1.sh will do so. Additionally if the file was set to read, write and execute and you want it to be read-only, chmod -xw file1.sh will do the trick. 

Note: 

  • r stands for read
  • w stands for write
  • x stands for execute
  • introducing +w will introduce write mode while -w will remove write mode. This is same for other switches like x and r

 

Finding files 

locate fstab    

 

This command will list the locations where the expression “fstab” was found. Alternatively if you are looking for the file fstab the following command will help you out. 

find / -name fstab    

 

Notice the “/” and the switch “-name”. The “/” tells the find command to look in the root directory while “-name” switch tells find to locate the filename. The above command returned the following 

/etc/fstab
/usr/share/doc/mount/examples/fstab    

 

Advanced File Display 

head /proc/cpuinfo    

 

Returns the first 10 lines of the file /proc/cpuinfo. Alternatively head -n11 /proc/cpuinfo will return the first 11 lines of the file. 

tail /proc/cpuinfo    

 

Returns the last 10 lines of the file /proc/cpuinfo. Using the command tail -n12 /proc/cpuinfo will return the last 12 files of the file /proc/cpuinfo 

more /proc/meminfo    

 

This will allow the user to scroll from top to bottom of the screen. Use the enter key to scroll down. 

less /proc/meminfo    

 

Allows scrolling through the screen in both directions (UP and DOWN) using the ENTER, Page UP and Page Down Keys. 

Listing Hardware Information 

lsusb    

 

Lists usb devices/buses 

lspci    

 

Lists pci devices 

lshal    

 

Lists HAL(Hardware Abstraction Layer) devices. 

Memory Information 

free    

 

Displays information about physical memory and swap space. 

top    

 

Displays real time memory usage (see screenshot below) 

Linux Memory Usage 

Linux Memory Usage    

System Shutdown and Restart    

The piece of information below has been used with permission from geekscribes.    

shutdown [- shutdown parameters] [ time parameter] [ optional message ]

shutdown parameters: r = reboot, h = halt, c = cancel shutdown (time parameter is then not required)

Some examples:

shutdown -r now    <-- Reboot immediately
shutdown -h 19:00  <-- Shutdown (Halt) the system at 19h
shutdown -h +5 "System will shutdown"   <-- Shutdown the system in 5 mins from now, and tell users why.

%d bloggers like this: