Wednesday, May 6, 2020

Linux - Shell Bass Commands from Scratch for QA


Download VirtualBox -Windows hosts
Virtual box - It is a software which allows users to run multiple operating system on a single machine.
Debian Download
user name: manoj password: 1234
put user name : manoj
password: 1234
ip a //you will get ip address
ping google.com //to see internet connection
clear // clears all
pwd //my current location


ls // list all
cd dev // if you want to go dev folder
ls -lh // size of folder
ls -l // all file name size date
ls -lhS // size of file according to descending order of file name ..z,y,x
ls -lhSr // size of file and order accending order of file... a b c
cd .. // go back to directory
ls -lt //modification date with date
ls -ltr //order modification date by order ..
pwd //current location of directory
The routes:  types uses and characterstics:
cd /home/ //change directory
ls -l // you can see the folder inside home with size
pwd // you can see your currne directory

cd Dev/ //go to dev folder
cd -l //what folders are inside Dev folder
cd .. // go back to folder/ parent direcotry
clear //clear window

ls -la /show hidden folder

cd .. /dev/ //go back to the parents folder and enter to the another dev folder directory
cd ../.. // go directlry to the parents from some folder
pwd // current directory

Shortcuts in the use of Bash:
ls -l //all folder
pwd // current direcotry
exit // exit
mkdir dev //creating dev folder
rm dev //delete dev folder
clear // clear all
cd dev/ //go to dev folder
cd ... //back directory
su root //root
mv dev Manoj //rename
touch carta.txt
cat carta.txt
up and down keys helps to see your previous command
ls lht
ls -l dev //it shows what are there inside folder directory
ls -l text.txt
history
!122 //if you want to execute command from histroy write a command



Create,move and delete files and directories(mkdir,touch,rm and mv)
mkdir manoj //create manoj folder
cd manoj // go to inside manoj folder
ls - l //list the folder inside manoj...there is no folder
ls -lah
cd .. // go back

mkdir dir1, dir2, dir3 //create multiple directory
ls -l //you can see all direcotry
mkdir dir1/book //creating folder book inside dir1 folder
mkdir -p dir5/pen // creating new dir5 and isnside pen folder directly

rm - r dir1 // erase dir1 folder

touch autom.txt //creating text file
mv autom.txt bible.txt //rename file
cat bible.txt //it shows text inside file


Copy items
cp book.txt pen.txt //copy book folder to pen
cp book.txt dev //copy book inside dev folder

cp -r dev dev2
ls -l
ls -l dev2
ls -
cp book.txt pen.txt dev //copy file to dev folder

mv book.txt to paper.txt //changing name


USE of wildcards: the asterisk
cp pen.jpeg dev //copying pen file to dev
cp book.png dev //copy
cp book.png pen.jpeg dev //same things
ls -l dev //see all files
ls -l pen* //shows all files starts from pen
ls -l *.gif //all files starts extensiotn .gif
ls -l * //all files inside folder
ls -l *.* //files has . extension

touch READ //creating Read file without extension..
ls -l *a* //shows file "a" in middle of letter files
ls -l t* //shows file start from t
Use of wildcards: the interrogation
ls -l book-2020?.txt //shows all files after book-2020 ..doesnot care/
ls -l book-2020* //shows all files
ls -l book-2020?.txt //shows specifif file eg; book202004.txt .in * it shows all files
touch book-2020.doc //creating doc file
ls -l book-2020??.* //shows all files

Information about users and groups:
su //switch sudo administration you will reach to the root
ls -l //see the owner of file
exit //log out from administration
whoami //it says who i am
groups //it says group
id //it says about id

create users, groups, password and change owners
ls -l //shows users , root
su // switch root
adduser teresa //adding user teresa
usermod -g teresa manoj // modify the group
//id manoj //tells user manoj belongs to the teresa group
su teresa //owner change to teresa
touch merisa //create merisa file
ls -l //merisa file belongs to the teresa and group manoj

su
chown dev:users manoj ana
ls -a
chown root manoj teresa //change user to teresa
chown :ana manoj teresa //go to teresa group

passwd //changing password
The permissions on the file
ls -l //you will see the file
# rw - rw this is not command //permission granted
# r--r--r //permission is not granted files
#x--x //we can execute these files
# ---- does not have any permission . can not read write and execute

cat pen.txt //reading file
echo nueve linea >> pen.text //able to write
cat pen.txt //able to write
ls -l pen.txt //read
./pen.txt //read a file
cat codigo-ejecutable.sh //exeute
./codigo-ejecutable.sh
Permission in Direcotry: Change permission chmod orders
#-drwxr //reading hold
chmod +r pen.txt // read permission is granted
chmod -r pen.txt // denied read permission
//-r(group) --r(owner) --r(otheres)
U - group users g- group owners - o- rest ..all denied u,
chmod u -r pen.txt //deny permision to user
chmod o+x pen.txt //others access permision
chmod u+r pen.txt // persmission acess for reading
chmod u+r,g+x pen.txt //permission reading to user and owner
chmod u=w, o=wx pen.tx //permission write and read
chmod u=, g=, 0= pen.txt //no permission for user,onwner and other
chmod u=rwx, g=rwx, 0=rwx pen.txt //read write executable permission for user,onwner and other



Package and repositories:
su //root
apt-get update //update
apt-cache search vlc //see all vlc
apt-cache search mines
apt -get install vlc //install vlc

apt-get remove vlc //remove vlc or uninstall
apt -get purge vlc //remove everything from system.
aptitute search vlc //search vlc..its completely uninstall from system.




If you are running karate, selenium - maven project from command line:
command
karate Command Line: working
mvn test -Dtest=KarateRunner
mvn test -Dkarate.options="classpath:com/lca/phoenix/lcc/testinfo/karate/statcheckPost.feature"
Run karate from different enviroment:
mvn test -DargLine="-Dkarate.env=AWS_Dev"

mvn test -Dkarate.options="classpath:demo/userFeatureScenarioOutline.feature"

Jenkins : regular test
cd "C:\Dev\modular-framework-texas-practice-saurab"
mvn clean install
check karate saurab...
cd "C:\Dev\karateframework"
mvn clean install

cd "C:\Dev\karateframework"
mvn test -Dtest=KarateRunner

cd "C:\Dev\karateframework"
mvn test -Dkarate.options="classpath:demo/userFeatureScenarioOutline.feature"




mvn test -Dkarate.options="--tags ~@ignore classpath:demo/cats/cats.feature" -Dtest=DemoTestParallel

mvn test -Dtest=KarateRunner
mvn test -Dkarate.options="--tags ~@ignore classpath:demo/userFeatureScenarioOutline.feature" -Dtest=DemoTestParallel


If you want to run the Automation (Maven) Project from the terminal. You need to add the surefire plugin and run following command

maven-surefire-plugin - run a single test method

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
</plugins>
</build>

..............................................
You can use it to run a unit test in Maven. Few examples :

$ mvn 
$ mvn run install


# Run all the unit test classes.
$ mvn test

# Run a single test class.
$ mvn -Dtest=TestApp1 test

# Run multiple test classes.
$ mvn -Dtest=TestApp1,TestApp2 test

# Run a single test method from a test class.
$ mvn -Dtest=TestApp1#methodname test

# Run all test methods that match pattern 'testHello*' from a test class.
$ mvn -Dtest=TestApp1#testHello* test

# Run all test methods match pattern 'testHello*' and 'testMagic*' from a test class.
$ mvn -Dtest=TestApp1#testHello*+testMagic* test

If you are running your program on docker 
Dockers... It is an open-source project that automates the deployment of software applications inside containers by providing an additional layer of abstraction and automation  of OS-level virtualization on Linux

docker pull command prompt:  docker pull Jenkins/Jenkins
docker version:  docker --version
Reference:
  1. Download VirtualBox

  2. Debian mediate Download stable version  Download this one recommend-debian-edu-10.3.0-amd64-netinst.iso
  3. CheatSeat

No comments:

Post a Comment