Skip to main content

Basic and some Advance Command in Unix #DOTC_Mdb

                 Basic and some Advance Command in Unix 

 

Hello Everyone,

In my Previous Blog we discussed about some basic command of Unix which is commonly used. Today I will discuss more about some more important command which is commonly used. Before starting new commands please go through my previous blog for your reference.

https://dheeraj60.blogspot.com/2020/08/basic-and-commonly-used-command-in-unix.html

Control Command in Unix : In Unix we have some key command through which we can terminate as well as command can run in background. Below are the key command and it’s uses in terminal.

Control-C: Command terminates the currently running foreground process.

Control-D: Command terminates the currently running login or terminal session.

Control-Z: Command suspends the currently running foreground process to the background.

 

To see the process by using ps –ef command : This command shows every process running , and result shows with PID.

I am running this command in Putty terminal and it will show all the process running in the system . Command is as below

$ ps –ef

Another command which is very popular is top command in unix which  displays a live status of current processes

 Below is the output of both command in Putty Terminal .


 

Since there is no process is running so command ps-ef   given the PID of our command only but top command displays live status of current process.


Now if you are in your Home directory and want to go in root directory from home we can use simply below command to move into root directory.

$ cd /

Below is the output in Putty Terminal of above command .

 

Now you can see that we are in root directory .

To clear the screen we need clear command in Unix which will clear all the commands and output from the current screen.

$ clear

History Command in Unix :  History command used to print history of  the current session.

$ history

It will show all the command issued in the system session . Below is the output for your reference.

 

Find command : Used to search for files and directories as mentioned in the expression . The find command in UNIX is a command line utility for walking a file hierarchy. It can be used to find files and directories and perform subsequent operations on them.

Basic Uses of Find Command

 Find all the files whose name is dheeraj.txt in a current working directory.

   find . -name dheeraj.txt

 Find all the files under /home directory with name dheeraj.txt

find /home -name dheeraj.txt

 Find all the files whose name is dheeraj.txt and contains both capital and small letters in /home directory

find /home -iname dheeraj.txt

 Find all directories whose name is DOTC in / (root) directory.

find / -type d -name DOTC

 Find all sql files whose name is categories.sql in a current working directory.

find . -type f -name categories.sql

Please see output of all the above 5 Find command carefully in Putty Terminal.


 

 Find all the files whose permissions are 777 . Below is the command to check .

 find . -type f -perm 0777 –print

 Find the files whose permission is not 777 we can use below command

find / -type f ! -perm 777

Below is the output in Putty terminal of both the find command in upper side you can able to see most of the files whose permission is not 777 and in last I used first command to see permission files only.


Find and Remove single files we can use below command

find . -type f -name "dheeraj.txt" -exec rm -f {} \;

Here dheeraj .txt files removed after executing above command .

Below is the output of above command in Putty Terminal


 

To find and remove multiple files such as .sql or .txt, then use below command.

find . -type f -name "*.txt" -exec rm -f {} \;

find . -type f -name "*.sql" -exec rm -f {} \;

Note : Please don't use above command  if you are working on any project just think before issuing this command . Also through Root we can use find command and find and remove any types of file .

In find command we have so many  commands . so you can use man command to see all the options of man command .

Man command in unix : This command is very useful as it Interface for working with the online reference manuals. If we want to know more about any command we can use man command to see all the useful tips through man command . Suppose I want to issue below command

$ man –f find

$ man find

To check the disk space in Unix we use below command to see the disk usage.

$ df –h -- To see the diskspace in GB

$ df –k – To see the diskspace in KB

Below is the output of above command in Putty Terminal for your understanding.


Other command to check disk usage:

du:  du command estimate disk usage is blocks

df: df command show number of free blocks for mounted file system.

 

Note : Still So many commands in Unix needs to be discussed as in Unix tons of command is available .

Please go through this blog carefully and ask me if you have any questions . In next blog I will again come up with advance unix commands like shed , grep and more advance command used in Unix and will try to write some basic shell script as well.

Thanks .

Comments

Post a Comment

Popular posts from this blog

SQL and Classification of SQL in Oracle Database #Diksha Oracle Training Centre

  SQL and Classification of SQL in Oracle Database.   SQL is Structured Query Language , which is used for storing, manipulating and retrieving data stored in a relational database .SQL is the standard language for RDBMS. All the Relational Database Management Systems (RDMS) like Oracle, MySQL, Sybase, Informix, IBM DB2 and Microsoft SQL Server use SQL as their standard database language. Oracle is one of the more secured database as compared to other databases. Importance of   SQL : SQL and PL/SQL is a backend process where all data is stored and retrieved in GUI which created either by any programming languages like Java, C++, PHP etc. so we need to have very secure database so that there will be no impact for users. SQL allows users to access data in the relational database management systems. SQL is used to communicate with a database.SQL and PL/SQL allows users to create and drop databases tables , views , stored procedures , functions , packages , trigger et...

Materialized View uses and Benefits in Database #DOTC_Mdb

Materialized View uses and Benefits in Database. Hello Everyone, Today we will discuss about Materialized view as it’s play important role in database. We already discussed about Simple Views and complex views in my previous blog. Before Materialized view go through my previous blog which related to simple view. https://dheeraj60.blogspot.com/2020/05/benefits-of-creating-and-using-view-in.html As we know View is not a database object and not like table which is stored in database, but view can be created from base table a view is an SQL statement that’s stored in the database. This statement, or view, has a name.A view looks and acts a lot like a table. It has columns and rows, and can be included in SELECT queries just like a table. In other word we can say View is a virtual/logical table which is basically used for security purpose. Let’s understand   about   Materialized view : A materialized view is a view that stores the results of the view’s query. Whenever you que...

Top 50 Interview Questions On SQL and PL/SQL #DOTC_Mdb

                    Top 50 Interview Questions On SQL and PL/SQL. Today we will Discuss Top 50 interview questions and answers of SQL and PL/SQL which is frequently asked in interview.     Question 1: What is SQL and Classification of SQL? Answer SQL is a Structure Query Language which is vastly used in RDBMS database like Oracle, Sybase, DB2 , Microsoft SQL server etc.   Classification of SQL is as below: DDL (Data Definition Language):  Commands are  create , alter , drop , truncate etc DML (Data Manipulation Language) : Commands are  insert,update and delete . TCL (Transaction Control Language ) : Commands are  Commit , Rollback and Save point. DCL (Data Control Language) : Commands are Grant , Revoke Question 2:    What is meant by Joins? What are the types of join? Answer Joins are basically used to extract/get data from multiple tables using s...