Shell Practice
Shell Practice
A: Shell is an intermediatory between user and Operating system—it provides user with an
interface.
2.What is Bash?
A: .sh
A: Using $
A: $()
A: if [ expression ]
then
statement
fi
A: Declare -a arrayname or
A: Arrayname[indexplace]
A: Command | command
A: no of arguments passed
A: List of arguments
******************************************
A: A glob is a string of characters that matches file paths, using literal characters
A: a useful technique to generate lists of strings that can be used in scripts and aliases and on the
Linux command line.
A: Using fg command
64. What is the difference between a foreground process and a background process?
A: The trap command allows you to control the way a program behaves when it receives a
signal.
A: source is a Bash shell built-in command that executes the content of the file passed as an
argument in the current shell.
A: is a fragment of code that can be dynamically loaded into the Linux kernel without
requiring a reboot
A: Module “module_name”
A: are simple containers that contain all the required artifacts necessary to run a script.
A: a reusable packaged script that you can use when creating a new script
A:
A:It is a built-in feature that allows you to see what happens when your script is executed
A: Set -x
A: Unit tests focus on one part of an application in total isolation. Usually, that means a
single class or function.
A: helps find issues that are not obvious by examining the implementation of an entire
application or one specific unit,
A: you call make (or Ant or whatever) to build the package and then call whatever
deployment tool you use for deployment
A: Software tools that help software teams manage changes to source code over time. A
96. How do you use a script version control system in a shell script?
A: SVN or Git
Process Management:
A: kill -9 PID
Networking:
16. Ping a specific IP address to check its connectivity.
A: ping IPAddress
System Information:
A: uname -a
Package Management:
26. Install a package named "nginx" using the appropriate package manager.
A: yum install nginx -y
28. Search for a package named "python" using the package manager.
A: yum list all | grep -I python
File Search:
30. Locate all files with the extension ".txt" on the system.
31. Find the location of the executable file for the command "ls."
A: whereis ls
A: whereis filename
File Editors:
33. Open a file named "notes.txt" for editing using nano .
A: nano filename
A: vim config.conf
35. Save and exit the editor after making changes to a file.
A: :wq! And enter
System Control:
A: halt -l.
User Management:
Compression/Decompression Utilities:
44. Create a tar archive named "backup.tar" containing the files in the directory
A: tar -c backup.tar /filepath/directoryname
6. How do you run a shell script?