Tutorial: Automate UNIX and Linux task with shell scripts

Martin Streicher is the Editor-in-Chief of Linux Magazine has published beginners tutorial to automate common task.

A shell script saves both time and typing job. The Web is full of helpful scripts that others have created for many purposes (here is my own shell scripts collection).

From the article:
Discover how shell scripts can mechanize virtually any personal or system task. Scripts can monitor, archive, update, report, upload, and download. Indeed, no job is too small or too great for a script. Here’s an introduction.

If you peer over a longtime UNIX user’s shoulder while he or she works, you might be mesmerized by the strange incantations being murmured at the command line. If you’ve read any of the previous articles in the Speaking UNIX series (see Resources), at least some of the mystical runes being typed — such as tilde (~), pipe (|), variables, and redirection () — will look familiar. You might also recognize certain UNIX command names and combinations, or realize when an alias is being used as a sorcerer’s shorthand.

Still, other command-line conjurations might elude you, because it’s typical for an experienced UNIX user to amass a large arsenal of small, highly specialized spells in the form of shell scripts to simplify or automate oft-repeated tasks. Rather than type and re-type a (potentially) complex series of commands to accomplish a chore, a shell script mechanizes the work.

Automate, automate, automate – Mechanize personal and system chores with shell scripts

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 5 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
5 comments… add one
  • Alok Oct 23, 2009 @ 16:22

    If i have to automate a shell script in unix what are the options can look for?
    any help regarding this woill be appreciated.

  • ranvijay Apr 5, 2010 @ 12:19

    how can i make shell script automated. so i can use any time when it is required. like running a set of command. instead of writing again again.

  • siva Aug 22, 2011 @ 19:28

    Task is to navigate to a path,set the variable,export the variable and provide username and password and stop the server.

    how do i execute all these commands using shell scripting and apply to cronjob?


  • Debsili Jun 26, 2013 @ 5:56

    everyday i need to run some specific unix commands to check whether the servers have sucessfully validated or not. Please let me know how do I automate this. I have only sh port open

  • phang Feb 23, 2017 @ 6:22

    1) Create a common user with username “support”

    2) Change the support user password to 123456

    3)Create a directory name hacknet (hacknet create /home/support)

    4) Inside hacknet directory, create a empty file, name it hacknet

    5) Write your student id in hacknet save and quit

    6) List out the IP address of your server

    7) Create a common with username “hacknet”

    8) Create a password for “hacknet” user with 1122334455

    9) Make “hacknet” to have sudo permission (visudo)

    10) Changes ssh port to 22222

    11) Create a folder name fruity in /home/support

    12) Create 4 folder in fruity, name it as durian, coconut, abcsoup, carrot

    13) Create 100 directory inside abcsoup name it goodtaste starting 1-100 folder name

    14) Create a symbolic link for goodtaste98 name it mummysoup

    15) Create a text file in mummysoup and name it haha with content i am student xxxxxxx student id.

    16) Display the content of the file haha

    17) List file in goodtaste98 see is it haha file in under the goodtaste directory.

    18) Install lrzsz

    19) Stop and disable firewalld

    20) Copy the file haha to /home/support/

    21) Show the harddisk space with human languange

    22) Show memory info on Megabytes

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum