Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-31-2015, 04:24 PM   #1
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 472

Rep: Reputation: 29
good examples of bash scripts

hi guys,

i know what bash scripts are
how to make them
and how to run them...

i have written some basic scripts that
show what users are logged on
how much free disk space there is etc
backup folders with rsync
also made a menu that let me select which host i wanted
to rdp into.

could somebody post here or point to a web site that has good examples of well used bash scripts on a production see what / or try to see what exactly is going on...

would really appreciate any help
Old 03-31-2015, 04:39 PM   #2
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 812

Rep: Reputation: 216Reputation: 216Reputation: 216
You can typically found tons of reasonably well-written scripts on your own system...

Try e.g. (as root)
grep -lr '#!/bin/sh' /etc
to find shell scripts
grep -lr '#!/bin/bash' /etc
to find bash scripts.

Instead of etc other directories (e.g. usr) also make sense. It obviously depends a bit on your distro

Last edited by joe_2000; 03-31-2015 at 04:39 PM. Reason: fixed broken code tag
1 members found this post helpful.
Old 03-31-2015, 06:19 PM   #3
Keith Hedger
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,351

Rep: Reputation: 591Reputation: 591Reputation: 591Reputation: 591Reputation: 591Reputation: 591
also grab a copy of the advanced bash scripting guide, it may be in your distros repo if not google it
Old 04-01-2015, 12:58 AM   #4
Senior Member
Registered: Apr 2010
Posts: 1,163

Rep: Reputation: 194Reputation: 194
check out this link:

or just trawl the web like searching Google "Bash Beginners Guide"
Old 04-01-2015, 06:42 AM   #5
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,816
Blog Entries: 10

Rep: Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727Reputation: 1727
My $0.02 in BASH are in my signature links, the last line of it actually. One is a blog entry with some samples but really debug suggestions for general BASH programming. Also are links for the BASH guides.

You can just Google for "sample BASH scripts" and even be specific like "BASH script find files example" stuff like that.

The link provided by Keith Hedger is very good.

And also if you check out the LQ forums, specifically the Software and Programming forums you'll find a lot of BASH script questions with very helpful answers.

A few things to learn in addition to just scripting would be:
  1. Regular Expressions
  2. awk or gawk
  3. sed

Last edited by rtmistler; 04-01-2015 at 06:43 AM.
Old 04-01-2015, 02:19 PM   #6
Registered: Feb 2011
Location: Republic Of Ireland
Distribution: Debian,Centos,Slackware
Posts: 472

Original Poster
Rep: Reputation: 29
thanks all


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
can u provide to learn some useful links for basic shell scripts with examples sekhar.hai Linux - Newbie 4 07-03-2014 09:49 PM
Any shell scripts repository examples? RigsJuarez Linux - Newbie 2 09-02-2013 11:06 PM
Good Code Examples JMJ_coder Programming 10 09-17-2007 07:05 PM
Good Ajax Code Examples Neko_D Programming 5 04-09-2007 03:17 PM
Anyone know where I could get some good examples of sendmail files? WorldBuilder Linux - Networking 1 05-14-2003 04:12 AM

All times are GMT -5. The time now is 12:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration