Posts

Bash Shell Scripting

 What is my shell type? abhilash@DESKTOP-J286E82:~$ echo $0 -bash first script:- abhilash@DESKTOP-J286E82:~/myscripts$ cat 01_basic.sh #!/bin/bash echo "hey buddy!" Run script:- ./script.sh control + c:- to terminate control + z:- to stop make sure the script should be having the execute permissions abhilash@DESKTOP-J286E82:~/myscripts$ chmod 764 01_basic.sh abhilash@DESKTOP-J286E82:~/myscripts$ ls -lart total 0 -rwxrw-r-- 1 abhilash abhilash  33 Oct 15 19:56 01_basic.sh drwxr-x--- 1 abhilash abhilash 512 Oct 15 19:56 .. drwxr-xr-x 1 abhilash abhilash 512 Oct 15 19:56 . abhilash@DESKTOP-J286E82:~/myscripts$ ./01_basic.sh hey buddy! in this above way owner of script should be given a permission for execution i.e. it should be a executable script and read write as well. the second way is use bash i.e. bash script name comments:- abhilash@DESKTOP-J286E82:~/myscripts$ cat 02_basic.sh echo "cheking comments" #this is single line comment abhilash@DESKTOP-J286E82:~/myscrip...

50 Linux Commands You Should Know

Image
  ls - list the files and directories in the current directory ex:-abhilash@DESKTOP-J286E82:~/harry$ ls 1.txt  2.txt  harry1 pwd- print the current working directory ex:- abhilash@DESKTOP-J286E82:~/harry$ pwd /home/abhilash/harry cd - change the current directory ex:- abhilash@DESKTOP-J286E82:~/harry$ cd harry1 abhilash@DESKTOP-J286E82:~/harry/harry1$ mkdir - create a new directory ex:- abhilash@DESKTOP-J286E82:~/harry$ mkdir harry2 abhilash@DESKTOP-J286E82:~/harry$ ls 1.txt  2.txt  harry1  harry2 rmdir - remove a directory ex:- abhilash@DESKTOP-J286E82:~/harry$ rmdir harry2 abhilash@DESKTOP-J286E82:~/harry$ ls 1.txt  2.txt  harry1 cp - copy files or directories ex:- abhilash@DESKTOP-J286E82:~/harry$ cp main.py main-backup.py abhilash@DESKTOP-J286E82:~/harry$ ls 1.txt  2.txt  harry1  main-backup.py  main.py {here escape :wq! is for saving the file while escape :q! is only for discard the changes in that file and it will be back...