LEARN LINUX | PART 2 | INTERMEDIATE COMMANDS

LINUX | INTERMIDATE




LINUX SHELL [TERMINAL]
A shell is a program that receives commands from the user and gives it to the OS to process, and it shows the output. It is the main part of any linux distros as Linux is based on the command line interface (cli), however some of the GUI is implimented in linux distros to competete with other operating systems.

To open terminal, press ctrl+Alt+T or click on ther terminal icon.

Before starting this, please check the basic comands article here https://c0debyte.blogspot.com/2020/06/learn-linux-part-1-basic-commands.html so that you have clear idea.

LINUX INTERMEDIATE COMMANDS

find
Search for files in the given directory, hierarchically starting at the parent directory and moving to sub-directories.
usage:  root @ mr ~$ find -name '*.sh'



output:
./runyou.sh
./pqr.sh
./psr-for-loop.sh
./psr2.sh
./psr-for-loop1.sh
./pqr1.sh

* is a widcard and searches all the file having extension .sh, you can use file_name to get specific output.

grep
The grep command searches the given file for lines containing a match to the given strings or words. 
Suppose we search /etc/passwd for mr 

usage:  
root @ mr ~$ grep mr /etc/passwd 
root @ mr ~$ grep -i mr /etc/passwd  -i ignore word case and all other combination.
root @ mr ~$ grep -r 'mr' /etc  -r  read all files under each directory for a string 'mr' 

man

man provides online documentation for all the possible options with a command and its usages. Almost all the command comes with their corresponding manual pages.


ps
ps (Process) gives the status of running processes with a unique Id called PID.

usage
root @ mr ~$ ps
root @ mr ~$ ps -A  list status of all the processes along with pprocess id and PID 
root @ mr ~$ ps -A | grep -i ssh  output 1909 ? 00:00:00 ssh-agent


kill
This command is used to kill process which is not relevant now or is not responding. Here you can kill a process and start it without restarting the whole system.
use command ps to know what processes are running on your device.

usage:
root @ mr ~$  kill 1285 (to kill the process apache2)-by process id
root @ mr ~$  pkill apache2  another way to kill a process-by process name



Knowledge sharing is atmost quality of Knowledge gaining, Share the content to your friends.
For more content and quries SUBSCRIBE our blog

Thankyou.

Post a Comment

0 Comments