This document provides instructions on practicing various features of the Bash shell in Linux, including:
1. Creating and running simple shell scripts using tools like vi editor and chmod.
2. Using job control commands like foreground and background processes.
3. Manipulating the directory stack and using aliases to create command shortcuts.
4. Customizing shell features like history, prompts, and profiles.
Exercises are provided to help practice and explore these Bash shell capabilities.
GitHub is a Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, such as a wikis and basic task management tools for every project.
"A re-usable Ansible role to deploy projects".
When deploying software to production, it pays to have an automated process in place. This presentation describes a workflow to deploy your project (those familiar with Capistrano wil recognize this method), and then takes you step by step through an Ansible role that you can simply implement in your own ansible scripts.
GitHub is a Git repository hosting service, but it adds many of its own features. While Git is a command line tool, GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, such as a wikis and basic task management tools for every project.
"A re-usable Ansible role to deploy projects".
When deploying software to production, it pays to have an automated process in place. This presentation describes a workflow to deploy your project (those familiar with Capistrano wil recognize this method), and then takes you step by step through an Ansible role that you can simply implement in your own ansible scripts.
Composer has triggered a renaissance in the PHP community, it has changed the way we deal with other people’s code and it has changed the way we share our code. We are all slowly moving to using Composer, from Wordpress to Joomla and Drupal and frameworks in between. But many of us mistreat composer, follow outdated practices or simply lack a few tricks. In this session i’ll get you the low down on how to use composer the right way.
Ten common mistakes made with Functional Java JBCNConf18Brian Vermeer
Slides from my talk "Ten common mistakes made with Functional Java" @ JBCNConf 2018 Barcelona.
Beware that the slides are just here as a reference to people who attended this particular version of the talk. Please do not make assumptions purely from the slides alone ... there is a story with it ...really ;)
A soup to nuts presentation on using Composer and repository servers to manage and leverage shared code libraries for personal projects to the largest enterprise.
Composer has triggered a renaissance in the PHP community, it has changed the way we deal with other people’s code and it has changed the way we share our code. We are all slowly moving to using Composer, from Wordpress to Joomla and Drupal and frameworks in between. But many of us mistreat composer, follow outdated practices or simply lack a few tricks. In this session i’ll get you the low down on how to use composer the right way.
Ten common mistakes made with Functional Java JBCNConf18Brian Vermeer
Slides from my talk "Ten common mistakes made with Functional Java" @ JBCNConf 2018 Barcelona.
Beware that the slides are just here as a reference to people who attended this particular version of the talk. Please do not make assumptions purely from the slides alone ... there is a story with it ...really ;)
A soup to nuts presentation on using Composer and repository servers to manage and leverage shared code libraries for personal projects to the largest enterprise.
Makefiles are great for a lot of things and are generally used to build executable programs and libraries from source code but they are not limited to only that. This talk will probably convince you to start adding makefiles in your Python or any other programming project.
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
Greg Anderson's slide deck from BADCamp 2016.
Having a fine-tuned continuous integration environment is extremely valuable, even for small projects. Today, there is a wide variety of standalone projects and online Software-As-A-Service offerings that can super-streamline your everyday development tasks that can help you get your projects up and running like a pro. In this session, we'll look at how you can get the most out of:
- GitHub source code repository
- Packagist package manager for Composer
- Travis CI continuous integration service
- Coveralls code coverage service
- Scrutinizer static analysis service
- Box2 phar builder
- PhpDocumentor api documentation generator
- ReadTheDocs online documentation reader service
- Composer scripts and projects for running local tests and builds
BACKGROUND A shell provides a command-line interface for users. I.docxwilcockiris
BACKGROUND
: A shell provides a command-line interface for users. It interprets user commands and executes them. Some shells provide simple scripting terms, such as
if
or
while
, and allow users to make a program that facilitates their computing environment. Under the hood, a shell is just another user program as you know from Minor2 assignment. The file
/bin/bash
is an executable program file for the bash shell. The only thing special about your login shell is that it is listed in your login record so that /bin/login (i.e., the program that prompts you for your password) knows what program to start when you log in. If you run "cat /etc/passwd", you will see the login records of the machine.
PROGRAM DESCRIPTION
GROUP COLLABORATIVE PORTION
: In this assignment, you will implement the shell “engine” as the group component, where all members are responsible for the following functionality.
A Command-Line Interpreter, or Shell
Your shell should read the line from standard input (i.e., interactive mode) or a file (i.e., batch mode), parse the line with command and arguments, execute the command with arguments, and then prompt for more input (i.e., the shell prompt) when it has finished. This is what Minor 2 program should do with addition of batch processing which means just reading a batch line by line and calling the same interpretation logic.
Batch Mode
In batch mode, your shell is started by specifying a batch file on its command line. The batch file contains the list of commands that should be executed. In batch mode, you should not display a prompt, but you should echo each line you read from the batch file back to the user before executing it. After a batch is finished the shell will exit.
Interactive Mode
No parameters specified on command line when the shell is started. In this mode, you will display a prompt (any string of your choice) and the user of the shell will type in a command at the prompt.
You will need to use the fork() and exec() family of system calls. You may not use the system() system call as it simply invokes the system’s /bin/bash shell to do all of the work. You may assume that arguments are separated by whitespace. You do not have to deal with special characters such as ', ", \, etc. You may assume that the command-line a user types is no longer than 512 bytes (including the '\n'), but you should not assume that there is any restriction on the number of arguments to a given command.
INDIVIDUAL PORTIONS
Build-in Commands:
Every shell needs to support a number of built-in commands, which are functions in the shell itself, not external programs. Shells directly make system calls to execute built-in commands, instead of forking a child process to handle them.
In this assignment, each member of the group will implement one of the following section and commit in GitLab the code that supports those commands:
Add a new built-in
alias
command that allows you to define a shortcut for commands by essenti.
Welcome to the wonderful world of composer,
We will see what is composer, how we can use it.
Namespacing (What, How & Why)
& Autoloading your own code using composer
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
2. https://github.com/syaifulahdan/ospractice|Operating System Practice |2 to 39
A. Objectives
1. Understanding the shell on Linux operating system.
2. Using feature history in Bash Shell.
3. Change the history feature in Bash Shell.
4. the shell prompt.
5. Configure Bash Shell to run scripts automatically.
6. Create and execute simple shell scripts via vi editor.
7. Understand the job control.
8. Understand the stack.
9. Using aliases
4. https://github.com/syaifulahdan/ospractice|Operating System Practice |4 to 39
1. SHELL
Shell is a Command executive, meaning the program awaits
the user's instructions, checks the syntax of the given
instruction, then executes the command.
Shell is marked with a prompt. For user use prompt $ and
for superuser use promp #.
shell type:
/bin/sh
Developed by UNIX Berkeley known as C-Shell
/bin/csh
Bourne shell, designed by Steve Bourne of AT & T
/bin/bash
Compatible with Bourne Shell and also adapting Korn-Shell's ability.
The fundamental difference between Shell is resolved almost non-
existent, except in programming and editing facilities.
5. https://github.com/syaifulahdan/ospractice|Operating System Practice |5 to 39
1. SHELL
Shell is a Command executive, meaning the program awaits
the user's instructions, checks the syntax of the given
instruction, then executes the command.
Shell is marked with a prompt. For user use prompt $ and
for superuser use promp #.
shell type:
/bin/sh
Developed by UNIX Berkeley known as C-Shell
/bin/csh
Bourne shell, designed by Steve Bourne of AT & T
/bin/bash
Compatible with Bourne Shell and also adapting Korn-Shell's ability.
The fundamental difference between Shell is resolved almost non-
existent, except in programming and editing facilities.
6. https://github.com/syaifulahdan/ospractice|Operating System Practice |6 to 39
2. PROFILE
At login time, the program will run some program that is:
1. /etc/profile
It contains a shell script that applies to all Linux users.
2. Profile for each user
In the home directory, the login will first check the .bash_profile file.
If no, then the .bash_login file will be searched. If .bash_login does not
exist, then look for file named .profile
3. .bashrc
This file will be executed for switching from one shell to another through
su.
4. .bash_logout
At logout, bash will search for file .bash_logout. When present, the file
will be executed before logout
7. https://github.com/syaifulahdan/ospractice|Operating System Practice |7 to 39
The contents of / etc / profile:
# System wide environment and startup programs
# Functions and aliases go in /etc/bashrc
PATH=”$PATH:/usr/X11R6/bin”
PS1=”[u@h W]$ “
umask 022
USER=’id –un’
LOGNAME=$USER
MAIL=”/var/spool/mail/$USER”
HOSTNAME=’/bi n/hostname’
HISTSIZE=1000
HISTFILESIZE=1000
Export PATH PS1 HOSTNAME HISTSIZE HISTFILESIZE USER
LOGNAME MAIL
8. https://github.com/syaifulahdan/ospractice|Operating System Practice |8 to 39
PATH merupakan daftar nama direktori. Bila sebuah instruksi
diberikan dari prompt shell, maka instruksi tersebut akan
dicari pada daftar tersebut.
PS1 adalah prompt dimana
u = Nama User
h = Nama Host
W = Nama working direktory
9. https://github.com/syaifulahdan/ospractice|Operating System Practice |9 to 39
3. HISTORY
History is adapted from C-Shell, which is a record of all
the instructions that have so far been done. These
records can be viewed as history, then can be re-
selected, edited and executed. History allows the user to
re-edit complex and lengthy instructions, especially
when errors occur in the writing of instructions and
parameters.
^P (Ctrl-P) see previous instructions
^N (Ctrl-N see the next instruction
!! execution of previous instructions
!! –3 3 previous instructions will be repeated
!!88 repeat instruction no 88
10. https://github.com/syaifulahdan/ospractice|Operating System Practice |10 to 39
4. BASH-SCRIPT
Bash-script is a file that contains a collection of executable
programs. For bash script execution use .
before the bash-script file which means shell and sign
execution ./ means the bash-script file is in the actual
directory.
11. https://github.com/syaifulahdan/ospractice|Operating System Practice |11 to 39
5. JOB CONTROL
Job is a program execution given to the kernel. A Job is
deemed complete, when the execution of the program ends.
Execution Job is the same as the execution of the program,
both Background process and Foreground process.
12. https://github.com/syaifulahdan/ospractice|Operating System Practice |12 to 39
5. EDITOR vi
Vi is a full screen editor, meaning the editor can take
advantage of the full-screen facility. Vi has 2 pieces mode,
namely:
Command line
The vi editor interprets the input as an instruction to be
executed by the editor, examples such as searching text,
changing text automatically and others.
Editing
The vi editor interprets the output as text to be inserted into
the buffer editor. At the bottom of the screen will display the
text "INSERTING".
13. https://github.com/syaifulahdan/ospractice|Operating System Practice |13 to 39
At the beginning of vi run, the program enters command mode. With
pressing the "i" button will then enter editing. To return to
command mode, press the Esc key.
The keys of the vi editor text can be seen in the table as follows:
H Move cursor to left one character
J Move the cursor to the right of one character
K Pinda h kursor ke atas
L Move the cursor down
O Insert text (one line after cursor position) To exit the 5 insert lock
models next to this and
activate other keys, then we
must press the Esc key first
I Insert text (to the left of the cursor position)
A Insert text (to the right of the cursor position)
I (Shift i) Insert text (in the starting position of the line)
A (Shift a) Insert text (at the end of the line)
14. https://github.com/syaifulahdan/ospractice|Operating System Practice |14 to 39
X Deleting 1 letter (to the right of the cursor position)
Dw Delete 1 word (to the right of the cursor position)
Dd Removing 1 row (to the right of cursor position)
Yy Copying 1 line
2yy Copying 2 lines
P (Paste) Displays a sentence line that has been copied with yy key.
Cw Replace 1 word that has been written to the right of the cursor position with another word
Cc Replace 1 sentence line that has been written to the right of the cursor position with
another sentence
ctrl- b Reverse one screen
ctrl- f Forward one screen
ctrl- d Forward half screen
B Move the cursor to the left of one word
W Move the cursor to the right of one word
^ Go to the beginning of the line
$ Go to the end of the line
U Cancel the last command
U Undoes all text changes on the line where the cursor is located
:! Quit temporarily from vi editor and execute another command
15. https://github.com/syaifulahdan/ospractice|Operating System Practice |15 to 39
:wq Write and quite, save the file and exit
:q! Exit vi without saving
:se all Displays all set status options
:se nu Displays the line number on the left of the screen
/string Looking for strings forward
?string Looking for strings toward the back
N Forward the search for the same direction
N Continue searching for different directions
17. https://github.com/syaifulahdan/ospractice|Operating System Practice |17 to 39
1 Login as user.
2 Open the Console Terminal and do the experiments
below and then analyze the results of the
experiment.
3 Conduct the experiments below and then analyze
the experimental results.
4 Complete the practice questions.
20. https://github.com/syaifulahdan/ospractice|Operating System Practice |20 to 39
3. Running the script
$ bash p1.sh
$ sh p1.sh
$ . p1.sh
$ ./p1.sh
4. The convention in shell script creation is expressed as
#!/ Bin/bash. Add to the p1.sh file of the convention.
$ vi p1.sh
#!/bin/bash
echo “Program bash script”
21. https://github.com/syaifulahdan/ospractice|Operating System Practice |21 to 39
5. Create a p2.sh file
$ vi p2.sh
#!/bin/bash
echo “Program 2 bash script”
6. Running multiple shell programs in a single line of
instructions separated by a sign;
$ cat p1.sh ; cat p2.sh
$ ./p1.sh ; ./p2.sh
25. https://github.com/syaifulahdan/ospractice|Operating System Practice |25 to 39
Experiment 8 : Manipulation stack for
Directories
1. Dirs instruction is used to view the directory stack, the
output is displayed only home directory ~
$ dirs
2. Create 3 directory pieces
$ mkdir marketing sales support
3. Dirs instruction is used to view the directory stack, the
output is displayed only home directory ~
$ dirs
26. https://github.com/syaifulahdan/ospractice|Operating System Practice |26 to 39
Experiment 9 : Alias
1. Alias is a mechanism for naming aliases on one or a
group of instructions. To view aliases that have been
registered on the system:
$ alias
2. Create multiple aliases
$ alias del=’rm –i’
$ alias h=’history’
29. https://github.com/syaifulahdan/ospractice|Operating System Practice |29 to 39
Exercise : Practice 5B
1 Execution of all existing profiles:
a. Edit the profile file /etc/profile and display the message
as follows:
echo 'Profile of / etc / profile'
b. Assuming your name is student, then edit all existing profiles:
/home/student /.bash_profile
/home/. student/.bash_login
/home/student /.profile
/home/student /.bashrc
30. https://github.com/syaifulahdan/ospractice|Operating System Practice |30 to 39
c. Rename /home/student with your own name. , include the echo
instruction, eg On each file in
/home/student/.bash_profile:
echo "Profile from .bash_profile"
d. Do the same for other files, adjust the display with the
corresponding file name.
2 Run the user subtitute instruction, then exit with the command exit as
follows:
$ su student
$ exit
then use the - option as follows:
$ su – student
$ exit
Explain the differences between the two utilities.
31. https://github.com/syaifulahdan/ospractice|Operating System Practice |31 to 39
3 Logout
a. Edit .bash_logout file, show message and hold for 5 seconds,
before execution logout
Echo "Thank you for the session given"
Sleep 5
Clear
4 History
a. Change the value of HISTSIZE from 1000 to 20
$ HISTSIZE=20
$ h
b. Use the history feature by editing the 5th line instruction from the
last instruction.
$ !5
32. https://github.com/syaifulahdan/ospractice|Operating System Practice |32 to 39
c. Repeat the last instruction. Use also ^ P and ^ N to navigate to the
history buffer
$ !!
d. Repeat the instructions on the history buffer of a certain number,
eg number 150
$ !150
e. Repeat instruction with "ls" prefix
$! ls
$!? ls?
Explain the different instructions above
33. https://github.com/syaifulahdan/ospractice|Operating System Practice |33 to 39
5 Prompt String (PS)
a. Edit the .bash_profile file, replace the PS1 prompt with '>'. An
export instruction is required with the variable name of the variab le,
in order to change the PS1 variable known to all shells
PS1=’> ‘
export PS1
PS1 results experiment:
PS1=“! > “
69 > PS1=”d > “
Mon Sep 23 > PS1=”t > “
10:10:20 > PS1=”Saya=u > “
I =stD02001 > PS1=”w >”
~ > PS1=h >”
b. Change the color of the shell prompt in blue and blink.
34. https://github.com/syaifulahdan/ospractice|Operating System Practice |34 to 39
6 Bash script
a. Create 3 p1sh, p2.sh, p3.sh script with their respective contents:
p1.sh
#! /bin/bash
echo “Program p1”
ls –l
p2.sh
#! /bin/bash
echo “Program p2”
Who
p3.sh
#! /bin/bash
echo “Program p3”
ps x
36. https://github.com/syaifulahdan/ospractice|Operating System Practice |36 to 39
7 Jobs
a. Create a shell-script that does a loop with the name pwaktu.sh,
every 10 second, then save the date and time in the result file.
#!/bin/bash
while [ true ]
Do
date >> hasil
Sleep 10
Done
b. Run as background; then run one program (find utility)
$ jobs
$ find / print > files 2>/dev/null &
$ jobs
39. https://github.com/syaifulahdan/ospractice|Operating System Practice |39 to 39
“Pleasure in a job makes perfection on the results
achieved”. Aristoteles
“Believe you can. You're halfway”. Theodore Roosevelt
“You might be able to delay, but time will not wait”.
Benjamin Franklin
“The effort will work if someone does not give up”.
Napoleon Hill
“Opportunity to find a better strength in us arises
when life seems to be very challenging”. Joseph
Campbell