Bash fundamentals

An understanding of Bash starts with an understanding of Bash syntax. After you know the syntax, you can apply it to every Bash command you run.

The full syntax for a Bash command is:

BashCopy

command [options] [arguments]

Bash treats the first string it encounters as a command. The following command uses Bash’s ls (for “list”) command to display the contents of the current working directory:

BashCopy

ls

Arguments often accompany Bash commands. For example, you can include a path name in an ls command to list the contents of another directory:

BashCopy

ls /etc

Most Bash commands have options for modifying how they work. Options, also called flags, give a command more specific instructions. As an example, files and directories whose names begin with a period are hidden from the user and aren’t displayed by ls. However, you can include the -a (for “all”) flag in an ls command and see everything in the target directory:

BashCopy

ls -a /etc

You can even combine flags for brevity. For example, rather than enter ls -a -l /etc to show all files and directories in Linux’s /etc directory in long form, you can enter this instead:

BashCopy

ls -al /etc

Bash is concise. It’s sometimes remarkable (and a point of pride among Bash aficionados) how much you can accomplish with a single command.

sap erp procurement material management training courses malaysia

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *