Professional Documents
Culture Documents
Linux
Linux
Linux
SHELL SCRIPTING
lslisting out files.
touchcreate a file
vi testto write inside a file (press I for insering & esc :wq! For saving)
rm -rremove directory
SHELL SCRIPTING
touch first-shell-script.sh to create file
#!/ shebang
#!/bin/ksh
Bash/sh/dashdifferent executables of linux
Commonly used is bash
#!/bin/sh & #!/bin/bash earlier both are same now a days we are using bin/bash
#!/bin/bash
Cd change directory
vim or touch #!/bin/bash
nproc prints the number of processing units available to the system or to the
current process.
Top provides a lot of information about the processes that are currently running on
the system. This information can be very helpful for identifying any processes that
are using excessive resources and need to be terminated.
vim nodeHealth.sh
INSERT
#!/bin/bash
###########
nproc prints the number of processing units available to the current process
:wq!
Chmod 777 nodeHealth.sh
./ nodeHealth.sh it displays the below, but we this we are unable to know exact
details, so we use
nproc prints the number of processing units available to the current process
:wq!
Chmod 777 nodeHealth.sh
vim nodeHealth.sh if there are huge we need to use below, generally devops engineer
uses below
set -x # debug mode
nproc prints the number of processing units available to the current process
:wq!
ps -ef a powerful tool that allows you to view information about the processes
running on your Linux system
ps -ef |grep “amazon” command is used to list all running processes on a Linux
system and filter the output by a specific process name. The ps command stands for
"process status" and the ef option tells the command to display information about all
processes in a full format. The grep command is used to search for a specific pattern
in the output of the ps command.
| pipe parameter integrates and sends the output of the first one to the second one
Echo 1
Echo 11
Echo 12
Echo 55
Echo 90
:wq!
Chmod 777 test.sh
./ test.sh
Vim test.sh | grep 1