Posts tagged: shell

Apr 29 2010

Linux Bash

Linux Bash


Linux Pocket Guide


Linux Pocket Guide


$5.48


Linux Pocket Guide gets you up to speed quickly on day-to-day Linux use. It’s organized the way you use Linux: by function, not just alphabetically. It’s not the ‘bible of Linux; it’s a practical and concise guide to the options and commands you need most. It starts with general concepts like files and directories, the shell, and X windows, and then presents detailed overviews of the most essenti…

Learning the bash Shell: Unix Shell Programming (In a Nutshell (O'Reilly))


Learning the bash Shell: Unix Shell Programming (In a Nutshell (O’Reilly))


$15.50


O’Reilly’s bestselling book on Linux’s bash shell is at it again. Now that Linux is an established player both as a server and on the desktop Learning the bash Shell has been updated and refreshed to account for all the latest changes. Indeed, this third edition serves as the most valuable guide yet to the bash shell. As any good programmer knows, the first thing users of the Linux operating sy…

Classic Shell Scripting


Classic Shell Scripting


$12.99


Shell scripting skills never go out of style. It’s the shell that unlocks the real potential of Unix. Shell scripting is essential for Unix users and system administrators-a way to quickly harness and customize the full power of any Unix system. With shell scripts, you can combine the fundamental Unix text and file processing commands to crunch data and automate repetitive tasks. But beneath this…

Can you show me how to do this in linux-bash?

Can you write a script for me that does the following (it will be run with root account always):
Check to see if the first 10 characters of tacos.txt is equal to ‘1234567890′ and if it is, run the command ‘ls -a’. It needs to run every time the machine boots up!

can someone make that for me?

It depends on your system how to add it to boot, but here is the script, test it before the real usage. I suggest redirecting the command output to the logfile instead of just printing it.
eg. echo “messages” >> logfile.txt

#!/bin/bash
file=”tacos.txt”
cont=”`head -n1 $file`”
cont=”${cont:0:10}”
lookfor=”1234567890″

if [ ! -r "$file" ]; then
echo “Can’t read the file: $file”
exit 1
fi

if [ "$cont" == "$lookfor" ]; then
ls -a
fi

exit $?

Learn the Linux Bash Shell Basics

Nov 20 2009

Linux Administration Beginner’s Guide

Linux Administration Beginner’s Guide


Linux Administration: A Beginner's Guide, Fifth Edition


Linux Administration: A Beginner’s Guide, Fifth Edition


$21.21


Administering a Linux system isn’t much like administering a Windows machine. Though the goals are similar and comparable problems arise under both environments, they each require administrators to adopt a certain way of thinking about processes and data. Linux Administration: A Beginner’s Guide helps readers adapt their Windows experience to Linux work. Author Steve Shah does a great job of cluei…

Red Hat Linux Administration: A Beginner's Guide (Beginner's Guide)


Red Hat Linux Administration: A Beginner’s Guide (Beginner’s Guide)


$28.00


Perfect for systems and network administrators migrating from Windows NT to Linux, or experimenting with bringing Linux into their network topology. Even novice users will find plenty of helpful information on administering the open source operating system–including installation, initial configuration, using the bash command shell, managing files, managing software, and granting rights to users….

Linux Administration: A Beginner's Guide, Third Edition


Linux Administration: A Beginner’s Guide, Third Edition


$4.00


Learn to install and administer Linux — on an individual workstation or an entire network — with this practical introductory guide. You’ll find everything you need to get up and running with any Linux distribution, including the latest version of Red Hat. Covering the new Linux kernel and featuring an expanded section on advanced networking, this book shows you how to install and configure Linux…

Web Hosting – a Guide for Beginners

So you’re looking to learn about web hosting and what it has to offer or you may not know much about web hosting? There is no shame in not knowing this information. Everyone has to start at the beginning at some point. On that note, let’s begin learning about web hosting.

First off, what is web hosting and how does it work?

Web hosting is the business practice of providing space and bandwidth on a high-powered computer server that is connected to the Internet at very high speeds. Hosting companies maintain large networks of high-powered web server computers in a physical location known as a data center. These computer servers are connected to a very fast, and generally redundant, Internet connection. The data centers have primary and Backup Power, a fast connection to the Internet, and a security monitoring staff.

The web hosting companies provide a share of disk space and available bandwidth to a customer for a monthly fee. Once the customer is signed up, they can upload files to their personal space on the web server and the information is then viewable to anyone interested on the Internet. The monthly fee the web hosting company charges is much less than what it would cost to run a server out of your own home or data center. This is the reason these companies exist. They take care of all the hardware, software, and other technical needs for you.

Types of web hosting

There are many different types of web hosting offers, but the main three are shared, reseller, and dedicated. Each type of hosting is for a different purpose.

Shared Web Hosting

Shared web hosting is the most popular form of hosting. Shared hosting is a portion of disk space and bandwidth provided to you by the web hosting company on a high-powered server. There are many other web sites hosted on this server, and the hosting company is likely to have quite a few of these servers in a large data center. The resources of the server are shared by as many other websites as are allocated to that computer.

Shared web hosting is the best form of web hosting if you are looking for a great price and don’t have more than a couple thousand daily visitors to your site.

Reseller Web Hosting

Reseller web hosting is a popular, low-cost solution to starting your own web hosting business. There are two types of reseller hosting, private-label and a reseller of services.

The private-label is the best type of reseller plan because it allows you to retain full control over your customer’s websites. A private-label plan allows the reseller to keep the full monthly payment of the web-hosting customer, but the reseller must pay a monthly fee to the larger hosting company for the reseller space. The more hosting accounts a private-label reseller can sell, the higher the profit for them. Private-label hosting allows you to host many more websites than if you were using shared hosting for each. This is a great solution for someone who has many sites they need to host in one location to save money.

The reseller of services plans resell the regular web hosting plans of a larger web hosting company, but you get a discounted price for providing the customer and earn a monthly fee for as long as they remain a customer. This plan does not allow control over customer web sites and you only keep a portion of the potentially monthly revenue.

Dedicated Web Hosting

Dedicated web hosting is the most powerful and cost effective solution of hosting a busy web site without resorting to buying your own equipment and paying hundreds of dollars per month for a fast Internet connection. Dedicated hosting consists of single server with no one else hosting on that computer. This allows for the greatest of configuration options. Anyone who has a busy website will find dedicated hosting is the necessary choice.

Web Hosting Considerations

Wondering about all the other information listed in web hosting plans? In this section, I will explain the most important considerations in choosing a good web host.

Price

The price of web hosting services is one of the most important. There are many hosting companies out there with cheap hosting packages, but they may be lacking in other areas. Don’t let the price of a hosting package fool you. There are some hosting companies out there who have great prices and the other features are just as good. Price may be one of the most important decisions of a web hosting plan, but there is much more to consider in choosing a quality web host.

Disk Space / Storage Space

Disk space is the amount of physical storage space a web host gives to you to store your web files. Hosting companies these days have plans with disk space being measured mostly in terms of gigabytes, but some are still offering plans in the megabytes for storage space. Depending on your needs for file storage space, you may need more or less. Generally the more disk space offered the better.

Bandwidth / Data Transfer

The amount of bandwidth available can make a big difference in choosing a quality hosting plan. In general, the more bandwidth a hosting company makes available to you, the better. This means you can support more traffic to your web site as your business grows. Be wary of web hosting companies that offer unlimited or unmetered bandwidth. While many of these are legitimate offers, there are some out there who are overselling their bandwidth in hopes the average user won’t use much.

Customer Support

In any business, it is very important to provide exception customer service. Web hosting is no exception to this. Many of the hosting companies are available all day and night in case you have a problem with your web site, but there are some who are just available specific hours of the day. If your web site goes down in the middle of the night when they’re not available, this means lost revenue for a business. You should make sure the web host you select is always available for support.

Money Back Guarantee

Most web hosting companies will provide a thirty-day money back guarantee. Some will provide one even long, but be wary of the ones who offer no money back guarantee. I would not purchase web hosting services from a company who does not offer at least a 30 day money back guarantee, unless they have proven themselves to be a leader in the industry and have an excellent reputation.

Operating System

An operating system is a piece of software that controls the interaction between the computer user and the physical hardware of the machine. A vast majority of all web sites on the Internet run on the Linux operation system. Linux is generally much more stable than Windows. Stability is critical in running a web site. For this reason, I prefer to host my web sites on the Linux Operating System. Some sites have specific requirements that only the Windows operating system can satisfy, but there are always alternatives to those requirements.

Backup

A good web hosting company will have a regular schedule to backup the data on all the web servers. The more often the data is backed up, the better. At the very least, a web hosting company should backup web site files daily.

Control Panel

The control panel is the point of contact the web site administrator will have between the host server and their own machine connected via the Internet. It is essential to have a well organized and easy to use control panel interface. My favorite control panel is cPanel, which is one of the leading web hosting control panels out there today. Plesk is another good one, and many companies will create their own control panel for you to use. Most web hosting companies will provide a link to a demo of the control panel they use with their hosting plans. The control panel used is a matter of preference, but it should be user friendly.

Email

Email is essential part of communication on the Internet. Most web hosting companies out there will give you more email addresses and more space to hold email messages than you will ever need. What you need to watch out for are the companies that have decided to be a little strict on their email accounts and only offer a small number or a small amount of message space.

Uptime

Uptime is a term used to describe how often the average web site hosted by a company is available online. No company should be expected to provide an exact 100% uptime. This is impossible due to things such as hardware, software, and power failures. A vast majority of the companies are very good with uptime, and they guarantee it. It is still a good idea to be conscious of the uptimes posted by the company. If it is not at least 99.5%, it is probably not worth hosting with that company.

Statistics

As a webmaster, it is nice to know how many visitors you’ve had, where they came from, how long they stay on your site, and how much bandwidth they’ve used. This information is collected by the web server and is placed in a log file. A statistics software package can read this data and provide meaningful information to the webmaster. The information gathered from these logs can be very valuable in improved services to the viewers of the web site.

FTP

FTP stands for file transfer protocol. It is a way of quickly uploading or downloading many files to and from a web server. Most web hosting companies will allow their customers access to their web hosting accounts via FTP. FTP is very useful and is a great feature to have when paying for a web hosting account.

Scripting

Since the World Wide Web began, many scripting languages have been created and have evolved into the dynamic and interactive environment we enjoy today. A scripting language is a way of adding functionality to a web site, whether it is to calculate numbers or to load information from an external database. Scripting languages have made electronic commerce possible. Some of these languages include PHP, ASP, JSP, Cold fusion, VBscript, JavaScript, and Perl. I won’t go into the details of these in this article for the sake of complexity. If you know how to use these languages, you should know what to look for in a web server for them.

Databases

A database is a place to store data that can be used in a large variety of ways. Databases are used on the Internet for applications such as shopping carts, message boards, and product catalogues. The more databases the web hosting provider allows you to create, the most applications you can deploy on your web server. Databases are used by the more advanced web master, but information is freely available online should you be interested.

Conclusions

Web hosting can be a very difficult decision with the many thousands of hosting companies out there. It is critical to find a plan that fits your needs and to have a good hosting company. I hope this article was useful in making your decision about which company to host with. Happy Hosting!

For More Info About Author Visit At: – Cheap Domain And Cheap Hosting ! Free Videos ! Pay Per Clicks ! Cheap Domain And Much More about Search Engines

Beginner’s guide to Linux: (Advanced users tip) openSUSE 11.1 upgrade to openSUSE 11.2 – Part2


Nov 17 2009

Linux Programming Reference

Linux Programming reference
how do i fix this compiler error “undefined symbol main”?


i’m compiling my c++ program in linux and i keep getting this message:

> make
g++ -Wall -c -g project2.cpp
g++ -Wall -c -g image.cpp
g++ -o project2.exe /user/cse232/Projects/P2Graphics/color.o
/user/cse232/Projects/P2Graphics/functions.o image.o
Undefined first referenced
symbol in file
main /soft/sparc/gcc3.4.1/lib/gcc/sparc-sun-solaris2.9/3.4.1/crt1.o
ld: fatal: Symbol referencing errors. No output written to project2.exe
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `project2.exe’

i do have a main() function in project2.cpp. i checked it many times and dont know what could be wrong with it. is it something with my makefile? any help would be GREATLY appreciated.

You said that there’s a main() in project2.cpp, so check in your Makefile whether project2.o is being linked together with image.cpp.

On the line:

g++ -o project2.exe /user/cse232/Projects/P2Graphi…

You didn’t send the entire command being sent to the linker, but I’m guessing that it must have image.o because that’s the module that’s referencing main(). Check if project2.o is also in that line.

The -o project2.exe does not implicitly cause project2.o to be included in the linking.


Intel Fortran Language Reference for Linux - documentation kit ( FTC080LSGD001 )


Intel Fortran Language Reference for Linux – documentation kit ( FTC080LSGD001 )




Learning Python: Powerful Object-Oriented Programming


Learning Python: Powerful Object-Oriented Programming


$34.54


The authors of Learning Python show you enough essentials of the Python scripting language to enable you to begin solving problems right away, then reveal more powerful aspects of the language one at a time. This approach is sure to appeal to programmers and system administrators who have urgent problems and a preference for learning by semi-guided experimentation. First off, Learning Python…

Linux in a Nutshell


Linux in a Nutshell


$28.68


Everything you need to know about Linux is in this book. Written by Stephen Figgins, Ellen Siever, Robert Love, and Arnold Robbins — people with years of active participation in the Linux community — Linux in a Nutshell, Sixth Edition, thoroughly covers programming tools, system and network administration tools, the shell, editors, and LILO and GRUB boot loaders. This updated edition offers a t…

Python Pocket Reference: Python in Your Pocket (Pocket Reference (O'Reilly))


Python Pocket Reference: Python in Your Pocket (Pocket Reference (O’Reilly))


$8.51


This is the book to reach for when you’re coding on the fly and need an answer now. It’s an easy-to-use reference to the core language, with descriptions of commonly used modules and toolkits, and a guide to recent changes, new features, and upgraded built-ins — all updated to cover Python 3.X as well as version 2.6. You’ll also quickly find exactly what you need with the handy index. Written by …

Webfocus 7 Keysheet Quick Reference Guide


Webfocus 7 Keysheet Quick Reference Guide


$34.99


WEBFOCUS AND FOCUS KEYSHEET: This book is divided into 13 chapters, The keywords in each chapter are logically related. The General chapter contains all keywords that cross several WEBFOCUS and FOCUS areas. Other chapters include the impact of REPORTS, GRAPHS, MODIFY, USE, FORMS, DIALOGUE MANAGER, SQL, EDA, REPORTCASTER, AND PLATFORMS.
(NO CDs ARE INCLUDED)…

Learn Linux for a Beginner, Debian Edition. Includes Video Training & Two Certification Exams, Training Library, Installation and Printed Quick Reference Card. 5-disk DVD Set, Ed.2010


Learn Linux for a Beginner, Debian Edition. Includes Video Training & Two Certification Exams, Training Library, Installation and Printed Quick Reference Card. 5-disk DVD Set, Ed.2010


$37.95


Do you need to learn Linux fast? A major obstacle for newcomers to Linux is the steep learning curve of command-line workflow. This is designed to be training and certification solution!
This set provides the motivated beginner with everything needed for training! It includes a complete set of efficient “Learn Linux” video courses on two DVDs, corresponding Certification Exams, the “UNIX Academy T…

Seagate Crystal Reports 7.0 Technical Reference Manual


Seagate Crystal Reports 7.0 Technical Reference Manual




GNU C Library Reference


Nov 11 2009

Linux Shell Script

Linux Shell script

Creating Linux Shell script?


Hi,
I want to create a shell script For Linux to make 3-4 commands run at same time, can you please post me how i can do that, i have practiced creating batch files in ms dos and that works fine but no idea how i will do in Linux.

Create the script as a text file then run

chmod 777 filename

In linux, the execute bit for the given user/group must be set – chmod 777 sets the file to rwx for the user, group, and everyone.

Curso de Shell Script Parte 1 – Introdução


Nov 05 2009

Linux And Unix Shell Programming

Linux And Unix Shell Programming


Learning the bash Shell: Unix Shell Programming (In a Nutshell (O'Reilly))


Learning the bash Shell: Unix Shell Programming (In a Nutshell (O’Reilly))


$15.50


O’Reilly’s bestselling book on Linux’s bash shell is at it again. Now that Linux is an established player both as a server and on the desktop Learning the bash Shell has been updated and refreshed to account for all the latest changes. Indeed, this third edition serves as the most valuable guide yet to the bash shell. As any good programmer knows, the first thing users of the Linux operating sy…

Classic Shell Scripting


Classic Shell Scripting


$12.99


Shell scripting skills never go out of style. It’s the shell that unlocks the real potential of Unix. Shell scripting is essential for Unix users and system administrators-a way to quickly harness and customize the full power of any Unix system. With shell scripts, you can combine the fundamental Unix text and file processing commands to crunch data and automate repetitive tasks. But beneath this…

Unix Shell Programming (3rd Edition)


Unix Shell Programming (3rd Edition)


$22.84


Unix Shell Programming is a tutorial aimed at helping Unix and Linux users get optimal performance out of their operating out of their operating system. It shows them how to take control of their systems and work efficiently by harnessing the power of the shell to solve common problems. The reader learns everything he or she needs to know to customize the way a Unix system responds.The vast majo…

Unix/Linux Shell Programming and System Admin?


Give an expression to match the following description:

1) there are exactly four characters long

2). do not contain a number

3). contain either `.txt’ or `.text’

4). contain any ftp, rstm, or `http’ URLs

Do you own homework. You will thank me later.

Ubuntu Install Unix Shell Scripting Linux Shell Scripting


Oct 19 2009

Linux Beginners Guide

Linux Beginners guide

Batch files in ubuntu?


I need to know how to convert batch files to work in linux ubuntu. I looked up tutorials on shell scripting but the beginner guides are extremely complicated. I just want to play a runescape private server :/

It would be easier if you would past the code from your original batch file that you want to convert.

As far as I know, starting up a runescape server is done by simply calling the binary executable so that’s what you have to do in the batch file.

There is no difference between how batch files work in WIndows and Linux, you just have to check for the paths and file names to be correct and that the Linux batch file be made executable (chmod 777 just to be sure).

Beginner’s guide to Linux: openSuSE 11.1 installation guide


Sep 16 2009

Linux Programming Examples

Linux Programming examples
Why do people use Linux when they don’t make much software for it?


Why do more technical(nerds) people use Debian? Also, why do people use Linux when the majority of programs are made for Macs or PCs? For example Photoshop isn’t made For Linux, as well as many other programs I use a lot.

That’s not entirely true. While there isn’t a lot of commercial software available for Linux there is still software available. I use Fedora Core 6 at home, and through the Fedora Project website can download quite a bit of software. While it’s true that you can’t use Photoshop on a Linux Machine, you can use Gimp.


Bash Cookbook: Solutions and Examples for Bash Users (Cookbooks (O'Reilly))


Bash Cookbook: Solutions and Examples for Bash Users (Cookbooks (O’Reilly))


$27.48


The key to mastering any Unix system, especially Linux and Mac OS X, is a thorough knowledge of shell scripting. Scripting is a way to harness and customize the power of any Unix system, and it’s an essential skill for any Unix users, including system administrators and professional OS X developers. But beneath this simple promise lies a treacherous ocean of variations in Unix commands and standar…

Linux Programming by Example: The Fundamentals


Linux Programming by Example: The Fundamentals


$9.11


Anyone who’s done programming work knows that you spend half your coding time looking for other people’s solutions to the problems you’re facing in your project. Particularly when you’re dealing with times, dates, standard calculations, and other common problems, you find yourself saying, “Someone must have solved this before.” And, indeed, someone usually has. Linux Programming by Example is a de…

Portable Shell Programming: An Extensive Collection of Bourne Shell Examples


Portable Shell Programming: An Extensive Collection of Bourne Shell Examples


$15.25


Traditionally, books on shell programming present the shell as the user interface to UNIX. This complete guide shows how to use the shell to develop shell scripts, using the shell more like a programming language than a command interpreter. Covers shell syntax, portability on different UNIX systems, using shell scripts to catch or ignore signals, executing commands using the remote shell c…

Contiki 2.0 Rime examples under netsim in Linux


Jul 23 2009

Advanced Linux Programming

advanced Linux Programming

Can you run VB.net from a windows emulator in Linux?


I really want to switch to Linux. I am soooooo tired of windows. However I am in IT student and need to learn programming. Any Linux gurus here have any suggestions for me? What distro would be the best, what emulator program would be the best, and are there any Linux programming programs for beginning programmers? I don’t really want to dual boot because that would mean I would have to shell out $300 for windows (the windows im running is bootleg, and I inherited it on this pc), however I will as a last resort.

thx in advance

You don’t need a windows emulator at all. There is a Linux-native version of VB.Net and its performance would be a lot better.

Check it out here:

http://www.go-mono.com/

No emulation – this is an open source implementation of the .NET Framework, and includes a VB.Net compiler implementation.

How to Customise and theme Ubuntu 9.10’s GDM Like Ubuntu 8 and low ADVANCED


Jul 06 2009

Linux Shell Scripting

Linux Shell scripting

Mydumpsplitter-Extract Tables From Mysql Dump-Shell Script

A lot of articles have been written on splitting mysqldump and grabbing the required tables.

A long while back, when Shlomi had suggested a “sed” way, I actually shell scripted this activity, which I am now publishing in this article.

This shell script will grab the tables you want and pass it to tablename.sql.

It’s capable of using regular expressions as I’ve added the sed -r option.

Also MyDumpSplitter can split the dump file in to individual table dumps.

Check the output on Linux shell:

$>sh MyDumpSplitter.sh

Usage:

sh MyDumpSplitter.sh DUMP-FILE-NAME — Extract all tables as a separate file from dump.

sh MyDumpSplitter.sh DUMP-FILE-NAME TABLE-NAME — Extract single table from dump.

sh MyDumpSplitter.sh DUMP-FILE-NAME “TABLE-NAME-REGEXP” — Extract tables from dump for specified regular expression.

How to use MyDumpSplitter to split tables from MySQL Dump:

1. To create individual tables sql from a single dump:

sh MyDumpSplitter.sh database_fulldump.sql

The above command will create individual dumps for each table from a main fulldump sql file.

They will be stored as tablename.sql in the same directory.

2. To extract a single table dump from a single dump:

sh MyDumpSplitter.sh database_fulldump.sql tablename

The above command will create a dump for the specified table from a main fulldump sql file and store it to tablename.sql.

3. To extract tables matching certain regular expression criteria from a single dump:

sh MyDumpSplitter.sh database_fulldump.sql “tablename(.*)”

The above command will extract all tables which match the regular expression “tablename(.*)” from a main fulldump sql file and store each table matching to regular expression it to tablename.sql.

An illustration of all three in action is below to help convey what might be missed by the words above and give you a feel for output of proper execution:

Note: MyDumpSplitter.sh is a very basic script and can be extended with more features and modified further.

e.g., it can be parameterised to get individual table-names or a single-dump of all extracted tables amongst other improvements.

Below is the dump splitter script:

#!/bin/sh

#SPLIT DUMP FILE INTO INDIVIDUAL TABLE DUMPS

# Text color variables

txtund=$(tput sgr 0 1) # Underline

txtbld=$(tput bold) # Bold

txtred=$(tput setaf 1) # Red

txtgrn=$(tput setaf 2) # Green

txtylw=$(tput setaf 3) # Yellow

txtblu=$(tput setaf 4) # Blue

txtpur=$(tput setaf 5) # Purple

txtcyn=$(tput setaf 6) # Cyan

txtwht=$(tput setaf 7) # White

txtrst=$(tput sgr0) # Text reset

TARGET_DIR=”.”

DUMP_FILE=$1

TABLE_COUNT=0

if [ $# = 0 ]; then

echo “${txtbld}${txtred}Usage: sh MyDumpSplitter.sh DUMP-FILE-NAME${txtrst} — Extract all tables as a separate file from dump.”

echo “${txtbld}${txtred} sh MyDumpSplitter.sh DUMP-FILE-NAME TABLE-NAME ${txtrst} — Extract single table from dump.”

echo “${txtbld}${txtred} sh MyDumpSplitter.sh DUMP-FILE-NAME “TABLE-NAME-REGEXP” ${txtrst} — Extract tables from dump for specified regular expression.”

exit;

elif [ $# = 1 ]; then

#Loop for each tablename found in provided dumpfile

for tablename in $(grep “Table structure for table ” $1 | awk -F”`” {‘print $2′})

do

#Extract table specific dump to tablename.sql

sed -n “/^– Table structure for table `$tablename`/,/^– Table structure for table/p” $1 > $TARGET_DIR/$tablename.sql

TABLE_COUNT=$((TABLE_COUNT+1))

done;

elif [ $# = 2 ]; then

for tablename in $(grep -E “Table structure for table `$2″ $1| awk -F”`” {‘print $2′})

do

echo “Extracting $tablename…”

#Extract table specific dump to tablename.sql

sed -n “/^– Table structure for table `$tablename`/,/^– Table structure for table/p” $1 > $TARGET_DIR/$tablename.sql

TABLE_COUNT=$((TABLE_COUNT+1))

done;

fi

#Summary

echo “${txtbld}$TABLE_COUNT Table extracted from $DUMP_FILE at $TARGET_DIR${txtrst}”

Suggestions are welcome and I’ll update it whenever time permits.

To see original posting on my blog: http://kedar.nitty-witty.com/blog/mydumpsplitter-extract-tables-from-mysql-dump-shell-script/

Getting User Input in a Shell Script


Jun 06 2009

Linux Script

Linux Script


Hello World! Computer Programming for Kids and Other Beginners


Hello World! Computer Programming for Kids and Other Beginners


$20.15


“Computer programming is a powerful tool for children to ‘learn learning,’ that is, to learn the skills of thinking and problem-solving…Children who engage in programming transfer that kind of learning to other things.”–Nicholas Negroponte, the man behind the One Laptop Per Child project that hopes to put a computer in the hands of every child on earth, January 2008Your computer won’t respond w…

Linux Command Line and Shell Scripting Bible


Linux Command Line and Shell Scripting Bible


$24.99


There’s a lot to be said for going back to basics. Not only does this Bible give you a quick refresher on the structure of open-source Linux software, it also shows you how to bypass the hefty graphical user interface on Linux systems and start interacting the fast and efficient way?with command lines and automated scripts. You’ll learn how to manage files on the filesystem, start and stop program…

Bash Cookbook: Solutions and Examples for Bash Users (Cookbooks (O'Reilly))


Bash Cookbook: Solutions and Examples for Bash Users (Cookbooks (O’Reilly))


$27.48


The key to mastering any Unix system, especially Linux and Mac OS X, is a thorough knowledge of shell scripting. Scripting is a way to harness and customize the power of any Unix system, and it’s an essential skill for any Unix users, including system administrators and professional OS X developers. But beneath this simple promise lies a treacherous ocean of variations in Unix commands and standar…

Java Programming for a Beginner, 5-disk DVD Complete Training Suite & Certification Exam by UNIX Academy


Java Programming for a Beginner, 5-disk DVD Complete Training Suite & Certification Exam by UNIX Academy


$23.95


Starting programming in general and especially in Java is a challenge. To program in Java, one needs to know the language and have a working knowledge of Integrated Development Environment (IDE). This training set provides both (and includes all software)! A beginner dealing with Java needs guidance and orientation in the subject. This super-set provides all components related to Java training (la…

Welcome to ProtoPenny - Ultimate Penny Auction Script Software


Welcome to ProtoPenny – Ultimate Penny Auction Script Software


$299.00


We are excited to announce a new product from NDC – ProtoPenny – The Penny Auction system that fits the bill and beats the power of Swoopo and alikes! Wonder how you’re going to make money when the economy is busted? Wonder no more! Start your own penny auction business to make real money. While the economy is down, the penny auctions are still the best income maker for those who run them! So, be …

Welcome to ProtoApps - Android Apps Market Script Software


Welcome to ProtoApps – Android Apps Market Script Software


$795.00


We are excited to announce a new product from NDC – ProtoApps – The Apps Market system that fits the bill and beats the power of Android Apps Market and alikes! Ever wished to be part of the latest and greatest technology boom in apps for Android devices? Here is your biggest opportunity! The Apps Market system to offer app developers to sell their apps to the masses. You will be able to run your …

Linux Shell script: how do i check home directory size and email user if its too big?


I am trying to write a shell script that evaluates the size of each user’s home directory and if it is greater than 50 MB I want an email to be sent to their user account telling them that they need to reduce the size of their home directory.

I am mainly having trouble with using the output of du -s /home/* to compare each size to 50mb and then sending an email to that user, any help would be fantastic thank you.

Don’t do it (quite) that way.

Read /etc/passwd, and use sed or awk (for example) to extract the home directory of each user. If the directory exists, and is readable, run du on it, with “du -s “. Feed that into sed again, extracting the first item (size), Note that the size in in 1K bytes, multiply by 1024 to get the size in bytes.

awk -F : ‘{print $1 ” ” $6}’ tmp

will print a list of users and home directories

awk ‘{print $1}’ tmpusers

will extract the user names from the above output and

awk ‘{print $2}’ tmpdirs

for d in `cat tmpdirs`; do du -s $d; done >tmpsizes

will capture sizes along with home directories

You can then use “join” to combine the results.

simple bash script in Linux