Bash: Difference between revisions

From Chalphy Cyber Cavaliers
Line 7: Line 7:
The following is a list of the most common built in commands in bash with examples:
The following is a list of the most common built in commands in bash with examples:


;alias 'name'='command'<nowiki>:</nowiki> Will create a special note that says "hey, if this command is executed, run this command instead." The example will basically say if the command dir is typed, run ls instead.
*alias 'name'='command'<nowiki>:</nowiki>  
:alias dir=ls
**Will create a special note that says "hey, if this command is executed, run this command instead." The example will basically say if the command dir is typed, run ls instead.
***alias dir=ls

Revision as of 17:43, 21 March 2024

Bash (short for Bourne Again SHell) is the main scripting language used to provide a command line to Linux. I covered it briefly in Linux 101, but I will be covering it more in depth here. Very rarely will you write entire programs in bash, but it is a quick way to do many tasks all in one if you master it, it's just a little confusing as most lower level languages tend to be at times.

The most basic thing with bash, is that there is a variable that sets what directories to look for executable files. Every time you run a command, it searches these folders for a matching file to execute. These files can be anything, from python scripts to bash scripts to compiled executable files.

Bash builtins

The following is a list of the most common built in commands in bash with examples:

  • alias 'name'='command':
    • Will create a special note that says "hey, if this command is executed, run this command instead." The example will basically say if the command dir is typed, run ls instead.
      • alias dir=ls