bash scripting part 1- Hi guy if you are searching for a bash scripting tutorial and searching for the best article to get the best explanation about bash scripting. Then you are at the right place.


Today In this article, I'm going to share the basic information about bash commands, now we will discuss the command of the bash terminal and its uses with detailed guidance. In this article, we try our best to provide the best content and also try to solve your query and doubts.

Bash Scripting part 1






PART 1: - Introduction to UNIX-LIKE operating systems


1.1 Accessing files or directories

   cd                     Change the current working directory of the shell

    ls                      List the content of the current working directory. Its important options are :

                                -l       long form: More details

                                -a       all: Also include hidden files

                                -h       human-readable: Output sizes in a more readable way

                                -t       time: Sort output by time

    pwd                 Print the current working directory of the shell

1.2 Modifying files and directories

    touch             Change the modification time if the file exists, else create an empty file, options:-

                                -t       Change modification time to the one provided

    mkdir             Create a directory

    rm                   Delete files. Its important options:-

                                -r       recursive: Delete all the files and directories in a directory

                                -i       Ask before each file deleted

                                -I       Ask only in certain circumstances and only once (mass-delete)

    rmdir              Delete empty folders

    chown            Change ownership for a file 


1.3 Getting or filtering file content

     cat                  Concatenate one or many files together

      tac                 Concatenate files and print lines in reverse order  

      tee                 Write input to a file and to output as well

      cut                 Extract <tab>-separated columns from input

                                -d       delimiter: Character to use for the split

                                -f       fields: Which fields (columns) to print

    grep                Filter input / by a pattern

                                -i       ignore case

                                -v       invert: only non-matching lines are given

                                -o       only-matching: print only matching content

                                -C       context: print n lines of context as well 

                                -q       only the return code is determined

    sort                 Sort input according to some parameters, Options:

                                -g       general numeric sort: interpret strings like "1E-9" as numeric values

                                -u       unique sort: each identical line is only print once

   uniq                 Take a sorted input and discard double lines

                                -c       count the number of occurrences


Do you know what is a phishing page?


Conclusion:- In this article, we talked about the different commands of bash and their uses like cd, ls, rm, pwd, mkdir, ..etc  Did you know how to use that commands in a bash script