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, 05: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, 05: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 05:39 PM. Reason: fixed broken code tag
1 members found this post helpful.
Old 03-31-2015, 07:19 PM   #3
Keith Hedger
Senior Member
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Linux From Scratch, Slackware64, Partedmagic
Posts: 2,308

Rep: Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566
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, 01:58 AM   #4
Senior Member
Registered: Apr 2010
Posts: 1,125

Rep: Reputation: 190Reputation: 190
check out this link:

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

Rep: Reputation: 1648Reputation: 1648Reputation: 1648Reputation: 1648Reputation: 1648Reputation: 1648Reputation: 1648Reputation: 1648Reputation: 1648Reputation: 1648Reputation: 1648
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 07:43 AM.
Old 04-01-2015, 03: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 10:49 PM
Any shell scripts repository examples? RigsJuarez Linux - Newbie 2 09-03-2013 12:06 AM
Good Code Examples JMJ_coder Programming 10 09-17-2007 08:05 PM
Good Ajax Code Examples Neko_D Programming 5 04-09-2007 04:17 PM
Anyone know where I could get some good examples of sendmail files? WorldBuilder Linux - Networking 1 05-14-2003 05:12 AM

All times are GMT -5. The time now is 01:44 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