close
  • Ga chevron_right

    How to manage Linux Bash history

    Danie van der Merwe · news.movim.eu / gadgeteerza-tech-blog · Wednesday, 12 January - 14:02

BASH (Bourne Again SHell) is the default shell in practically all Linux-based operating systems. All the commands we write in the terminal are interpreted by the shell, and become part of its history. In this tutorial, we see where the shell history is saved, and how to manage it using the “history” built-in command and some environment variables.

The tutorial covers where and how the history is saved, how to modify history behaviour via environmental variables, etc. So it is not the normal "how to use history" guides, but it is worth just mentioning, if you want to repeat a command by its number, you can quickly use !13 for the line numbered 13.

See https://linuxconfig.org/how-to-manage-bash-history

#technology #linux #opensource #bash #cli

  • Li chevron_right

    Useful Bash Commands You May Not Know About

    pubsub.slavino.sk / linuxhandbook.com · Tuesday, 12 October, 2021 - 14:54 edit

Here are some lesser known but useful bash commands that will help make the shell scripts you write cleaner and more maintainable.

Značky: #Linux, #Bash

  • Li chevron_right

    Replacing a Substring With Another String in Bash

    pubsub.slavino.sk / linuxhandbook.com · Friday, 24 September, 2021 - 05:04 edit

Learn how to replace a single or multiple occurrences of a substring inside a string in Bash.

Značky: #Linux, #Bash

  • Li chevron_right

    Unusual Ways to Use Variables Inside Bash Scripts

    pubsub.slavino.sk / linuxhandbook.com · Thursday, 23 September, 2021 - 11:44 edit

You might have used variables in Bash before, but probably not like this.

Značky: #Bash, #Linux

  • Ga chevron_right

    Bash Scripting – Functions Explained With Examples

    Danie van der Merwe · news.movim.eu / gadgeteerza-tech-blog · Wednesday, 22 September, 2021 - 17:23

https://upload.movim.eu/files/62f168f3fbecac605d21a105beda461820293db1/wPKSQ26EbeEL/proxy.jpg

In Bash shell scripting, functions are ways to group the set of instructions together to get a specific outcome. You can think of functions as a mini script. Functions are also called procedures and methods in some programming languages. Functions are a great way to achieve modularity and reusability. And especially so if you define your functions in one script file, and import those into other script files. This is similar to import statements in python, include statements in C, etc.

See https://ostechnix.com/bash-functions-shell-scripting/

#technology #linux #bash #functions #scripting

  • chevron_right

    Command line wizardry, part two: Variables and loops in Bash

    news.movim.eu / ArsTechnica · Monday, 20 September, 2021 - 11:15

Getting the hang of iteratively building commands interactively is all it really takes to become a command line wizard.

Enlarge / Getting the hang of iteratively building commands interactively is all it really takes to become a command line wizard. (credit: Bashar Shglila / Getty Images )

In our first tutorial on command line wizardry, we covered simple redirection and the basics of sed, awk, and grep. Today, we're going to introduce the concepts of simple variable substitution and loops—again, with a specific focus on the Bash command line itself, rather than Bash scripting.

If you need to write a script for repeated use—particularly one with significant logical branching and evaluation—I strongly recommend a "real language" instead of Bash. Luckily, there are plenty of options. I'm personally a big fan of Perl, in part because it's available on pretty much any *nix system you'll ever encounter. Others might reasonably choose, say, Python or Go instead, and I wouldn't judge.

The real point is that we're focusing on the command line itself. Everything below is something you can easily learn to think in and use in real time with a little practice.

Read 47 remaining paragraphs | Comments

index?i=b2rmK2aRxcs:in0f0CJZwD8:V_sGLiPBpWUindex?i=b2rmK2aRxcs:in0f0CJZwD8:F7zBnMyn0Loindex?d=qj6IDK7rITsindex?d=yIl2AUoC8zA
  • Li chevron_right

    How to Check if String Contains a Substring in Bash

    pubsub.slavino.sk / linuxhandbook.com · Sunday, 12 September, 2021 - 06:33 edit

In this bash string tutorial, you'll learn to check whether a given string contains a substring or not.

Značky: #Linux, #Bash