Language Selection

English French German Italian Portuguese Spanish

6 cool BASH tricks

Filed under

In this article, I'm going to show you a number of simple, yet highly useful tricks that will make your scripting life easier. True, this article may appeal to the more geeky segment of my readers, but there's no reason to stop reading. As usual, I'll try to make my examples as simple and elegant as possible, with screenshots aplenty.

Scripts are an important part of Linux life. They are not necessary, but they can make your life easier by automating tasks. Most users will get along fine without ever bothering with scripts. But if you're lazy and would like your system to work hard rather than the other way around, learning how to write and use scripts is a good exercise.

BASH stands for Bourne Again SHell, the default Linux shell. If you're wondering what shell is, then think of its an interpreter between you (the user) and the system. You type in commands and the systems translates them into actual work. Most of the time, the results of this work are printed on your screen, inside the terminal.

Writing scripts is BASH can be as simple as entering commands one after another, then pasting them all into a text file that will become a script. Still, there are few tricks that can make a lot of difference.

Let's see them.

More in Tux Machines

Twitter Clients

  • Best in Breed Twitter Clients for Linux
    Twitter is a social networking service that is a bit of a conundrum to many. At any given time it can be used to connect with people of a like mind, and at another it’s an exercise in frustration, thanks to the never-ending stream of data. But for those that depend upon the service as a means to either stay connected, promote a product or service, or even (on certain levels) research a given topic, it’s a boon.
  • Pick of the Bunch: Command line Twitter Clients
    A console application is computer software which is able to be used via a text-only computer interface, the command line interface, or a text-based interface included within a graphical user interface operating system, such as a terminal emulator (such as GNOME Terminal or Terminator). Whereas a graphical user interface application generally involves using the mouse and keyboard (or touch control), with a console application the primary (and often only) input method is the keyboard.
  • db2twitter: Twitter out of the browser
    You have a database, a tweet pattern and wants to automatically tweet on a regular basis? No need for RSS, fancy tricks, 3rd party website to translate RSS to Twitter or whatever. Just use db2twitter.

FOSS/Linux Events

  • The Linux Foundation Becomes Steward of the Open Networking Summit
    If you're able to get to the Silicon Valley area in March, there is a big open networking conference taking shape, with some very talented participants. The Linux Foundation is announcing that the Open Networking Summit (ONS) is becoming a Linux Foundation event, and ONS 2016 will take place March 14-17, 2016 in Santa Clara, Calif.
  • Visualize astrophysics data with Blender
    The Blender Conference has become a fantastic showcase not just of attractive art and animation, but also unconventional uses of Blender and open source software.
  • SDN/NFV DevRoom at FOSDEM: Deadline approaching!
    We extended the deadline for the SDN/NFV DevRoom at FOSDEM to Wednesday, November 25th recently – and we now have the makings of a great line-up!

today's howtos

Red Hat News

  • Linux Top 3: RHEL 7.2, Puppy Linux 6.3 and Bodhi 3.1.1
    In the enterprise Linux space, few if any Linux distribution are as widely deployed as Red Hat Enterprise Linux (RHEL) and none make as much revenue. RHEL 7.2 is the latest incremental update of Red Hat's flagship Linux platform and is the second update of RHEL this calendar year.
  • Satellite 6 and Foreman re-provisioning
  • What to do when an employee's passion dwindles
    Frank, a longstanding member of my team, was unhappy and disengaged. He was visibly upset, avoided speaking up in meetings, and had declining productivity. It was obvious to everyone who worked with him that there was a problem—we had to do something to get Frank back on track, or his future on the team was uncertain. (And just to clarify: Frank is not a real person, but an amalgamation of several).
  • Red Hat, Inc. (NYSE:RHT) Shares Price Target Update
    Analysts on Wall Street have placed a short term price target of $85.058 on shares of Red Hat, Inc. (NYSE:RHT). This is according to 17 analysts polled by Zacks Research. The brokerage firm with the most lofty expectation has a $92 target. One the other end, the analyst with the most conservative objective sees the stock heading to $72.